From e2deb274bed2c06ed238dcc28358a5b76d3733be Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Fri, 24 Jun 2022 20:57:20 +0200 Subject: [PATCH] Fix Nautilus --- background.js | 3 ++- changelog.txt | 1 + contentScript.js | 17 +++++++++++++++++ contentScript_once.js | 9 +++++++++ custom/manifest.json | 1 + manifest.json | 1 + sites.js | 3 ++- 7 files changed, 33 insertions(+), 2 deletions(-) diff --git a/background.js b/background.js index 85b1e0e..44fafe9 100755 --- a/background.js +++ b/background.js @@ -617,11 +617,12 @@ ext_api.webRequest.onHeadersReceived.addListener(function (details) { ['blocking', 'responseHeaders']); // block inline script -var block_js_inline = ["*://*.elpais.com/*", "*://*.theglobeandmail.com/*"]; +var block_js_inline = ["*://*.elpais.com/*", "*://*.nautil.us/*", "*://*.theglobeandmail.com/*"]; if (block_js_inline.length) ext_api.webRequest.onHeadersReceived.addListener(function (details) { let url_path = details.url.split('?')[0]; let excluded = (matchUrlDomain('elpais.com', details.url) && (url_path.includes('/elpais.com') || !url_path.includes('.html'))) + || (matchUrlDomain('nautil.us', details.url) && !details.url.match(/((\w)+(\-)+){3,}/)) || (matchUrlDomain('theglobeandmail.com', details.url) && (!enabledSites.includes('#options_optin_tgam_premium') || !details.url.includes('?rel=premium'))); if (!isSiteEnabled(details) || excluded) return; diff --git a/changelog.txt b/changelog.txt index 681677b..00ec0b0 100644 --- a/changelog.txt +++ b/changelog.txt @@ -7,6 +7,7 @@ Fix Business Standard Fix Helsingin Sanomat (dynamic-json) Fix Koelner Stadt-Anzeiger & Koelnische Rundschau Fix LesEchos.fr +Fix Nautilus Fix Repubblica.it & LaStampa.it (videos-gtm) * v2.7.2.0 (2022-06-06) diff --git a/contentScript.js b/contentScript.js index 1f6336a..e4ee47c 100755 --- a/contentScript.js +++ b/contentScript.js @@ -3190,6 +3190,23 @@ else if (matchDomain('nationalreview.com')) { removeDOMElement(...adverts); } +else if (matchDomain('nautil.us')) { + // plus code in contentScript_once.js + let hidden_images = document.querySelectorAll('img[src^="data:image"][data-src]'); + for (let hidden_image of hidden_images) + hidden_image.src = hidden_image.getAttribute('data-src'); + let empty_video_iframes = document.querySelectorAll('iframe[src="about:blank"][data-litespeed-src]'); + for (let empty_video_iframe of empty_video_iframes) + empty_video_iframe.src = empty_video_iframe.getAttribute('data-litespeed-src'); + window.setTimeout(function () { + let banners = document.querySelectorAll('div[class^="a__sc-np"], div.subscibe-bar'); + removeDOMElement(...banners); + let overflows = document.querySelectorAll('html[style], body[style]'); + for (let overflow of overflows) + overflow.removeAttribute('style'); + }, 1000); +} + else if (matchDomain('newleftreview.org')) { window.setTimeout(function () { let url = window.location.href; diff --git a/contentScript_once.js b/contentScript_once.js index 9c2e3f4..f7c6243 100644 --- a/contentScript_once.js +++ b/contentScript_once.js @@ -53,6 +53,15 @@ else if (matchDomain('nationalgeographic.com')) { waitDOMElement('div[id^="fittPortal"]', 'DIV', natgeo_func, false); } +else if (matchDomain('nautil.us')) { + let hidden_images = document.querySelectorAll('img[src^="data:image"][data-src]'); + for (let hidden_image of hidden_images) + hidden_image.src = hidden_image.getAttribute('data-src'); + let empty_video_iframes = document.querySelectorAll('iframe[src="about:blank"][data-litespeed-src]'); + for (let empty_video_iframe of empty_video_iframes) + empty_video_iframe.src = empty_video_iframe.getAttribute('data-litespeed-src'); +} + else if (matchDomain('nyteknik.se')) { window.setTimeout(function () { let hidden_images = document.querySelectorAll('img[src=""][data-proxy-image]'); diff --git a/custom/manifest.json b/custom/manifest.json index 21d2b48..4b52445 100644 --- a/custom/manifest.json +++ b/custom/manifest.json @@ -26,6 +26,7 @@ "matches": [ "*://*.inkl.com/*", "*://*.nationalgeographic.com/*", + "*://*.nautil.us/*", "*://*.nyteknik.se/*", "*://*.nzherald.co.nz/*", "*://*.gitlab.com/magnolia1234" diff --git a/manifest.json b/manifest.json index f9cca20..2e8dd93 100755 --- a/manifest.json +++ b/manifest.json @@ -29,6 +29,7 @@ "matches": [ "*://*.inkl.com/*", "*://*.nationalgeographic.com/*", + "*://*.nautil.us/*", "*://*.nyteknik.se/*", "*://*.nzherald.co.nz/*", "*://*.gitlab.com/magnolia1234" diff --git a/sites.js b/sites.js index e74c4d6..a43454e 100755 --- a/sites.js +++ b/sites.js @@ -1228,7 +1228,8 @@ var defaultSites = { useragent: "googlebot" }, "Nautilus": { - domain: "nautil.us" + domain: "nautil.us", + allow_cookies: 1 }, "Neue Osnabrücker Zeitung": { domain: "noz.de",