From 7bbadfc4791148f05640f481c67044707ed5d441 Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Sat, 30 Oct 2021 10:29:59 +0200 Subject: [PATCH] Fix Barron's (timing) --- changelog.txt | 1 + contentScript.js | 10 ++++----- custom/sites_custom.json | 47 +++++++++++++++++++++------------------ manifest.json | 2 +- options/options_custom.js | 2 +- 5 files changed, 33 insertions(+), 29 deletions(-) diff --git a/changelog.txt b/changelog.txt index b496b21..4d90ee9 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ Changelog Bypass Paywalls Clean - Firefox Post-release +Fix Barron's (timing) Fix Boston Globe (incognito mode) Fix Westfaelische Nachrichten & Westfalen-Blatt diff --git a/contentScript.js b/contentScript.js index 641ff68..54c3376 100644 --- a/contentScript.js +++ b/contentScript.js @@ -1611,14 +1611,14 @@ else if (matchDomain('asiatimes.com')) { } else if (matchDomain('barrons.com')) { - document.addEventListener('DOMContentLoaded', () => { + let url = window.location.href; + if (!url.includes('barrons.com/amp/')) { let body_continuous = document.querySelector('body.is-continuous'); let snippet = document.querySelector('meta[content="snippet"]'); if (body_continuous && snippet) { - window.location.href = window.location.href.replace('barrons.com', 'barrons.com/amp'); + removeDOMElement(snippet); + window.location.href = url.replace('barrons.com', 'barrons.com/amp'); } - }); - if (!window.location.href.includes('barrons.com/amp/')) { let signin_links = document.querySelectorAll('a.primary-button--link[href*="target="]'); for (let signin_link of signin_links) { signin_link.href = decodeURIComponent(signin_link.href.split('target=')[1]).split('?')[0]; @@ -1632,7 +1632,7 @@ else if (matchDomain('barrons.com')) { let subscr_section = document.querySelector('section[subscriptions-section="content"]'); if (subscr_section) subscr_section.removeAttribute('subscriptions-section'); - let wsj_ads = document.querySelectorAll('.wsj-ad'); + let wsj_ads = document.querySelectorAll('.wsj-ad, amp-ad'); removeDOMElement(...wsj_ads); } } diff --git a/custom/sites_custom.json b/custom/sites_custom.json index 0423a8e..f8c37cd 100644 --- a/custom/sites_custom.json +++ b/custom/sites_custom.json @@ -1,39 +1,44 @@ { "Aargauerzeitung.ch": { - "allow_cookies": "1", + "allow_cookies": 1, "domain": "aargauerzeitung.ch", "useragent": "googlebot" }, "Ara.cat": { - "allow_cookies": "1", + "allow_cookies": 1, "domain": "ara.cat", "useragent": "googlebot" }, "Asiasentinel.com": { - "allow_cookies": "1", + "allow_cookies": 1, "domain": "asiasentinel.com", "useragent": "googlebot" }, "Beobachter.ch": { - "allow_cookies": "1", + "allow_cookies": 1, "domain": "beobachter.ch", "useragent": "googlebot" }, "Bnn.de": { - "allow_cookies": "1", + "allow_cookies": 1, "domain": "bnn.de", "useragent": "googlebot" }, "Capital.bg": { - "allow_cookies": "1", + "allow_cookies": 1, "domain": "capital.bg", "useragent": "googlebot" }, + "Christianitytoday.com": { + "allow_cookies": 1, + "domain": "christianitytoday.com", + "useragent": "googlebot" + }, "Connexionfrance.com": { "domain": "connexionfrance.com" }, "Handelszeitung.ch": { - "allow_cookies": "1", + "allow_cookies": 1, "domain": "handelszeitung.ch", "useragent": "googlebot" }, @@ -41,36 +46,37 @@ "domain": "heraldscotland.com" }, "Internationalepolitik.de": { - "allow_cookies": "1", + "allow_cookies": 1, "domain": "internationalepolitik.de" }, "Lindipendente.online": { - "allow_cookies": "1", + "allow_cookies": 1, "domain": "lindipendente.online", "useragent": "googlebot" }, "Lsa-conso.fr": { - "allow_cookies": "1", + "allow_cookies": 1, "domain": "lsa-conso.fr", "useragent": "googlebot" }, "Luzernerzeitung.ch": { - "allow_cookies": "1", + "allow_cookies": 1, "domain": "luzernerzeitung.ch", "useragent": "googlebot" }, "Muensterschezeitung.de": { - "allow_cookies": "1", + "allow_cookies": 1, + "amp_unhide": 1, "domain": "muensterschezeitung.de", "useragent": "googlebot" }, "Pressandjournal.co.uk": { - "allow_cookies": "1", + "allow_cookies": 1, "domain": "pressandjournal.co.uk", "useragent": "googlebot" }, "Pv-digest.de": { - "allow_cookies": "1", + "allow_cookies": 1, "domain": "pv-digest.de", "useragent": "googlebot" }, @@ -78,32 +84,29 @@ "domain": "speld.nl" }, "Supchina.com": { - "allow_cookies": "1", + "allow_cookies": 1, "domain": "supchina.com" }, "Tagblatt.ch": { - "allow_cookies": "1", + "allow_cookies": 1, "domain": "tagblatt.ch", "useragent": "googlebot" }, "The-past.com": { "domain": "the-past.com" }, - "Themonthly.com.au": { - "domain": "themonthly.com.au" - }, "Tijorifinance.com": { - "allow_cookies": "1", + "allow_cookies": 1, "domain": "tijorifinance.com", "useragent": "googlebot" }, "Voguebusiness.com": { - "allow_cookies": "1", + "allow_cookies": 1, "domain": "voguebusiness.com", "useragent": "googlebot" }, "Wz.de": { - "allow_cookies": "1", + "allow_cookies": 1, "domain": "wz.de", "useragent": "googlebot" } diff --git a/manifest.json b/manifest.json index 421e617..48380b4 100644 --- a/manifest.json +++ b/manifest.json @@ -556,5 +556,5 @@ "*://*.wallkit.net/*", "*://*.wsj.net/*" ], - "version": "2.4.1.4" + "version": "2.4.1.5" } \ No newline at end of file diff --git a/options/options_custom.js b/options/options_custom.js index b99c7bc..894aa81 100644 --- a/options/options_custom.js +++ b/options/options_custom.js @@ -109,7 +109,7 @@ function add_options() { } else { if (elem.dataset.value) { if (elem.checked) - sites_custom[title][elem.dataset.key] = elem.dataset.value; + sites_custom[title][elem.dataset.key] = parseInt(elem.dataset.value); } else if (elem.value) sites_custom[title][elem.dataset.key] = elem.value; }