mirror of
https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean.git
synced 2024-11-13 02:04:16 +01:00
Fix-update National Review (amp for plus)
Plus minor update opt-in UI
This commit is contained in:
parent
9bf0ca3e79
commit
d54f7aa6d1
6 changed files with 29 additions and 17 deletions
|
@ -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\?)/,
|
'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\/.+/,
|
'modernhealthcare.com': /.+\.tinypass\.com\/.+/,
|
||||||
'nationalgeographic.com': /.+\.blueconic\.net\/.+/,
|
'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\/.+/,
|
'newrepublic.com': /.+\.onecount\.net\/js\/.+/,
|
||||||
'newsweek.com': /.+\.googletagmanager\.com\/gtm\.js/,
|
'newsweek.com': /.+\.googletagmanager\.com\/gtm\.js/,
|
||||||
'newyorker.com': /.+\.newyorker\.com\/verso\/static\/presenter-articles.+\.js/,
|
'newyorker.com': /.+\.newyorker\.com\/verso\/static\/presenter-articles.+\.js/,
|
||||||
|
|
|
@ -1087,6 +1087,21 @@ else if (domain = matchDomain("businesstimes.com.sg")) {
|
||||||
cx_custom.setAttribute('style', 'display:none');
|
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
|
// General Functions
|
||||||
function removeDOMElement(...elements) {
|
function removeDOMElement(...elements) {
|
||||||
for (let element of elements) {
|
for (let element of elements) {
|
||||||
|
|
|
@ -309,5 +309,5 @@
|
||||||
"webRequest",
|
"webRequest",
|
||||||
"webRequestBlocking"
|
"webRequestBlocking"
|
||||||
],
|
],
|
||||||
"version": "1.8.7.0"
|
"version": "1.8.7.1"
|
||||||
}
|
}
|
|
@ -40,5 +40,5 @@
|
||||||
"webRequest",
|
"webRequest",
|
||||||
"webRequestBlocking"
|
"webRequestBlocking"
|
||||||
],
|
],
|
||||||
"version": "1.8.7.0"
|
"version": "1.8.7.1"
|
||||||
}
|
}
|
|
@ -16,7 +16,7 @@
|
||||||
Boston Globe</br>
|
Boston Globe</br>
|
||||||
Irish Independent</br>
|
Irish Independent</br>
|
||||||
The Belfast Telegraph</p>
|
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">
|
<div id="button-container">
|
||||||
<button id="button-enable">Enable</button>
|
<button id="button-enable">Enable</button>
|
||||||
<button id="button-cancel" autofocus="true">Disable</button>
|
<button id="button-cancel" autofocus="true">Disable</button>
|
||||||
|
|
|
@ -2,10 +2,9 @@
|
||||||
var ext_api = chrome || browser;
|
var ext_api = chrome || browser;
|
||||||
|
|
||||||
window.addEventListener("load", function () {
|
window.addEventListener("load", function () {
|
||||||
|
var opt_in_enabled = document.getElementById('opt-in-enabled');
|
||||||
ext_api.storage.sync.get("optIn", function (result) {
|
ext_api.storage.sync.get("optIn", function (result) {
|
||||||
var opt_in_enabled = document.getElementById('opt-in-enabled');
|
opt_in_enabled.innerText = result.optIn ? 'YES' : 'NO';
|
||||||
opt_in_enabled.appendChild(document.createTextNode('SetCookie opt-in enabled: ' + (result.optIn ? 'YES' : 'NO')));
|
|
||||||
//console.log("Setting up UI. result.optIn:" + result.optIn);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById("button-enable").addEventListener(
|
document.getElementById("button-enable").addEventListener(
|
||||||
|
@ -15,7 +14,10 @@ window.addEventListener("load", function () {
|
||||||
"optIn": true,
|
"optIn": true,
|
||||||
"optInShown": true
|
"optInShown": true
|
||||||
});
|
});
|
||||||
window.close();
|
opt_in_enabled.innerText = 'YES';
|
||||||
|
setTimeout(function () {
|
||||||
|
window.close();
|
||||||
|
}, 800);
|
||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById("button-cancel").addEventListener(
|
document.getElementById("button-cancel").addEventListener(
|
||||||
|
@ -25,14 +27,9 @@ window.addEventListener("load", function () {
|
||||||
"optIn": false,
|
"optIn": false,
|
||||||
"optInShown": true
|
"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;
|
|
||||||
});
|
|
||||||
**/
|
|
||||||
});
|
});
|
Loading…
Reference in a new issue