Update custom sites (cs_code: remove/unhide in dom)

This commit is contained in:
magnolia1234 2022-12-21 18:04:11 +01:00
parent 5a94880b6e
commit 127c9d322f
9 changed files with 89 additions and 63 deletions

View file

@ -315,11 +315,20 @@ function set_rules(sites, sites_updated, sites_custom) {
if (rule.random_ip) {
random_ip[domain] = rule.random_ip;
}
// updated
// updated/custom
if (rule.amp_redirect)
amp_redirect[domain] = rule.amp_redirect.paywall ? rule.amp_redirect : {paywall: rule.amp_redirect};
if (rule.cs_code)
cs_code[domain] = rule.cs_code;
if (rule.cs_code) {
if (typeof rule.cs_code === 'string') {
try {
rule.cs_code = JSON.parse(rule.cs_code);
} catch (e) {
console.log(`cs_code not valid: ${rule.cs_code} error: ${e}`);
}
}
if (typeof rule.cs_code === 'object')
cs_code[domain] = rule.cs_code;
}
// custom
if (rule.googlebot > 0)
use_google_bot.push(domain);

View file

@ -3,6 +3,7 @@ Changelog Bypass Paywalls Clean - Firefox
Post-release
Add Wiwo.de
Update custom sites (cs_code: remove/unhide in dom)
* v2.9.8.0 (2022-12-18)
Add CaravanMagazine.in

View file

@ -46,7 +46,7 @@ if (!matchDomain(arr_localstorage_hold)) {
window.localStorage.clear();
}
function runOnMessage(bg2csData, dompurify_loaded, div_bpc_done) {
function runOnMessage(bg2csData, dompurify_loaded) {
// custom/updated sites: load text from json
if (bg2csData.ld_json && dompurify_loaded) {
if (bg2csData.ld_json.includes('|')) {
@ -96,8 +96,6 @@ if (bg2csData.ld_google_webcache && dompurify_loaded) {
}
}
if (!div_bpc_done) {
// check for opt-in confirmation (from background.js)
if (bg2csData.optin_setcookie) {
if (matchDomain(['crusoe.uol.com.br'])) {
@ -146,8 +144,11 @@ function cs_code_elems(elems) {
let rm_class = elem.rm_class.split(',').map(x => x.trim());
item.classList.remove(...rm_class);
}
if (elem.rm_attrib)
item.removeAttribute(elem.rm_attrib);
if (elem.rm_attrib) {
let rm_attribs = elem.rm_attrib.split('|');
for (let rm_attrib of rm_attribs)
item.removeAttribute(rm_attrib);
}
if (elem.set_attrib && elem.set_attrib.includes('|')) {
let attrib = elem.set_attrib.split('|')[0];
let value = elem.set_attrib.split('|')[1];
@ -166,22 +167,20 @@ if (bg2csData.cs_code) {
}, 1000);
}
}
}// runOnMessage
var div_bpc_done = document.querySelector('div#bpc_done');
var msg_once = false;
if (ext_api.runtime) {
ext_api.runtime.onMessage.addListener(
function (request, sender) {
if (request.msg === 'bg2cs' && !msg_once) {
msg_once = true;
runOnMessage(request.data, dompurify_loaded, div_bpc_done);
runOnMessage(request.data, dompurify_loaded);
}
})
}
var div_bpc_done = document.querySelector('div#bpc_done');
if (!div_bpc_done) {
if (ext_api.runtime) {

View file

@ -27,7 +27,7 @@
},
"Chicago.suntimes.com": {
"allow_cookies": 1,
"block_regex": "\\.tinypass\\.com\\/",
"block_regex": "\\.tinypass\\.com",
"domain": "chicago.suntimes.com"
},
"Christianitytoday.com": {
@ -37,7 +37,7 @@
},
"Columbian.com": {
"allow_cookies": 1,
"block_regex": "loader-cdn\\.azureedge\\.net\\/",
"block_regex": "loader-cdn\\.azureedge\\.net",
"domain": "columbian.com"
},
"Connexionfrance.com": {
@ -50,9 +50,14 @@
},
"Dailyherald.com": {
"allow_cookies": 1,
"block_regex": "\\.tinypass\\.com\\/",
"block_regex": "\\.tinypass\\.com",
"domain": "dailyherald.com"
},
"Diabeteshealth.co.in": {
"allow_cookies": 1,
"domain": "diabeteshealth.co.in",
"ld_json": "div#paywall-banner|div[class^='text-story-m_gap']"
},
"Die-glocke.de": {
"allow_cookies": 1,
"domain": "die-glocke.de",
@ -60,12 +65,12 @@
},
"Edweek.org": {
"allow_cookies": 1,
"block_regex": "js\\.pelcro\\.com\\/",
"block_regex": "js\\.pelcro\\.com",
"domain": "edweek.org"
},
"Eluniversal.com.mx": {
"allow_cookies": 1,
"block_regex": "\\.tinypass\\.com\\/",
"block_regex": "\\.tinypass\\.com",
"domain": "eluniversal.com.mx"
},
"Euromoney.com": {
@ -85,12 +90,12 @@
},
"Frieze.com": {
"allow_cookies": 1,
"block_regex": "js\\.pelcro\\.com\\/",
"block_regex": "js\\.pelcro\\.com",
"domain": "frieze.com"
},
"Gazette.com": {
"allow_cookies": 1,
"block_regex": "loader-cdn\\.azureedge\\.net\\/",
"block_regex": "loader-cdn\\.azureedge\\.net",
"domain": "gazette.com"
},
"Gplanet.co.il": {
@ -100,13 +105,13 @@
},
"Heidi.news": {
"allow_cookies": 1,
"block_regex": "\\.piano\\.io\\/",
"block_regex": "\\.piano\\.io",
"domain": "heidi.news",
"useragent": "googlebot"
},
"Heraldscotland.com": {
"allow_cookies": 1,
"block_regex": "\\.tinypass\\.com\\/",
"block_regex": "\\.tinypass\\.com",
"domain": "heraldscotland.com"
},
"Ilglobo.com": {
@ -135,7 +140,7 @@
},
"Irishexaminer.com": {
"allow_cookies": 1,
"block_regex": "\\.irishexaminer\\.com\\/pu_examiner\\/scripts\\/engage\\/",
"block_regex": "\\.irishexaminer\\.com\\/pu_examiner\\/scripts\\/engage",
"domain": "irishexaminer.com"
},
"Kaleva.fi": {
@ -160,12 +165,12 @@
},
"Lyrik.fr": {
"allow_cookies": 1,
"block_regex": "\\.qiota\\.com\\/",
"block_regex": "\\.qiota\\.com",
"domain": "lyrik.fr"
},
"Mailplus.co.uk": {
"allow_cookies": 1,
"block_regex": "\\.tinypass\\.com\\/",
"block_regex": "\\.tinypass\\.com",
"domain": "mailplus.co.uk"
},
"Mannheimer-morgen.de": {
@ -181,7 +186,7 @@
},
"Nationalobserver.com": {
"allow_cookies": 1,
"block_regex": "\\.tinypass\\.com\\/",
"block_regex": "\\.tinypass\\.com",
"domain": "nationalobserver.com"
},
"Newbostonpost.com": {
@ -191,12 +196,12 @@
},
"Nv.ua": {
"allow_cookies": 1,
"amp_redirect": "div[id^=\"media_paywall\"]",
"amp_redirect": "div[id^='media_paywall']",
"domain": "nv.ua"
},
"Odt.co.nz": {
"allow_cookies": 1,
"block_regex": "my\\.odt\\.co\\.nz\\/bwtw\\/api\\/TheWall\\/",
"block_regex": "my\\.odt\\.co\\.nz\\/bwtw\\/api\\/TheWall",
"domain": "odt.co.nz"
},
"Oz-online.de": {
@ -214,30 +219,35 @@
},
"Pressherald.com": {
"allow_cookies": 1,
"block_regex": "loader-cdn\\.azureedge\\.net\\/",
"block_regex": "loader-cdn\\.azureedge\\.net",
"domain": "pressherald.com"
},
"Reviewjournal.com": {
"allow_cookies": 1,
"block_regex": "js\\.matheranalytics\\.com\\/",
"block_regex": "js\\.matheranalytics\\.com",
"domain": "reviewjournal.com"
},
"Siliconrepublic.com": {
"allow_cookies": 1,
"block_regex": "js\\.pelcro\\.com\\/",
"block_regex": "js\\.pelcro\\.com",
"domain": "siliconrepublic.com"
},
"Sltrib.com": {
"allow_cookies": 1,
"block_regex": "\\.tinypass\\.com\\/",
"block_regex": "\\.tinypass\\.com",
"domain": "sltrib.com"
},
"Speld.nl": {
"domain": "speld.nl"
},
"Splainer.in": {
"allow_cookies": 1,
"cs_code": "[{\"cond\":\".subscription-prompt\",\"rm_elem\":1,\"elems\":[{\"cond\":\".hide-section\",\"rm_class\":\"hide-section\"}]}]",
"domain": "splainer.in"
},
"Spokesman.com": {
"allow_cookies": 1,
"block_regex": "loader-cdn\\.azureedge\\.net\\/",
"block_regex": "loader-cdn\\.azureedge\\.net",
"domain": "spokesman.com"
},
"Sportsbusinessjournal.com": {
@ -249,12 +259,18 @@
"domain": "stimme.de",
"ld_google_webcache": "div.paywall-product-box,div.fadeOut|div.art-text"
},
"Stylist.co.uk": {
"allow_cookies": 1,
"cs_code": "[{\"cond\":\"div[data-cy='upgradeAccountPaywall']\",\"rm_elem\":1,\"elems\":[{\"cond\":\"div.paywall\",\"rm_attrib\":\"class|style\"},{\"cond\":\"div.css-tu9vsa\",\"rm_attrib\":\"class\"}]}]",
"domain": "stylist.co.uk"
},
"Supchina.com": {
"allow_cookies": 1,
"block_regex": "\\.tinypass\\.com\\/",
"block_regex": "\\.tinypass\\.com",
"domain": "supchina.com"
},
"Swarajyamag.com": {
"amp_redirect": "div#story-notification",
"domain": "swarajyamag.com"
},
"The-japan-news.com": {
@ -263,6 +279,12 @@
"The-past.com": {
"domain": "the-past.com"
},
"Thecaterer.com": {
"allow_cookies": 1,
"cs_code": "[{\"cond\":\".locked-content\",\"rm_attrib\":\"class\"}]",
"domain": "thecaterer.com",
"useragent": "googlebot"
},
"Thecourier.co.uk": {
"allow_cookies": 1,
"domain": "thecourier.co.uk",
@ -283,7 +305,7 @@
},
"Thenational.scot": {
"allow_cookies": 1,
"block_regex": "\\.tinypass\\.com\\/",
"block_regex": "\\.tinypass\\.com",
"domain": "thenational.scot"
},
"Theweek.com": {
@ -298,7 +320,7 @@
},
"Toledoblade.com": {
"allow_cookies": 1,
"block_regex": "\\.tinypass\\.com\\/",
"block_regex": "\\.tinypass\\.com",
"domain": "toledoblade.com"
},
"Vigilantcitizen.com": {
@ -308,7 +330,7 @@
},
"Washingtontimes.com": {
"allow_cookies": 1,
"block_regex": "\\.tinypass\\.com\\/",
"block_regex": "\\.tinypass\\.com",
"domain": "washingtontimes.com"
}
}

View file

@ -715,5 +715,5 @@
"*://*.wallkit.net/*",
"*://webcache.googleusercontent.com/*"
],
"version": "2.9.8.2"
"version": "2.9.8.3"
}

View file

@ -10,7 +10,7 @@
<h2>Custom Sites</h2>
<div style="width:90%;">
To add a new site, enter an unique title/domain (without www.).<br>
Select options for useragent (like Googlebot), set referer (ignored when Googlebot is set), set random ip-address, block Javascript, block regular expression, unhide text on (or when paywall(selector) redirect to) amp-page and/or load text from json or Google webcache (paywall|article selector).<br>
Select options for useragent (like Googlebot), set referer (ignored when Googlebot is set), set random ip-address, block Javascript, block regular expression, unhide text on amp-page (or redirect to it) and/or load text from json or Google webcache (paywall|article selector); for examples import from GitLab.<br>
Custom sites (new) are enabled automatically in <small><button><a href="options.html" style="text-decoration:none;color:inherit">Options</a></button></small> (cookies will be removed by default unless you enable allow_cookies).<br>
If you want to use custom sites (for non-listed sites) enable it in <small><button><a href="optin/opt-in.html" style="text-decoration:none;color:inherit">Opt-in</a></button></small>
<strong>Custom sites enabled: <span id="custom-enabled"></span></strong><br>

View file

@ -21,7 +21,7 @@ function sortJson(json) {
function save_options() {
var textareaEl = document.querySelector('#bypass_sites textarea');
var sites_custom = {};
if (textareaEl.value !== '')
if (textareaEl.value)
var sites_custom = JSON.parse(textareaEl.value);
ext_api.storage.local.set({
sites_custom: sites_custom
@ -41,7 +41,7 @@ function save_options() {
function sort_options() {
var textareaEl = document.querySelector('#bypass_sites textarea');
var sites_custom = {};
if (textareaEl.value !== '') {
if (textareaEl.value) {
var sites_custom = JSON.parse(textareaEl.value);
var sites_custom_sorted = sortJson(sites_custom);
textareaEl.value = JSON.stringify(sites_custom_sorted);
@ -120,13 +120,13 @@ function _imp() {
// Add custom site to ext_api.storage
function add_options() {
var inputEls = document.querySelectorAll('#add_site input, #add_site select');
var inputEls = document.querySelectorAll('#add_site input, #add_site select, #add_site textarea');
var sites_custom = {};
for (let elem of inputEls) {
if (elem.dataset.key === 'title') {
var title = capitalize(elem.value);
if (title === '')
if (!title)
break;
sites_custom[title] = {};
} else {
@ -212,6 +212,7 @@ function edit_options() {
document.querySelector('input[data-key="block_javascript"]').checked = (edit_site.block_javascript > 0);
document.querySelector('input[data-key="block_javascript_ext"]').checked = (edit_site.block_javascript_ext > 0);
document.querySelector('input[data-key="block_regex"]').value = edit_site.block_regex ? edit_site.block_regex : '';
document.querySelector('textarea[data-key="cs_code"]').value = edit_site.cs_code ? edit_site.cs_code : '';
document.querySelector('input[data-key="amp_unhide"]').checked = (edit_site.amp_unhide > 0);
document.querySelector('input[data-key="amp_redirect"]').value = edit_site.amp_redirect ? edit_site.amp_redirect : '';
document.querySelector('input[data-key="ld_json"]').value = edit_site.ld_json ? edit_site.ld_json : '';
@ -281,11 +282,19 @@ function renderOptions() {
'amp_unhide': 1,
'amp_redirect': 0,
'ld_json': 0,
'ld_google_webcache': 0
'ld_google_webcache': 0,
'cs_code': 0,
};
for (var key in add_checkboxes) {
labelEl = document.createElement('label');
inputEl = document.createElement('input');
if (!['cs_code'].includes(key)) {
inputEl = document.createElement('input');
inputEl.size = 25;
} else {
inputEl = document.createElement('textarea');
inputEl.rows = 5;
inputEl.cols = 25;
}
inputEl.dataset.key = key.split(' (')[0];
labelEl.appendChild(inputEl);
if (add_checkboxes[key]) {
@ -299,6 +308,7 @@ function renderOptions() {
amp_redirect: 'div.paywall',
ld_json: 'div.paywall|div.article',
ld_google_webcache: 'div.paywall|div.article',
cs_code: 'for dev: check GitLab examples',
};
if (placeholders[key])
inputEl.placeholder = placeholders[key];
@ -355,7 +365,8 @@ function renderOptions() {
(sites_custom[key]['amp_unhide'] > 0 ? ' | amp_unhide' : '') +
(sites_custom[key]['amp_redirect'] ? ' | amp_redirect' : '') +
(sites_custom[key]['ld_json'] ? ' | ld_json' : '') +
(sites_custom[key]['ld_google_webcache'] ? ' | ld_google_webcache' : '');
(sites_custom[key]['ld_google_webcache'] ? ' | ld_google_webcache' : '') +
(sites_custom[key]['cs_code'] ? ' | cs_code' : '');
optionEl.value = key;
selectEl.add(optionEl);
}

View file

@ -283,7 +283,7 @@ var defaultSites = {
allow_cookies: 1,
block_regex: /\.clarin\.com\/.+\/auth\d\.js/
},
"CNBC": {
"CNBC (only news)": {
domain: "cnbc.com",
allow_cookies: 1,
block_regex: /\.tinypass\.com\//
@ -2383,4 +2383,4 @@ init_custom_flex_domains();
var au_news_corp_nofix_domains = ['cairnspost.com.au', 'geelongadvertiser.com.au', 'goldcoastbulletin.com.au', 'thechronicle.com.au', 'townsvillebulletin.com.au', 'weeklytimesnow.com.au'];
var be_mediahuis_nofix_domains = ['gva.be', 'hbvl.be'];
var it_gedi_nofix_domains = ['gelocal.it', 'huffingtonpost.it', 'ilsecoloxix.it', 'lastampa.it', 'limesonline.com'];
var nofix_sites = ['africaintelligence.com', 'africaintelligence.fr', 'aftenposten.no', 'badische-zeitung.de', 'bild.de', 'borsen.dk', 'businesstimes.com.sg', 'caixin.com', 'caixinglobal.com', 'courrierinternational.com', 'dn.se', 'elordenmundial.com', 'epw.in', 'expresso.pt', 'ftchinese.com', 'golem.de', 'heise.de', 'hs.fi', 'ilsole24ore.com', 'jacobinmag.com', 'jeuneafrique.com', 'kurier.at', 'lavie.fr', 'lavozdegalicia.es', 'law360.com', 'leconomiste.com', 'lefigaro.fr', 'lemonde.fr', 'lepoint.fr', 'letemps.ch', 'liberation.fr', 'medianama.com', 'mediapart.fr', 'milanofinanza.it', 'mondediplo.com', 'moneycontrol.com', 'nature.com', 'nbr.co.nz', 'nn.de', 'ouest-france.fr', 'philonomist.com', 'politiken.dk', 'pressreader.com', 'publico.pt', 'republic.ru', 'saechsische.de', 'schwarzwaelder-bote.de', 'statnews.com', 'stern.de', 'straitstimes.com', 'stuttgarter-nachrichten.de', 'stuttgarter-zeitung.de', 'suedkurier.de', 'swp.de', 'tagesanzeiger.ch', 'techcrunch.com', 'the-ken.com', 'theinformation.com', 'themorningcontext.com', 'theparisreview.org', 'thewirechina.com', 'weser-kurier.de', 'worldpoliticsreview.com', 'ynet.co.il', 'zerohedge.com'].concat(au_news_corp_nofix_domains, be_mediahuis_nofix_domains, it_gedi_nofix_domains);
var nofix_sites = ['africaintelligence.com', 'africaintelligence.fr', 'aftenposten.no', 'badische-zeitung.de', 'bild.de', 'borsen.dk', 'businesstimes.com.sg', 'caixin.com', 'caixinglobal.com', 'catalyst-journal.com', 'courrierinternational.com', 'dn.se', 'elordenmundial.com', 'epw.in', 'expresso.pt', 'ftchinese.com', 'golem.de', 'heise.de', 'hs.fi', 'ilsole24ore.com', 'jacobinmag.com', 'jeuneafrique.com', 'kurier.at', 'lavie.fr', 'lavozdegalicia.es', 'law360.com', 'leconomiste.com', 'lefigaro.fr', 'lemonde.fr', 'lepoint.fr', 'letemps.ch', 'liberation.fr', 'medianama.com', 'mediapart.fr', 'milanofinanza.it', 'mondediplo.com', 'moneycontrol.com', 'nationaljournal.com', 'nature.com', 'nbr.co.nz', 'nn.de', 'ouest-france.fr', 'philonomist.com', 'politicopro.com', 'politiken.dk', 'pressreader.com', 'publico.pt', 'republic.ru', 'saechsische.de', 'schwarzwaelder-bote.de', 'statnews.com', 'stern.de', 'straitstimes.com', 'stuttgarter-nachrichten.de', 'stuttgarter-zeitung.de', 'suedkurier.de', 'swp.de', 'tagesanzeiger.ch', 'techcrunch.com', 'the-ken.com', 'theinformation.com', 'themorningcontext.com', 'theparisreview.org', 'thewirechina.com', 'weser-kurier.de', 'worldpoliticsreview.com', 'ynet.co.il', 'zerohedge.com'].concat(au_news_corp_nofix_domains, be_mediahuis_nofix_domains, it_gedi_nofix_domains);

View file

@ -4,22 +4,6 @@
"allow_cookies": 1,
"block_regex": "\\.qiota\\.com\\/data"
},
"Neue Osnabrücker Zeitung": {
"domain": "noz.de",
"allow_cookies": 1,
"block_regex": "cdn\\.ampproject\\.org\\/v\\d\\/amp-access-.+\\.js",
"useragent": "googlebot"
},
"The Atlantic": {
"domain": "theatlantic.com",
"block_regex": "cdn\\.theatlantic\\.com\\/_next\\/static\\/chunks\\/[567].+\\.js",
"remove_cookies_select_drop": ["articleViews"]
},
"The Washington Post": {
"domain": "washingtonpost.com",
"allow_cookies": 1,
"block_regex": "\\.washingtonpost\\.com\\/tetro\\/metering\\/evaluate"
},
"WirtschaftsWoche": {
"domain": "wiwo.de",
"allow_cookies": 1,