drop.chapril.org-firefoxsend/app/pages/legal.js

39 lines
1.1 KiB
JavaScript
Raw Normal View History

const html = require('choo/html');
const raw = require('choo/html/raw');
2018-08-03 21:24:41 +02:00
const assets = require('../../common/assets');
const title = require('../templates/title');
module.exports = function(state) {
2018-02-16 21:56:53 +01:00
return html`
2018-02-22 01:40:52 +01:00
<div>
2018-08-03 21:24:41 +02:00
<a href="/" class="goBackButton">
<img src="${assets.get('back-arrow.svg')}"/>
</a>
${title(state)}
<div class="title">${state.translate('legalHeader')}</div>
${raw(
replaceLinks(state.translate('legalNoticeTestPilot'), [
'https://testpilot.firefox.com/terms',
'https://testpilot.firefox.com/privacy',
'https://testpilot.firefox.com/experiments/send'
])
)}
${raw(
replaceLinks(state.translate('legalNoticeMozilla'), [
'https://www.mozilla.org/privacy/websites/',
'https://www.mozilla.org/about/legal/terms/mozilla/'
])
)}
</div>
`;
};
2018-02-16 21:56:53 +01:00
function replaceLinks(str, urls) {
let i = 0;
const s = str.replace(
/<a>([^<]+)<\/a>/g,
(m, v) => `<a href="${urls[i++]}">${v}</a>`
);
return `<div class="description">${s}</div>`;
}