From 79528924c96e14db0dd2b8bd1ce0d70e0867a0fd Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Fri, 4 Mar 2022 16:14:14 +0100 Subject: [PATCH] Fix Inkl --- README.md | 3 ++- background.js | 7 ++++--- changelog.txt | 1 + contentScript.js | 34 +--------------------------------- contentScript_once.js | 43 ++++++++++++++++++++++++++++++++++++++++++- manifest.json | 4 ++-- 6 files changed, 52 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index 89879e8b..9d316fe9 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,8 @@ You can install the add-on from Mozilla add-ons (AMO): [Bypass Paywalls Clean](h Latest add-on versions (2.4.8.0+) require a browser based on Firefox 86+ (else use the non-amo version below).\ Or download and install the latest xpi-version from [GitLab](https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean/-/releases) -If you want to install the latest [master ZIP-file from GitLab](https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean/-/archive/master/bypass-paywalls-firefox-clean-master.zip) use a Firefox browser which allows using unsigned add-ons like Firefox Developer Portable (go to about:config and set xpinstall.signatures.required to false) or LibreWolf (for both no automatic updates of add-on). +If you want to install the latest [master ZIP-file from GitLab](https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean/-/archive/master/bypass-paywalls-firefox-clean-master.zip) use a Firefox browser which allows using unsigned add-ons like Firefox Developer Portable (go to about:config and set xpinstall.signatures.required to false) or LibreWolf (for both no automatic updates of add-on).\ +Or load a temporary add-on in regular Firefox (go to about:debugging#/runtime/this-firefox & load manifest.json from unpacked folder (of master-zip)). By default BPC has limited permissions, but you can opt-in to enable custom sites (and also clear cookies/block general paywall-scripts for non-listed sites). You can also just request permissions for the custom sites you added yourself (or click `clear cookies` (BPC-icon) to ask for permission for current site). diff --git a/background.js b/background.js index e75c2b5b..e481a40e 100644 --- a/background.js +++ b/background.js @@ -7,7 +7,7 @@ var manifestData = ext_api.runtime.getManifest(); var ext_name = manifestData.name; var ext_version = manifestData.version; -const cs_limit_except = ['elespanol.com', 'faz.net', 'inkl.com', 'nation.africa', 'nationalgeographic.com', 'thetimes.co.uk']; +const cs_limit_except = ['elespanol.com', 'faz.net', 'nation.africa', 'nationalgeographic.com', 'thetimes.co.uk']; const dompurify_sites = ['asiatimes.com', 'bloomberg.com', 'cicero.de', 'economictimes.com', 'hs.fi', 'iltalehti.fi', 'lesechos.fr', 'marianne.net', 'newleftreview.org', 'nzherald.co.nz', 'prospectmagazine.co.uk', 'stratfor.com', 'techinasia.com', 'timesofindia.com', 'valor.globo.com', 'vn.nl'].concat(fr_groupe_sud_ouest_domains, nl_mediahuis_region_domains, no_nhst_media_domains, usa_theathletic_domains); var currentTabUrl = ''; var csDone = false; @@ -487,12 +487,14 @@ ext_api.webRequest.onBeforeRequest.addListener(function (details) { ["blocking"] ); -// inkl disable newsletter login +// inkl bypass ext_api.webRequest.onBeforeRequest.addListener(function (details) { if (!isSiteEnabled(details)) { return; } var updatedUrl = details.url.replace(/etok=[\w]*&/, ''); + if (details.url.includes('/signin?') && details.url.includes('redirect_to=')) + updatedUrl = 'https://www.inkl.com' + decodeURIComponent(updatedUrl.split('redirect_to=')[1]); return { redirectUrl: updatedUrl }; }, {urls:["*://*.inkl.com/*"], types:["main_frame"]}, @@ -914,7 +916,6 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) { (matchUrlDomain('elespanol.com', header_referer) && matchUrlDomain('eestatic.com', details.url)) || (matchUrlDomain('elmercurio.com', header_referer) && matchUrlDomain('emol.cl', details.url)) || (matchUrlDomain('epaper.thetimes.co.uk', header_referer) && matchUrlDomain(['prcdn.co'], details.url)) || - (matchUrlDomain('inkl.com', header_referer) && matchUrlDomain('cdn.jsdelivr.net', details.url)) || (matchUrlDomain('law360.com', header_referer) && matchUrlDomain('law360news.com', details.url)) || (matchUrlDomain('marketwatch.com', header_referer) && matchUrlDomain('wsj.net', details.url)) || (matchUrlDomain('nationalgeographic.com', header_referer) && matchUrlDomain('natgeofe.com', details.url)) || diff --git a/changelog.txt b/changelog.txt index ea4eafe9..1c9a9e95 100644 --- a/changelog.txt +++ b/changelog.txt @@ -5,6 +5,7 @@ Post-release Add Causeur.fr Add La Opinion de Malaga Fix Iltalehti.fi (Youtube video/image no source) +Fix Inkl * v2.5.8.0 (2022-02-27) Add Cycling Tips diff --git a/contentScript.js b/contentScript.js index 4b6fca0f..106e12ff 100644 --- a/contentScript.js +++ b/contentScript.js @@ -2695,39 +2695,7 @@ else if (matchDomain('infzm.com')) { } else if (matchDomain('inkl.com')) { - let menu_btn = document.querySelector('div.left-buttons-container button.menu-btn'); - if (!menu_btn) { - let article_container = document.querySelector('div.article-content-container'); - if (article_container) { - article_container.setAttribute('style', 'overflow: visible; max-height: none;'); - let figures = document.querySelectorAll('figure'); - for (let figure of figures) - figure.setAttribute('style', 'display:block !important;'); - } - let gradient_container = document.querySelector('div.gradient-container'); - if (gradient_container) - gradient_container.setAttribute('style', 'height:auto;'); - } - let what_is_inkl = document.querySelector('.what-is-inkl-container'); - let signup = document.querySelector('.article-signup-container'); - removeDOMElement(what_is_inkl, signup); - let dismiss_button = document.querySelector('div.dismiss-button-container button.btn'); - if (dismiss_button) - dismiss_button.click(); - let shared_banner = document.querySelector('div.shared-article-inline-banner'); - removeDOMElement(shared_banner); - let dive_deeper_summary_bodies = document.querySelectorAll('div.dive-deeper-container div.summary-body'); - if (dive_deeper_summary_bodies) { - for (let summary_body of dive_deeper_summary_bodies) { - if (!summary_body.querySelector('a')) { - let ng_click = summary_body.getAttribute('ng-click').replace("showArticle('", '').replace("')", ''); - let weblink = document.createElement('a'); - weblink.text = 'open'; - weblink.href = 'https://www.inkl.com/news/' + ng_click; - summary_body.appendChild(weblink); - } - } - } + // plus code in contentScript_once.js } else if (matchDomain('jpost.com')) { diff --git a/contentScript_once.js b/contentScript_once.js index 13e07e31..0cc1581f 100644 --- a/contentScript_once.js +++ b/contentScript_once.js @@ -1,6 +1,47 @@ //"use strict"; -if (matchDomain('nationalgeographic.com')) { +if (matchDomain('inkl.com')) { + window.setTimeout(function () { + let menu_btn = document.querySelector('div.left-buttons-container button.menu-btn'); + if (!menu_btn) { + let article_container = document.querySelector('div.article-content-container'); + if (article_container) { + article_container.setAttribute('style', 'overflow: visible; max-height: none;'); + let figures = document.querySelectorAll('figure'); + for (let figure of figures) + figure.setAttribute('style', 'display:block !important;'); + } + let gradient_container = document.querySelector('div.gradient-container'); + if (gradient_container) + gradient_container.setAttribute('style', 'height:auto;'); + let locked = document.querySelector('div.locked'); + if (locked) + locked.classList.remove('locked'); + } + let what_is_inkl = document.querySelector('.what-is-inkl-container, .features-panel'); + let signup = document.querySelector('.article-signup-container, .locked-sign-up-container'); + removeDOMElement(what_is_inkl, signup); + let dismiss_button = document.querySelector('div.dismiss-button-container button.btn'); + if (dismiss_button) + dismiss_button.click(); + let shared_banner = document.querySelector('div.shared-article-inline-banner'); + removeDOMElement(shared_banner); + let dive_deeper_summary_bodies = document.querySelectorAll('div.dive-deeper-container div.summary-body'); + if (dive_deeper_summary_bodies) { + for (let summary_body of dive_deeper_summary_bodies) { + if (!summary_body.querySelector('a')) { + let ng_click = summary_body.getAttribute('ng-click').replace("showArticle('", '').replace("')", ''); + let weblink = document.createElement('a'); + weblink.text = 'open'; + weblink.href = 'https://www.inkl.com/news/' + ng_click; + summary_body.appendChild(weblink); + } + } + } + }, 1000); +} + +else if (matchDomain('nationalgeographic.com')) { function natgeo_func(node) { removeDOMElement(node); let body = document.querySelector('body[class]'); diff --git a/manifest.json b/manifest.json index a1d9d5a2..300c2aab 100644 --- a/manifest.json +++ b/manifest.json @@ -39,6 +39,7 @@ ], "content_scripts": [{ "matches": [ + "*://*.inkl.com/*", "*://*.nationalgeographic.com/*", "*://*.nyteknik.se/*" ], @@ -613,7 +614,6 @@ "*://*.gannett-cdn.com/*", "*://*.gitlab.com/magnolia1234/*", "*://*.hearstnp.com/*", - "*://*.jsdelivr.net/*", "*://*.lightboxcdn.com/*", "*://*.loader-cdn.azureedge.net/*", "*://*.mcclatchy-wires.com/*", @@ -629,5 +629,5 @@ "*://*.wallkit.net/*", "*://*.wsj.net/*" ], - "version": "2.5.8.3" + "version": "2.5.8.4" }