Fix-update National Review (amp for plus)

Plus minor update opt-in UI
This commit is contained in:
magnolia1234 2020-09-22 21:06:28 +02:00
parent 9bf0ca3e79
commit d54f7aa6d1
6 changed files with 29 additions and 17 deletions

View file

@ -197,7 +197,7 @@ var blockedRegexes = {
'mercuriovalpo.cl': /(.+\.mercuriovalpo\.cl\/impresa\/wp-content\/themes\/papel-digital-2019-desktop\/assets\/(vendor|\d)\.js|pram\.pasedigital\.cl\/API\/User\/Status\?)/,
'modernhealthcare.com': /.+\.tinypass\.com\/.+/,
'nationalgeographic.com': /.+\.blueconic\.net\/.+/,
'nationalreview.com': /.+\.blueconic\.net\/.+/,
'nationalreview.com': /(.+\.blueconic\.net\/.+|cdn\.ampproject\.org\/v\d\/amp-access-.+\.js)/,
'newrepublic.com': /.+\.onecount\.net\/js\/.+/,
'newsweek.com': /.+\.googletagmanager\.com\/gtm\.js/,
'newyorker.com': /.+\.newyorker\.com\/verso\/static\/presenter-articles.+\.js/,

View file

@ -1087,6 +1087,21 @@ else if (domain = matchDomain("businesstimes.com.sg")) {
cx_custom.setAttribute('style', 'display:none');
}
else if (matchDomain("nationalreview.com")) {
document.addEventListener('DOMContentLoaded', () => {
let url = window.location.href;
let article_truncated = document.querySelector('div#article-content-truncate-wrap');
window.setTimeout(function () {
if (article_truncated && !url.includes('/amp/')) {
if (url.includes('?'))
window.location.href = url.replace('?', 'amp/?')
else
window.location.href = url + 'amp';
}
}, 500); // Delay (in milliseconds)
});
}
// General Functions
function removeDOMElement(...elements) {
for (let element of elements) {

View file

@ -309,5 +309,5 @@
"webRequest",
"webRequestBlocking"
],
"version": "1.8.7.0"
"version": "1.8.7.1"
}

View file

@ -40,5 +40,5 @@
"webRequest",
"webRequestBlocking"
],
"version": "1.8.7.0"
"version": "1.8.7.1"
}

View file

@ -16,7 +16,7 @@
Boston Globe</br>
Irish Independent</br>
The Belfast Telegraph</p>
<p><span id="opt-in-enabled"></span></p>
<p>SetCookie opt-in enabled: <span id="opt-in-enabled"></span></p>
<div id="button-container">
<button id="button-enable">Enable</button>
<button id="button-cancel" autofocus="true">Disable</button>

View file

@ -2,10 +2,9 @@
var ext_api = chrome || browser;
window.addEventListener("load", function () {
var opt_in_enabled = document.getElementById('opt-in-enabled');
ext_api.storage.sync.get("optIn", function (result) {
var opt_in_enabled = document.getElementById('opt-in-enabled');
opt_in_enabled.appendChild(document.createTextNode('SetCookie opt-in enabled: ' + (result.optIn ? 'YES' : 'NO')));
//console.log("Setting up UI. result.optIn:" + result.optIn);
opt_in_enabled.innerText = result.optIn ? 'YES' : 'NO';
});
document.getElementById("button-enable").addEventListener(
@ -15,7 +14,10 @@ window.addEventListener("load", function () {
"optIn": true,
"optInShown": true
});
window.close();
opt_in_enabled.innerText = 'YES';
setTimeout(function () {
window.close();
}, 800);
});
document.getElementById("button-cancel").addEventListener(
@ -25,14 +27,9 @@ window.addEventListener("load", function () {
"optIn": false,
"optInShown": true
});
window.close();
opt_in_enabled.innerText = 'NO';
setTimeout(function () {
window.close();
}, 800);
});
/**
// set up the appearance of the popup depending on the outcome of the opt-in
ext_api.storage.sync.get("optInShown", function (result) {
console.log("Setting up UI. result.optInShown:" + result.optInShown);
document.getElementById("opt-in-prompt").hidden = result.optInShown;
document.getElementById("after-opt-in").hidden = !result.optInShown;
});
**/
});