nit: use 'html/raw' instead of html() where possible
This commit is contained in:
parent
950c9cdaeb
commit
dcfda9521b
@ -1,4 +1,5 @@
|
|||||||
const html = require('choo/html');
|
const html = require('choo/html');
|
||||||
|
const raw = require('choo/html/raw');
|
||||||
|
|
||||||
function replaceLinks(str, urls) {
|
function replaceLinks(str, urls) {
|
||||||
let i = -1;
|
let i = -1;
|
||||||
@ -6,7 +7,7 @@ function replaceLinks(str, urls) {
|
|||||||
i++;
|
i++;
|
||||||
return `<a href="${urls[i]}">${v}</a>`;
|
return `<a href="${urls[i]}">${v}</a>`;
|
||||||
});
|
});
|
||||||
return [`<div class="description">${s}</div>`];
|
return `<div class="description">${s}</div>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = function(state) {
|
module.exports = function(state) {
|
||||||
@ -14,14 +15,14 @@ module.exports = function(state) {
|
|||||||
<div id="page-one">
|
<div id="page-one">
|
||||||
<div id="legal">
|
<div id="legal">
|
||||||
<div class="title">${state.translate('legalHeader')}</div>
|
<div class="title">${state.translate('legalHeader')}</div>
|
||||||
${html(
|
${raw(
|
||||||
replaceLinks(state.translate('legalNoticeTestPilot'), [
|
replaceLinks(state.translate('legalNoticeTestPilot'), [
|
||||||
'https://testpilot.firefox.com/terms',
|
'https://testpilot.firefox.com/terms',
|
||||||
'https://testpilot.firefox.com/privacy',
|
'https://testpilot.firefox.com/privacy',
|
||||||
'https://testpilot.firefox.com/experiments/send'
|
'https://testpilot.firefox.com/experiments/send'
|
||||||
])
|
])
|
||||||
)}
|
)}
|
||||||
${html(
|
${raw(
|
||||||
replaceLinks(state.translate('legalNoticeMozilla'), [
|
replaceLinks(state.translate('legalNoticeMozilla'), [
|
||||||
'https://www.mozilla.org/privacy/websites/',
|
'https://www.mozilla.org/privacy/websites/',
|
||||||
'https://www.mozilla.org/about/legal/terms/mozilla/'
|
'https://www.mozilla.org/about/legal/terms/mozilla/'
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/* global EXPIRE_SECONDS */
|
/* global EXPIRE_SECONDS */
|
||||||
const html = require('choo/html');
|
const html = require('choo/html');
|
||||||
|
const raw = require('choo/html/raw');
|
||||||
const assets = require('../../common/assets');
|
const assets = require('../../common/assets');
|
||||||
const notFound = require('./notFound');
|
const notFound = require('./notFound');
|
||||||
const uploadPasswordSet = require('../templates/uploadPasswordSet');
|
const uploadPasswordSet = require('../templates/uploadPasswordSet');
|
||||||
@ -9,12 +10,12 @@ const { allowedCopy, delay, fadeOut } = require('../utils');
|
|||||||
|
|
||||||
function expireInfo(file, translate, emit) {
|
function expireInfo(file, translate, emit) {
|
||||||
const hours = Math.floor(EXPIRE_SECONDS / 60 / 60);
|
const hours = Math.floor(EXPIRE_SECONDS / 60 / 60);
|
||||||
const el = html([
|
const el = html`<div>${raw(
|
||||||
`<div>${translate('expireInfo', {
|
translate('expireInfo', {
|
||||||
downloadCount: '<select></select>',
|
downloadCount: '<select></select>',
|
||||||
timespan: translate('timespanHours', { num: hours })
|
timespan: translate('timespanHours', { num: hours })
|
||||||
})}</div>`
|
})
|
||||||
]);
|
)}</div>`;
|
||||||
const select = el.querySelector('select');
|
const select = el.querySelector('select');
|
||||||
const options = [1, 2, 3, 4, 5, 20].filter(i => i > (file.dtotal || 0));
|
const options = [1, 2, 3, 4, 5, 20].filter(i => i > (file.dtotal || 0));
|
||||||
const t = num => translate('downloadCount', { num });
|
const t = num => translate('downloadCount', { num });
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
const html = require('choo/html');
|
const html = require('choo/html');
|
||||||
|
const raw = require('choo/html/raw');
|
||||||
|
|
||||||
module.exports = function(state, emit) {
|
module.exports = function(state, emit) {
|
||||||
const file = state.storage.getFileById(state.params.id);
|
const file = state.storage.getFileById(state.params.id);
|
||||||
@ -30,12 +31,12 @@ module.exports = function(state, emit) {
|
|||||||
|
|
||||||
function passwordSpan(password) {
|
function passwordSpan(password) {
|
||||||
password = password || '●●●●●';
|
password = password || '●●●●●';
|
||||||
const span = html([
|
const span = html`<span>${raw(
|
||||||
`<span>${state.translate('passwordResult', {
|
state.translate('passwordResult', {
|
||||||
password:
|
password:
|
||||||
'<pre class="passwordOriginal"></pre><pre class="passwordMask"></pre>'
|
'<pre class="passwordOriginal"></pre><pre class="passwordMask"></pre>'
|
||||||
})}</span>`
|
})
|
||||||
]);
|
)}</span>`;
|
||||||
const og = span.querySelector('.passwordOriginal');
|
const og = span.querySelector('.passwordOriginal');
|
||||||
const masked = span.querySelector('.passwordMask');
|
const masked = span.querySelector('.passwordMask');
|
||||||
og.textContent = password;
|
og.textContent = password;
|
||||||
|
Loading…
Reference in New Issue
Block a user