mirror of
https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean.git
synced 2024-11-10 04:01:58 +01:00
Fix Tech in Asia (json)
Update options (search)
This commit is contained in:
parent
a65c3feb88
commit
2f8eefe068
9 changed files with 101 additions and 60 deletions
|
@ -529,6 +529,7 @@ ext_api.storage.local.get({
|
|||
// reset ungrouped sites
|
||||
let ungrouped_sites = {
|
||||
'The Athletic': 'theathletic.com',
|
||||
'The Stage Media (UK)': '###_uk_thestage_media',
|
||||
'The Week (regwall)': 'theweek.com'
|
||||
};
|
||||
for (let key in ungrouped_sites) {
|
||||
|
|
|
@ -8,6 +8,8 @@ Add Observador.pt
|
|||
Fix Autosport (js)
|
||||
Fix Fast Company (premium)
|
||||
Fix Mid-Day (amp-redirect)
|
||||
Fix Tech in Asia (json)
|
||||
Update options (search)
|
||||
|
||||
* v3.5.9.0 (2024-03-10)
|
||||
Add Funke Mediengruppe (fetch from archive.is)
|
||||
|
|
|
@ -5142,37 +5142,31 @@ else if (matchDomain('swarajyamag.com')) {
|
|||
}
|
||||
|
||||
else if (matchDomain('techinasia.com')) {
|
||||
window.setTimeout(function () {
|
||||
let paywall = document.querySelector('div.paywall-content');
|
||||
if (paywall && dompurify_loaded) {
|
||||
paywall.classList.remove('paywall-content');
|
||||
let par_missing = paywall.querySelectorAll('div[id^="attachment_"], a.flourish-credit');
|
||||
let attach_xhr = Array.from(par_missing).some(x => !x.hasChildNodes());
|
||||
if (attach_xhr) {
|
||||
let url = window.location.href;
|
||||
let url_xhr = url.replace('.com/', '.com/wp-json/techinasia/2.0/posts/').replace('/visual-story/', '/');
|
||||
fetch(url_xhr)
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
response.json().then(json => {
|
||||
let json_text = json.posts[0].content;
|
||||
json_text = json_text.replace(/width\=\"(\d){3,}\"/g, 'width="100%"').replace(/height\=\"(\d){3,}\"/g, 'height="100%"');
|
||||
let content = document.querySelector('div.content');
|
||||
if (json_text && content) {
|
||||
let parser = new DOMParser();
|
||||
let doc = parser.parseFromString('<div class="jsx-1794864983 content">' + DOMPurify.sanitize(json_text) + '</div>', 'text/html');
|
||||
let content_new = doc.querySelector('div.content');
|
||||
content.parentNode.replaceChild(content_new, content);
|
||||
}
|
||||
});
|
||||
let paywall = document.querySelector('div.paywall-content');
|
||||
if (paywall && dompurify_loaded) {
|
||||
paywall.classList.remove('paywall-content');
|
||||
let url = window.location.href;
|
||||
let url_xhr = url.replace('.com/', '.com/wp-json/techinasia/2.0/posts/').replace('/visual-story/', '/');
|
||||
fetch(url_xhr)
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
response.json().then(json => {
|
||||
let json_text = json.posts[0].content;
|
||||
json_text = json_text.replace(/width\=\"(\d){3,}\"/g, 'width="100%"').replace(/height\=\"(\d){3,}\"/g, 'height="100%"');
|
||||
let content = document.querySelector('div.content');
|
||||
if (json_text && content) {
|
||||
let parser = new DOMParser();
|
||||
let doc = parser.parseFromString('<div class="jsx-1794864983 content">' + DOMPurify.sanitize(json_text) + '</div>', 'text/html');
|
||||
let content_new = doc.querySelector('div.content');
|
||||
content.parentNode.replaceChild(content_new, content);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
let splash_subscribe = document.querySelector('div.splash-subscribe');
|
||||
let paywall_hard = document.querySelector('div.paywall-hard');
|
||||
removeDOMElement(splash_subscribe, paywall_hard);
|
||||
}, 3000);
|
||||
});
|
||||
}
|
||||
let splash_subscribe = document.querySelector('div.splash-subscribe');
|
||||
let paywall_hard = document.querySelector('div.paywall-hard');
|
||||
removeDOMElement(splash_subscribe, paywall_hard);
|
||||
}
|
||||
|
||||
else if (matchDomain(['techtarget.com', 'computerweekly.com', 'lemagit.fr'])) {
|
||||
|
|
|
@ -51,5 +51,5 @@
|
|||
"webRequestBlocking",
|
||||
"*://*/*"
|
||||
],
|
||||
"version": "3.5.9.4"
|
||||
"version": "3.5.9.5"
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"###_remove_sites": {
|
||||
"cs_code": "dn.se, faithfullymagazine.com, gazetaprawna.pl, lyrik.fr, mailplus.co.uk",
|
||||
"cs_code": "dn.se, faithfullymagazine.com, gazetaprawna.pl, lyrik.fr, mailplus.co.uk, portfolio.hu",
|
||||
"domain": "###"
|
||||
},
|
||||
"Abajournal.com": {
|
||||
|
@ -18,7 +18,7 @@
|
|||
"block_regex": "\\.acadienouvelle\\.com\\/script\\.js",
|
||||
"domain": "acadienouvelle.com"
|
||||
},
|
||||
"Airmail.news (refresh)": {
|
||||
"Airmail.news": {
|
||||
"add_ext_link": "div.paywall-card|div.article-text",
|
||||
"add_ext_link_type": "archive.is",
|
||||
"allow_cookies": 1,
|
||||
|
@ -644,16 +644,9 @@
|
|||
"Physicsworld.com": {
|
||||
"domain": "physicsworld.com"
|
||||
},
|
||||
"Piratewires.com (refresh)": {
|
||||
"Piratewires.com": {
|
||||
"allow_cookies": 1,
|
||||
"cs_code": "[{\"cond\":\"div[class*='article_articleRestricted_']\", \"rm_attrib\":\"class\"}, {\"cond\":\"div[class^='fixedOverlay']\", \"rm_elem\":1}]",
|
||||
"domain": "piratewires.com"
|
||||
},
|
||||
"Portfolio.hu": {
|
||||
"add_ext_link": "section.paywall|article",
|
||||
"add_ext_link_type": "archive.is",
|
||||
"allow_cookies": 1,
|
||||
"domain": "portfolio.hu",
|
||||
"domain": "piratewires.com",
|
||||
"useragent": "googlebot"
|
||||
},
|
||||
"Pourleco.com": {
|
||||
|
@ -790,10 +783,11 @@
|
|||
"domain": "t3n.de",
|
||||
"ld_json": "div.c-pro-wall__wrapper|div.pro-blur>p"
|
||||
},
|
||||
"Tamedia.ch (refresh)": {
|
||||
"Tamedia.ch": {
|
||||
"add_ext_link": "div#piano-premium|p[class^='ArticleParagraph_root_']",
|
||||
"add_ext_link_type": "google_search_tool",
|
||||
"allow_cookies": 1,
|
||||
"block_regex": "\\.tinypass\\.com",
|
||||
"domain": "###_ch_tamedia"
|
||||
},
|
||||
"Taxscan.in": {
|
||||
|
|
|
@ -857,5 +857,5 @@
|
|||
"*://archive.vn/*",
|
||||
"*://webcache.googleusercontent.com/*"
|
||||
],
|
||||
"version": "3.5.9.4"
|
||||
"version": "3.5.9.5"
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<h1 id="top">Options | <small><span id="version"></span><br><span id="version_new"></span></small></h1>
|
||||
<br><a href="https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean/-/blob/master/changelog.txt" target="_blank">Changelog</a>
|
||||
<div style="width:90%;">
|
||||
<br>Some selected sites will have their cookies cleared; uncheck the sites (or add to excluded sites) for which you have an account or else you will be logged out at every visit.<br>
|
||||
<br>Some selected sites will have their cookies cleared; uncheck the sites (or add to excluded sites) for which you have an account.<br>
|
||||
If you also want to block general paywall-scripts for unlisted sites you have to opt-in to custom sites (host permission for access to all sites is needed).
|
||||
<!-- To view some sites (check list) a necessary cookie has to be set (enable this in opt-in). -->
|
||||
</div>
|
||||
|
@ -23,6 +23,7 @@
|
|||
<small><button id="clear_sites_updated">Clear updated sites</button></small>
|
||||
<small><button><a href="options_excluded.html" style="text-decoration:none;color:inherit">Excluded sites</a></button></small>
|
||||
<small><button><a href="#save" style="text-decoration:none;color:inherit">Go to bottom</a></button></small>
|
||||
<input id="search" type="text" size="30" placeholder="Search (domain)name ...">
|
||||
</div>
|
||||
<div style="clear:both;"></div>
|
||||
<strong style="color:red;"><div id="perm-custom"></div></strong>
|
||||
|
|
|
@ -5,7 +5,7 @@ function save_options(event) {
|
|||
var inputEls = document.querySelectorAll('#bypass_sites input');
|
||||
var sites = {};
|
||||
|
||||
var sites = Array.from(inputEls).reduce(function(memo, inputEl) {
|
||||
var sites = Array.from(inputEls).reduce(function (memo, inputEl) {
|
||||
if (inputEl.checked) {
|
||||
memo[inputEl.dataset.key] = inputEl.dataset.value;
|
||||
}
|
||||
|
@ -14,17 +14,17 @@ function save_options(event) {
|
|||
|
||||
ext_api.storage.local.set({
|
||||
sites: sites
|
||||
}, function() {
|
||||
}, function () {
|
||||
// Update status to let user know options were saved.
|
||||
if (event) {
|
||||
var status_label = document.querySelectorAll('[id^="status"]');
|
||||
for (let status of status_label) {
|
||||
status.textContent = 'Options saved.';
|
||||
setTimeout(function () {
|
||||
status.textContent = '';
|
||||
}, 800);
|
||||
}
|
||||
}
|
||||
if (event) {
|
||||
var status_label = document.querySelectorAll('[id^="status"]');
|
||||
for (let status of status_label) {
|
||||
status.textContent = 'Options saved.';
|
||||
setTimeout(function () {
|
||||
status.textContent = '';
|
||||
}, 800);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -116,8 +116,55 @@ function renderOptions() {
|
|||
});
|
||||
}
|
||||
|
||||
function handleSearch() {
|
||||
let search = document.getElementById('search').value.toLowerCase().replace('www.', '');
|
||||
let listItems = document.querySelectorAll('#bypass_sites > label');
|
||||
grouped_sites = filterObject(grouped_sites, function (val, key) {
|
||||
return val.length
|
||||
});
|
||||
ext_api.storage.local.get({
|
||||
sites_updated: {},
|
||||
sites_custom: {}
|
||||
}, function (items) {
|
||||
let sites_updated_groups = filterObject(items.sites_updated, function (val, key) {
|
||||
return val.group
|
||||
}, function (val, key) {
|
||||
return [val.domain, val.group]
|
||||
});
|
||||
for (let site in sites_updated_groups) {
|
||||
let site_default = Object.keys(defaultSites).find(key => compareKey(key, site)) || site;
|
||||
grouped_sites[site_default] = sites_updated_groups[site];
|
||||
}
|
||||
let sites_custom_groups = filterObject(items.sites_custom, function (val, key) {
|
||||
return val.group
|
||||
}, function (val, key) {
|
||||
return [val.domain, val.group.split(',')]
|
||||
});
|
||||
for (let site in sites_custom_groups)
|
||||
grouped_sites[site] = sites_custom_groups[site];
|
||||
for (let item of listItems) {
|
||||
let itemText = item.textContent.toLowerCase();
|
||||
let itemInput = item.querySelector('input[data-value]');
|
||||
let itemDomain = itemInput ? itemInput.getAttribute('data-value') : '';
|
||||
let itemGroup = itemDomain ? grouped_sites[itemDomain] : '';
|
||||
if (itemText.includes(search) || !itemDomain || (itemDomain && (itemDomain.match(/^(###$|#options_[^d])/) || itemDomain.includes(search) || (itemGroup && itemGroup.includes(search)))))
|
||||
item.style.display = 'block';
|
||||
else
|
||||
item.style.display = 'none';
|
||||
}
|
||||
});
|
||||
|
||||
let selectButtons = document.querySelectorAll('#select-all, #select-none');
|
||||
for (let elem of selectButtons) {
|
||||
if (search == '')
|
||||
elem.style.display = 'block';
|
||||
else
|
||||
elem.style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
function selectAll() {
|
||||
var inputEls = Array.from(document.querySelectorAll('input'));
|
||||
var inputEls = Array.from(document.querySelectorAll('input[data-key]'));
|
||||
inputEls = inputEls.filter(function (input) {
|
||||
return (!input.dataset.value.match(/^#options_(disable|optin)_/));
|
||||
});
|
||||
|
@ -169,6 +216,7 @@ document.getElementById('save').addEventListener('click', save_options);
|
|||
document.getElementById('save_top').addEventListener('click', save_options);
|
||||
document.getElementById('select-all').addEventListener('click', selectAll);
|
||||
document.getElementById('select-none').addEventListener('click', selectNone);
|
||||
document.getElementById("button-close").addEventListener('click', closeButton);
|
||||
document.getElementById('button-close').addEventListener('click', closeButton);
|
||||
document.getElementById('check_sites_updated').addEventListener('click', check_sites_updated);
|
||||
document.getElementById('clear_sites_updated').addEventListener('click', clear_sites_updated);
|
||||
document.getElementById('search').addEventListener('input', handleSearch);
|
||||
|
|
5
sites.js
5
sites.js
|
@ -2262,6 +2262,7 @@ var defaultSites = {
|
|||
"Tech in Asia": {
|
||||
domain: "techinasia.com",
|
||||
allow_cookies: 1,
|
||||
useragent: "googlebot",
|
||||
cs_dompurify: 1
|
||||
},
|
||||
"TechTarget Group": {
|
||||
|
@ -2621,7 +2622,7 @@ var defaultSites = {
|
|||
block_regex: /\.tinypass\.com\//
|
||||
},
|
||||
"The Stage Media (UK)": {
|
||||
"domain": "uk_thestage_media",
|
||||
"domain": "###_uk_thestage_media",
|
||||
"allow_cookies": 1,
|
||||
"group": [
|
||||
"thebookseller.com",
|
||||
|
@ -3097,4 +3098,4 @@ var fr_groupe_ebra_nofix_domains = ['bienpublic.com', 'dna.fr', 'estrepublicain.
|
|||
var fr_indigo_nofix_domains = ['africaintelligence.com', 'africaintelligence.fr', 'glitz.paris', 'intelligenceonline.com', 'intelligenceonline.fr', 'lalettre.fr'];
|
||||
var it_gedi_nofix_domains = ['gelocal.it', 'limesonline.com'];
|
||||
var nl_mediahuis_region_nofix_domains = ['gooieneemlander.nl', 'haarlemsdagblad.nl', 'ijmuidercourant.nl', 'leidschdagblad.nl', 'noordhollandsdagblad.nl'];
|
||||
var nofix_sites = ['11freunde.de', 'aamulehti.fi', 'aftenposten.no', 'aftonbladet.se', 'allgaeuer-zeitung.de', 'arkansasonline.com', 'asahi.com', 'asiatimes.com', 'aviationweek.com', 'badische-zeitung.de', 'bhaskar.com', 'bloomberglaw.com', 'bloombergtax.com', 'bnef.com', 'bnn.de', 'borsen.dk', 'businessinsider.de', 'businessinsider.jp', 'businesslive.co.za', 'businesstimes.com.sg', 'caixin.com', 'caixinglobal.com', 'caravanmagazine.in', 'catalyst-journal.com', 'chegg.com', 'codesports.com.au', 'compactmag.com', 'coursehero.com', 'deutsche-wirtschafts-nachrichten.de', 'die-glocke.de', 'dn.no', 'dn.se', 'elordenmundial.com', 'entrepreneur.com', 'epw.in', 'ewmagazine.nl', 'falter.at', 'finance.si', 'franc-tireur.fr', 'ftchinese.com', 'ftchineselive.com', 'gamestar.de', 'geo.de', 'golem.de', 'gp.se', 'gva.be', 'handelsblatt.com', 'hbrarabic.com', 'hbrchina.org', 'hbrfrance.fr', 'heise.de', 'hs.fi', 'information.dk', 'investors.com', 'iltalehti.fi', 'jacobin.com', 'jeuneafrique.com', 'jungefreiheit.de', 'kleinezeitung.at', 'krone.at', 'laverita.info', 'lavie.fr', 'lavozdegalicia.es', 'law360.co.uk', 'law360.com', 'le1hebdo.fr', 'leconomiste.com', 'lefigaro.fr', 'lefilmfrancais.com', 'lemonde.fr', 'lequipe.fr', 'lesjours.fr', 'letemps.ch', 'liberation.fr', 'libertiesjournal.com', 'lr-online.de', 'main-echo.de', 'mainpost.de', 'manager-magazin.de', 'medianama.com', 'mediapart.fr', 'milanofinanza.it', 'mittelbayerische.de', 'monde-diplomatique.fr', 'mondediplo.com', 'money.it', 'moneycontrol.com', 'moodys.com', 'morningstar.com', 'motorsport.com', 'moz.de', 'nachrichten.at', 'nationaljournal.com', 'nature.com', 'nbr.co.nz', 'newcriterion.com', 'news24.com', 'newslaundry.com', 'nn.de', 'nwzonline.de', 'on3.com', 'ouest-france.fr', 'philonomist.com', 'pnp.de', 'politicopro.com', 'politiken.dk', 'pressreader.com', 'publico.pt', 'puck.news', 'quillette.com', 'rbc.ru', 'republic.ru', 'rheinpfalz.de', 'risk.net', 'rnz.de', 'saechsische.de', 'sciencedirect.com', 'springer.com', 'statnews.com', 'stern.de', 'stimme.de', 'streetinsider.com', 'substack.com', 'svd.se', 'swp.de', 'taxation.co.uk', 'taxjournal.com', 'the-ken.com', 'theinformation.com', 'theinitium.com', 'themorningcontext.com', 'theparisreview.org', 'thestar.com.my', 'thewirechina.com', 'timeslive.co.za', 'weltwoche.ch', 'weltwoche.de', 'wissenschaft.de', 'worldpoliticsreview.com', 'wz.de', 'zaobao.com.sg'].concat(de_funke_medien_nofix_domains, de_rp_aachen_medien_nofix_domains, de_westfalen_medien_nofix_domains, fr_be_groupe_rossel_nofix_domains, fr_groupe_ebra_nofix_domains, fr_indigo_nofix_domains, it_gedi_nofix_domains, nl_mediahuis_region_nofix_domains);
|
||||
var nofix_sites = ['11freunde.de', 'aamulehti.fi', 'aftenposten.no', 'aftonbladet.se', 'allgaeuer-zeitung.de', 'americanscientist.org', 'arkansasonline.com', 'asahi.com', 'asiatimes.com', 'aviationweek.com', 'badische-zeitung.de', 'bhaskar.com', 'bloomberglaw.com', 'bloombergtax.com', 'bnef.com', 'bnn.de', 'borsen.dk', 'businessinsider.de', 'businessinsider.jp', 'businesslive.co.za', 'businesstimes.com.sg', 'caixin.com', 'caixinglobal.com', 'caravanmagazine.in', 'catalyst-journal.com', 'chegg.com', 'codesports.com.au', 'compactmag.com', 'coursehero.com', 'deutsche-wirtschafts-nachrichten.de', 'die-glocke.de', 'dn.no', 'dn.se', 'elordenmundial.com', 'entrepreneur.com', 'epw.in', 'ewmagazine.nl', 'falter.at', 'finance.si', 'franc-tireur.fr', 'ftchinese.com', 'ftchineselive.com', 'gamestar.de', 'geo.de', 'golem.de', 'gp.se', 'gva.be', 'handelsblatt.com', 'hbrarabic.com', 'hbrchina.org', 'hbrfrance.fr', 'heise.de', 'hs.fi', 'information.dk', 'investors.com', 'iltalehti.fi', 'jacobin.com', 'jeuneafrique.com', 'jungefreiheit.de', 'kleinezeitung.at', 'krone.at', 'laverita.info', 'lavie.fr', 'lavozdegalicia.es', 'law360.co.uk', 'law360.com', 'le1hebdo.fr', 'leconomiste.com', 'lefigaro.fr', 'lefilmfrancais.com', 'lemonde.fr', 'lequipe.fr', 'lesjours.fr', 'letemps.ch', 'liberation.fr', 'libertiesjournal.com', 'lr-online.de', 'main-echo.de', 'mainpost.de', 'manager-magazin.de', 'medianama.com', 'mediapart.fr', 'milanofinanza.it', 'mittelbayerische.de', 'monde-diplomatique.fr', 'mondediplo.com', 'money.it', 'moneycontrol.com', 'moodys.com', 'morningstar.com', 'motorsport.com', 'moz.de', 'nachrichten.at', 'nationaljournal.com', 'nature.com', 'nbr.co.nz', 'newcriterion.com', 'news24.com', 'newslaundry.com', 'nn.de', 'nwzonline.de', 'on3.com', 'ouest-france.fr', 'philonomist.com', 'pnp.de', 'politicopro.com', 'politiken.dk', 'pressreader.com', 'publico.pt', 'puck.news', 'quillette.com', 'rbc.ru', 'republic.ru', 'rheinpfalz.de', 'risk.net', 'rnz.de', 'saechsische.de', 'sciencedirect.com', 'springer.com', 'statnews.com', 'stern.de', 'stimme.de', 'streetinsider.com', 'substack.com', 'svd.se', 'swp.de', 'taxation.co.uk', 'taxjournal.com', 'the-ken.com', 'theinformation.com', 'theinitium.com', 'themorningcontext.com', 'theparisreview.org', 'thestar.com.my', 'thewirechina.com', 'timeslive.co.za', 'weltwoche.ch', 'weltwoche.de', 'wissenschaft.de', 'worldpoliticsreview.com', 'wz.de', 'zaobao.com.sg'].concat(de_funke_medien_nofix_domains, de_rp_aachen_medien_nofix_domains, de_westfalen_medien_nofix_domains, fr_be_groupe_rossel_nofix_domains, fr_groupe_ebra_nofix_domains, fr_indigo_nofix_domains, it_gedi_nofix_domains, nl_mediahuis_region_nofix_domains);
|
||||
|
|
Loading…
Reference in a new issue