@@ -82,5 +82,4 @@ module.exports = function(state, emit) {
await fadeOut('#page-one');
emit('upload', { file, type: 'click' });
}
- return div;
};
diff --git a/app/templates/changePasswordSection/changePasswordSection.css b/app/templates/changePasswordSection/changePasswordSection.css
deleted file mode 100644
index fea7c090..00000000
--- a/app/templates/changePasswordSection/changePasswordSection.css
+++ /dev/null
@@ -1,29 +0,0 @@
-.changePasswordSection {
- padding: 10px 0;
- align-self: left;
- max-width: 100%;
- overflow-wrap: break-word;
-}
-
-.btn--reset {
- width: 80px;
- height: 30px;
- background: #fff;
- border-color: rgba(12, 12, 13, 0.3);
- margin-top: 5px;
- margin-left: 15px;
- margin-bottom: 12px;
- line-height: 24px;
- color: #313131;
-}
-
-.btn--reset:hover {
- background: #efeff1;
-}
-
-@media (max-device-width: 520px), (max-width: 520px) {
- .changePasswordSection {
- align-self: center;
- min-width: 95%;
- }
-}
diff --git a/app/templates/changePasswordSection/index.js b/app/templates/changePasswordSection/index.js
deleted file mode 100644
index 82746dbe..00000000
--- a/app/templates/changePasswordSection/index.js
+++ /dev/null
@@ -1,52 +0,0 @@
-const html = require('choo/html');
-const raw = require('choo/html/raw');
-const passwordInput = require('../passwordInput');
-
-module.exports = function(state, emit) {
- const file = state.storage.getFileById(state.params.id);
-
- return html`
- ${passwordSpan(file.password)}
-
- ${passwordInput(
- state.translate('unlockInputPlaceholder'),
- state.translate('changePasswordButton'),
- changePassword
- )}
-
`;
-
- function passwordSpan(password) {
- password = password || '●●●●●';
- const span = html`
${raw(
- state.translate('passwordResult', {
- password: ''
- })
- )}`;
- const masked = span.querySelector('.passwordMask');
- masked.textContent = password.replace(/./g, '●');
- return span;
- }
-
- function changePassword(event) {
- event.preventDefault();
- const password = document.getElementById('password-input').value;
- if (password.length > 0) {
- emit('password', { password, file });
- }
- return false;
- }
-
- function toggleResetInput(event) {
- const form = event.target.parentElement.querySelector('form.passwordInput');
- const input = document.getElementById('password-input');
- if (form.style.visibility === 'hidden' || form.style.visibility === '') {
- form.style.visibility = 'visible';
- input.focus();
- } else {
- form.style.visibility = 'hidden';
- }
- }
-};
diff --git a/app/templates/downloadButton/index.js b/app/templates/downloadButton/index.js
index ff95c0e3..e1cac538 100644
--- a/app/templates/downloadButton/index.js
+++ b/app/templates/downloadButton/index.js
@@ -1,15 +1,13 @@
const html = require('choo/html');
module.exports = function(state, emit) {
+ return html`
+
`;
+
function download(event) {
event.preventDefault();
emit('download', state.fileInfo);
}
-
- return html`
-
-
-
`;
};
diff --git a/app/templates/file/file.css b/app/templates/file/file.css
index 10344257..c20d667c 100644
--- a/app/templates/file/file.css
+++ b/app/templates/file/file.css
@@ -1,7 +1,7 @@
.fileData {
font-size: 15px;
vertical-align: top;
- color: #4a4a4a;
+ color: var(--lightTextColor);
padding: 17px 19px 0;
line-height: 23px;
position: relative;
diff --git a/app/templates/file/index.js b/app/templates/file/index.js
index ba91b00b..2d7d8937 100644
--- a/app/templates/file/index.js
+++ b/app/templates/file/index.js
@@ -3,30 +3,13 @@ const assets = require('../../../common/assets');
const number = require('../../utils').number;
const deletePopup = require('../popup');
-function timeLeft(milliseconds, state) {
- const minutes = Math.floor(milliseconds / 1000 / 60);
- const hours = Math.floor(minutes / 60);
- if (hours >= 1) {
- return state.translate('expiresHoursMinutes', {
- hours,
- minutes: minutes % 60
- });
- } else if (hours === 0) {
- if (minutes === 0) {
- return state.translate('expiresMinutes', { minutes: '< 1' });
- }
- return state.translate('expiresMinutes', { minutes });
- }
- return null;
-}
-
module.exports = function(file, state, emit) {
const ttl = file.expiresAt - Date.now();
const remainingTime =
timeLeft(ttl, state) || state.translate('linkExpiredAlt');
const downloadLimit = file.dlimit || 1;
const totalDownloads = file.dtotal || 0;
- const row = html`
+ return html`
${file.name}
@@ -84,6 +67,21 @@ module.exports = function(file, state, emit) {
emit('delete', { file, location: 'upload-list' });
emit('render');
}
-
- return row;
};
+
+function timeLeft(milliseconds, state) {
+ const minutes = Math.floor(milliseconds / 1000 / 60);
+ const hours = Math.floor(minutes / 60);
+ if (hours >= 1) {
+ return state.translate('expiresHoursMinutes', {
+ hours,
+ minutes: minutes % 60
+ });
+ } else if (hours === 0) {
+ if (minutes === 0) {
+ return state.translate('expiresMinutes', { minutes: '< 1' });
+ }
+ return state.translate('expiresMinutes', { minutes });
+ }
+ return null;
+}
diff --git a/app/templates/fileList/fileList.css b/app/templates/fileList/fileList.css
index ce147b08..da520289 100644
--- a/app/templates/fileList/fileList.css
+++ b/app/templates/fileList/fileList.css
@@ -7,7 +7,7 @@
.fileList__header {
font-size: 16px;
- color: #858585;
+ color: var(--lightTextColor);
font-weight: lighter;
text-align: left;
background: rgba(0, 148, 251, 0.05);
diff --git a/app/templates/fileList/index.js b/app/templates/fileList/index.js
index 43edbe4d..80c7c28d 100644
--- a/app/templates/fileList/index.js
+++ b/app/templates/fileList/index.js
@@ -2,9 +2,8 @@ const html = require('choo/html');
const file = require('../file');
module.exports = function(state, emit) {
- let table = '';
if (state.storage.files.length) {
- table = html`
+ return html`
@@ -31,5 +30,4 @@ module.exports = function(state, emit) {
`;
}
- return table;
};
diff --git a/app/templates/footer/footer.css b/app/templates/footer/footer.css
index 4d5ba5d6..8c9a9239 100644
--- a/app/templates/footer/footer.css
+++ b/app/templates/footer/footer.css
@@ -20,7 +20,7 @@
}
.legalSection__link {
- color: #858585;
+ color: var(--lightTextColor);
opacity: 0.9;
white-space: nowrap;
margin-right: 2vw;
@@ -31,7 +31,7 @@
}
.legalSection__link:visited {
- color: #858585;
+ color: var(--lightTextColor);
}
.legalSection__mozLogo {
diff --git a/app/templates/fxPromo/index.js b/app/templates/fxPromo/index.js
index 07ac8616..1b0532d5 100644
--- a/app/templates/fxPromo/index.js
+++ b/app/templates/fxPromo/index.js
@@ -2,9 +2,6 @@ const html = require('choo/html');
const assets = require('../../../common/assets');
module.exports = function(state, emit) {
- function clicked() {
- emit('experiment', { cd3: 'promo' });
- }
let classes = 'fxPromo';
switch (state.promo) {
case 'blue':
@@ -30,4 +27,8 @@ module.exports = function(state, emit) {
>Download Firefox now ≫
`;
+
+ function clicked() {
+ emit('experiment', { cd3: 'promo' });
+ }
};
diff --git a/app/templates/header/header.css b/app/templates/header/header.css
index c321b627..91b6ad04 100644
--- a/app/templates/header/header.css
+++ b/app/templates/header/header.css
@@ -59,7 +59,7 @@
border-radius: 3px;
border: 1px solid var(--primaryControlBGColor);
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
- color: #fff;
+ color: var(--primaryControlFGColor);
cursor: pointer;
display: block;
float: right;
@@ -85,7 +85,7 @@
}
.feedback:active {
- background-color: #0277d8;
+ background-color: var(--primaryControlHoverColor);
}
@media (max-device-width: 520px), (max-width: 520px) {
diff --git a/app/templates/header/index.js b/app/templates/header/index.js
index 304c7532..246f2e95 100644
--- a/app/templates/header/index.js
+++ b/app/templates/header/index.js
@@ -11,6 +11,28 @@ const assets = require('../../../common/assets');
string with the value from package.json. 🤢
*/
const version = require('../../../package.json').version || 'VERSION';
+const browser = browserName();
+
+module.exports = function(state) {
+ return html``;
+};
function browserName() {
try {
@@ -34,26 +56,3 @@ function browserName() {
return 'unknown';
}
}
-
-const browser = browserName();
-
-module.exports = function(state) {
- return html``;
-};
diff --git a/app/templates/passwordInput/index.js b/app/templates/passwordInput/index.js
index daba9752..368d8c67 100644
--- a/app/templates/passwordInput/index.js
+++ b/app/templates/passwordInput/index.js
@@ -1,26 +1,54 @@
const html = require('choo/html');
-module.exports = function(placeholder, action, submit) {
+module.exports = function(file, state, emit) {
+ const setting = state.settingPassword;
+ const formClass = file.hasPassword
+ ? 'passwordInput'
+ : 'passwordInput passwordInput--hidden';
+ const inputClass = setting ? 'input input--copied' : 'input input--noBtn';
+ const btnClass = setting
+ ? 'inputBtn inputBtn--loading'
+ : 'inputBtn inputBtn--hidden';
+ const action = file.hasPassword
+ ? state.translate('changePasswordButton')
+ : state.translate('addPasswordButton');
return html`
+
+ ${message(
+ setting,
+ file.hasPassword,
+ state.translate('passwordIsSet')
+ )}
+
`;
function inputChanged() {
+ const pwdmsg = document.querySelector('.passwordInput__msg');
+ if (pwdmsg) {
+ pwdmsg.textContent = '';
+ }
const resetInput = document.getElementById('password-input');
const resetBtn = document.getElementById('password-btn');
if (resetInput.value.length > 0) {
@@ -31,4 +59,24 @@ module.exports = function(placeholder, action, submit) {
resetInput.classList.add('input--noBtn');
}
}
+
+ function setPassword(event) {
+ event.preventDefault();
+ const password = document.getElementById('password-input').value;
+ if (password.length > 0) {
+ emit('password', { password, file });
+ }
+ return false;
+ }
};
+
+function passwordPlaceholder(password) {
+ return password ? password.replace(/./g, '●') : '●●●●●●●●●●●●';
+}
+
+function message(setting, pwd, deflt) {
+ if (setting || !pwd) {
+ return '';
+ }
+ return deflt;
+}
diff --git a/app/templates/passwordInput/passwordInput.css b/app/templates/passwordInput/passwordInput.css
index 2a0146c2..390a570f 100644
--- a/app/templates/passwordInput/passwordInput.css
+++ b/app/templates/passwordInput/passwordInput.css
@@ -3,16 +3,42 @@
display: flex;
flex-wrap: nowrap;
width: 80%;
- padding: 10px 5px;
+ padding: 10px 5px 5px;
+}
+
+.passwordInput__msg {
+ height: 100px;
+ margin: 0 5px;
+ font-size: 15px;
+ color: var(--lightTextColor);
}
.passwordInput--hidden {
visibility: hidden;
}
+.inputBtn--loading {
+ background-image: url('../assets/spinner.svg');
+ background-position: center;
+ background-size: 30px 30px;
+ background-repeat: no-repeat;
+ background-color: var(--successControlBGColor);
+ border: 1px solid var(--successControlBGColor);
+ color: var(--successControlFGColor);
+ width: 10em;
+}
+
+.inputBtn--loading:hover {
+ background-color: var(--successControlBGColor);
+}
+
@media (max-device-width: 520px), (max-width: 520px) {
.passwordInput {
flex-direction: column;
width: inherit;
}
+
+ .inputBtn--loading {
+ width: inherit;
+ }
}
diff --git a/app/templates/popup/index.js b/app/templates/popup/index.js
index 9af1106a..969115f4 100644
--- a/app/templates/popup/index.js
+++ b/app/templates/popup/index.js
@@ -1,14 +1,6 @@
const html = require('choo/html');
module.exports = function(msg, confirmText, cancelText, confirmCallback) {
- function hide(e) {
- e.stopPropagation();
- const popup = document.querySelector('.popup.popup--show');
- if (popup) {
- popup.classList.remove('popup--show');
- }
- }
-
return html`
`;
+
+ function hide(e) {
+ e.stopPropagation();
+ const popup = document.querySelector('.popup.popup--show');
+ if (popup) {
+ popup.classList.remove('popup--show');
+ }
+ }
};
diff --git a/app/templates/popup/popup.css b/app/templates/popup/popup.css
index 6ac17f81..3ced13ef 100644
--- a/app/templates/popup/popup.css
+++ b/app/templates/popup/popup.css
@@ -2,8 +2,8 @@
visibility: hidden;
min-width: 204px;
min-height: 105px;
- background-color: #fff;
- color: #000;
+ background-color: var(--pageBGColor);
+ color: var(--textColor);
border: 1px solid #d7d7db;
padding: 15px 24px;
box-sizing: content-box;
@@ -82,7 +82,7 @@
}
.popup__yes {
- color: #fff;
+ color: var(--primaryControlFGColor);
background-color: var(--primaryControlBGColor);
border-radius: 5px;
padding: 5px 25px;
diff --git a/app/templates/progress/index.js b/app/templates/progress/index.js
index f679fe41..74e273d0 100644
--- a/app/templates/progress/index.js
+++ b/app/templates/progress/index.js
@@ -9,7 +9,7 @@ const circumference = 2 * Math.PI * radius;
module.exports = function(progressRatio) {
const dashOffset = (1 - progressRatio) * circumference;
const percentComplete = percent(progressRatio);
- const div = html`
+ return html`
`;
- return div;
};
diff --git a/app/templates/selectbox/index.js b/app/templates/selectbox/index.js
index 40d32e26..51393035 100644
--- a/app/templates/selectbox/index.js
+++ b/app/templates/selectbox/index.js
@@ -5,6 +5,25 @@ module.exports = function(selected, options, translate, changed) {
const id = `select-${Math.random()}`;
let x = selected;
+ return html`
+
+
+ ${translate(selected)}
+
+
+
+ ${options.map(
+ i => html`
+ - ${number(i)}
`
+ )}
+
+ `;
+
function close() {
const ul = document.getElementById(id);
const body = document.querySelector('body');
@@ -37,21 +56,4 @@ module.exports = function(selected, options, translate, changed) {
}
close();
}
- return html`
-
-
- ${translate(selected)}
-
-
-
- ${options.map(
- i =>
- html`- ${number(
- i
- )}
`
- )}
-
- `;
};
diff --git a/app/templates/selectbox/selectbox.css b/app/templates/selectbox/selectbox.css
index b5a5eef7..2cacc960 100644
--- a/app/templates/selectbox/selectbox.css
+++ b/app/templates/selectbox/selectbox.css
@@ -15,7 +15,7 @@
left: 0;
padding: 0;
margin: 40px 0;
- background-color: white;
+ background-color: var(--pageBGColor);
border: 1px solid rgba(12, 12, 13, 0.3);
border-radius: 4px;
box-shadow: 1px 2px 4px rgba(12, 12, 13, 0.3);
diff --git a/app/templates/setPasswordSection/index.js b/app/templates/setPasswordSection/index.js
index f2cd2429..1883ad5c 100644
--- a/app/templates/setPasswordSection/index.js
+++ b/app/templates/setPasswordSection/index.js
@@ -3,10 +3,13 @@ const passwordInput = require('../passwordInput');
module.exports = function(state, emit) {
const file = state.storage.getFileById(state.params.id);
- const div = html`
+
+ return html`
`;
- function addPassword(event) {
- event.preventDefault();
- const password = document.getElementById('password-input').value;
- if (password.length > 0) {
- emit('password', { password, file });
- }
- return false;
- }
-
function togglePasswordInput(e) {
const unlockInput = document.getElementById('password-input');
const boxChecked = e.target.checked;
@@ -44,6 +34,4 @@ module.exports = function(state, emit) {
unlockInput.value = '';
}
}
-
- return div;
};
diff --git a/app/templates/setPasswordSection/setPasswordSection.css b/app/templates/setPasswordSection/setPasswordSection.css
index ac97bdc9..a8c46524 100644
--- a/app/templates/setPasswordSection/setPasswordSection.css
+++ b/app/templates/setPasswordSection/setPasswordSection.css
@@ -11,7 +11,7 @@
.checkbox__input {
position: absolute;
- visibility: collapse;
+ opacity: 0;
}
.checkbox__label {
@@ -31,12 +31,13 @@
border-radius: 2px;
}
+.checkbox__input:focus + .checkbox__label::before,
.checkbox:hover .checkbox__label::before {
border: 1px solid var(--primaryControlBGColor);
}
.checkbox__input:checked + .checkbox__label {
- color: #000;
+ color: var(--textColor);
}
.checkbox__input:checked + .checkbox__label::before {
@@ -44,6 +45,19 @@
background-position: 2px 1px;
}
+.checkbox__input:disabled + .checkbox__label {
+ cursor: auto;
+}
+
+.checkbox__input:disabled + .checkbox__label::before {
+ background-image: url('../assets/check-16.svg');
+ background-repeat: no-repeat;
+ background-size: 18px 18px;
+ border-color: var(--successControlBGColor);
+ background-color: var(--successControlBGColor);
+ cursor: auto;
+}
+
@media (max-device-width: 520px), (max-width: 520px) {
.setPasswordSection {
align-self: center;
diff --git a/assets/spinner.svg b/assets/spinner.svg
new file mode 100644
index 00000000..004a3566
--- /dev/null
+++ b/assets/spinner.svg
@@ -0,0 +1,17 @@
+
+
\ No newline at end of file
diff --git a/public/locales/en-US/send.ftl b/public/locales/en-US/send.ftl
index 93af284b..f0509943 100644
--- a/public/locales/en-US/send.ftl
+++ b/public/locales/en-US/send.ftl
@@ -113,3 +113,5 @@ enableJavascript = Please enable JavaScript and try again.
expiresHoursMinutes = { $hours }h { $minutes }m
# A short representation of a countdown timer containing the number of minutes remaining as digits, example "56m"
expiresMinutes = { $minutes }m
+# A short status message shown when a password is successfully set
+passwordIsSet = Password set
|