From 679e3c594de5b043113f89e0b34303320930bb08 Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Fri, 4 Dec 2020 16:56:36 +0100 Subject: [PATCH] Fix-update Discover Magazine --- background.js | 11 +---------- changelog.txt | 1 + contentScript.js | 9 +++++++-- manifest.json | 2 +- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/background.js b/background.js index f282997..8099e50 100755 --- a/background.js +++ b/background.js @@ -678,16 +678,7 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) { } }); } - - // remove cookies Discover Magazine - if (matchUrlDomain('ctfassets.net', details.url) && matchUrlDomain('discovermagazine.com', header_referer) && isSiteEnabled({url: 'https://www.discovermagazine.com'})) { - ext_api.cookies.getAll({domain: 'discovermagazine.com'}, function(cookies) { - for (let cookie of cookies) { - ext_api.cookies.remove({url: (cookie.secure ? "https://" : "http://") + cookie.domain + cookie.path, name: cookie.name}); - } - }); - } - + // block external javascript for custom sites (optional) var domain_blockjs_ext = matchUrlDomain(block_js_custom_ext, header_referer); if (domain_blockjs_ext && !matchUrlDomain(domain_blockjs_ext, details.url) && details.url.match(/(\.js$|\.js\?|\/json\?)/) && isSiteEnabled({url: header_referer})) { diff --git a/changelog.txt b/changelog.txt index 7ef12c8..e57976a 100644 --- a/changelog.txt +++ b/changelog.txt @@ -7,6 +7,7 @@ Add Esprit (France) Add The Spectator USA Remove Aftonbladet.se (obsolete) Fix-update CharlieHebdo.fr (captcha) +Fix-update Discover Magazine Fix-update El Mercurio & La Segunda (mobile) Fix-update Harper's Magazine Fix-update Mexico News Daily diff --git a/contentScript.js b/contentScript.js index 69b27c3..8a3c793 100755 --- a/contentScript.js +++ b/contentScript.js @@ -1296,8 +1296,13 @@ else if (matchDomain(["mercuriovalpo.cl", "estrellavalpo.cl"])) { } else if (matchDomain("discovermagazine.com")) { - let banner = document.querySelector('div.hWOjDZ, div.qa7yll-1'); - removeDOMElement(banner); + window.setTimeout(function () { + let mammoth = document.querySelector('.iXVGnF'); + if (mammoth) + window.location.reload(); + let banner = document.querySelector('div.hWOjDZ, div.qa7yll-1'); + removeDOMElement(banner); + }, 1000); // Delay (in milliseconds) } else if (domain = matchDomain(["fresnobee.com", "sacbee.com"])) { diff --git a/manifest.json b/manifest.json index 895b333..166a4cf 100644 --- a/manifest.json +++ b/manifest.json @@ -89,6 +89,7 @@ "*://*.diariosur.es/*", "*://*.diariovasco.com/*", "*://*.digiday.com/*", + "*://*.discovermagazine.com/*", "*://*.dn.se/*", "*://*.dvhn.nl/*", "*://*.economist.com/*", @@ -342,7 +343,6 @@ "*://*.bwbx.io/*", "*://*.cedsdigital.it/*", "*://*.corriereobjects.it/*", - "*://*.ctfassets.net/*", "*://*.cxense.com/*", "*://*.emol.cl/*", "*://*.epimg.net/*",