FF60+: show additional info in popup on AMO

#312
This commit is contained in:
tophf 2018-03-23 01:44:40 +03:00
parent 18fc5fc1e5
commit 9969266379
3 changed files with 15 additions and 7 deletions

View File

@ -1087,6 +1087,10 @@
"message": "To allow access open <about:config>, right-click the list, click 'New', then 'Boolean', paste <privacy.resistFingerprinting.block_mozAddonManager> and click OK, <true>, OK, reload the <addons.mozilla.org> page.", "message": "To allow access open <about:config>, right-click the list, click 'New', then 'Boolean', paste <privacy.resistFingerprinting.block_mozAddonManager> and click OK, <true>, OK, reload the <addons.mozilla.org> page.",
"description": "Note in the popup when opened on addons.mozilla.org in Firefox >= 59" "description": "Note in the popup when opened on addons.mozilla.org in Firefox >= 59"
}, },
"unreachableAMOHintNewFF": {
"message": "In Firefox 60 and newer you'll also have to to remove AMO domain from <extensions.webextensions.restrictedDomains> in <about:config>.",
"description": "Note in the popup when opened on addons.mozilla.org in Firefox >= 59"
},
"unreachableAMOHintOldFF": { "unreachableAMOHintOldFF": {
"message": "Only Firefox 59 and newer can be configured to allow WebExtensions to add style elements on CSP-protected sites such as this one.", "message": "Only Firefox 59 and newer can be configured to allow WebExtensions to add style elements on CSP-protected sites such as this one.",
"description": "Note in the popup when opened on addons.mozilla.org in Firefox < 59" "description": "Note in the popup when opened on addons.mozilla.org in Firefox < 59"

View File

@ -224,7 +224,9 @@ function $create(selector = 'div', properties, children) {
const element = ns const element = ns
? document.createElementNS(ns === 'SVG' || ns === 'svg' ? 'http://www.w3.org/2000/svg' : ns, tag) ? document.createElementNS(ns === 'SVG' || ns === 'svg' ? 'http://www.w3.org/2000/svg' : ns, tag)
: document.createElement(tag || 'div'); : tag === 'fragment'
? document.createDocumentFragment()
: document.createElement(tag || 'div');
for (const child of Array.isArray(children) ? children : [children]) { for (const child of Array.isArray(children) ? children : [children]) {
if (child) { if (child) {

View File

@ -129,12 +129,14 @@ function initPopup() {
const info = template.unreachableInfo; const info = template.unreachableInfo;
if (FIREFOX && tabURL.startsWith(URLS.browserWebStore)) { if (FIREFOX && tabURL.startsWith(URLS.browserWebStore)) {
$('label', info).textContent = t('unreachableAMO'); $('label', info).textContent = t('unreachableAMO');
$('p', info).insertAdjacentElement('afterend', const note = (FIREFOX < 59 ? t('unreachableAMOHintOldFF') : t('unreachableAMOHint')) +
$create('p', (FIREFOX < 60 ? '' : '\n' + t('unreachableAMOHintNewFF'));
t(FIREFOX < 59 ? 'unreachableAMOHintOldFF' : 'unreachableAMOHint') const renderToken = s => s[0] === '<' ? $create('b', s.slice(1, -1)) : s;
.split(/(<.*?>)/) const renderLine = line => $create('p', line.split(/(<.*?>)/).map(renderToken));
.map(s => s[0] === '<' ? $create('b', s.slice(1, -1)) : s))); const noteNode = $create('fragment', note.split('\n').map(renderLine));
$('p', info).remove(); const target = $('p', info);
target.parentNode.insertBefore(noteNode, target);
target.remove();
} }
document.body.classList.add('unreachable'); document.body.classList.add('unreachable');
document.body.insertBefore(info, document.body.firstChild); document.body.insertBefore(info, document.body.firstChild);