more changes

This commit is contained in:
tobimori 2020-03-16 14:59:29 +01:00
parent 2779528560
commit 63954928e1
5 changed files with 31 additions and 19 deletions

View File

@ -26,12 +26,17 @@ const tinypassPaywalls = [
"ikz-online"
]
const isTinypass = (origin) => { if(tinypassPaywalls.includes(origin.split(".",2)[1])) return true;};
const isTinypass = (details) => {
let t;
// check to enable cross plattform (firefox uses originUrl, chrome uses initiator)
details.originUrl ? t = tinypassPaywalls.includes(details.originUrl.split(".",2)[1]) : t = tinypassPaywalls.includes(details.initiator.split(".",2)[1]);
return t;
};
// block all tinypass scripts (used by lensing media & funke)
browser.webRequest.onBeforeRequest.addListener(
chrome.webRequest.onBeforeRequest.addListener(
function(details) {
if (!isTinypass(details.originUrl)) return;
if (!isTinypass(details)) return;
return {cancel: true};
}, {
urls: ["*://*.tinypass.com/*"],

6
lib.js
View File

@ -8,6 +8,12 @@
// github.com/tobimori/unpaywall
//
// browser detection by some random guy on stackoverflow
// Firefox
const isFirefox = typeof InstallTrigger !== 'undefined';
// Chrome
const isChrome = !!window.chrome && (!!window.chrome.webstore || !!window.chrome.runtime);
// orginally written by Lukas Fruntke
// https://github.com/tobimori/unpaywall-funke/unpaywall-funke.user.js
const removeElements = (...arrays) => {

View File

@ -58,7 +58,7 @@
"*://*.ostsee-zeitung.de/*",
"*://*.paz-online.de/*",
"*://*.sn-online.de/*"],
"js": ["lib.js", "settingslib.js", "components/madsack.js"],
"js": ["lib.js", "components/madsack.js"],
"run_at": "document_end"
}, {
"matches": [
@ -66,13 +66,13 @@
"*://*.rundschau-online.de/*",
"*://*.mz-web.de/*"
],
"js": ["lib.js", "settingslib.js", "components/dumont.js"],
"js": ["lib.js", "components/dumont.js"],
"run_at": "document_idle"
}, {
"matches": [
"*://*.saarbruecker-zeitung.de/*"
],
"js": ["lib.js", "settingslib.js", "components/saarbruecker-zeitung.js"],
"js": ["lib.js", "components/saarbruecker-zeitung.js"],
"run_at": "document_idle"
}, {
"matches": [
@ -92,13 +92,13 @@
"*://*.usinger-anzeiger.de/*",
"*://*.wormser-zeitung.de/*"
],
"js": ["lib.js", "settingslib.js", "components/laterpay-vrm.js"],
"js": ["lib.js", "components/laterpay-vrm.js"],
"run_at": "document_start"
}, {
"matches": [
"*://*.nahverkehrhamburg.de/*"
],
"js": ["lib.js", "settingslib.js", "components/nahverkehrhamburg.js"],
"js": ["lib.js", "components/nahverkehrhamburg.js"],
"run_at": "document_idle"
}, {
"matches": [
@ -108,7 +108,7 @@
"*://*.muensterlandzeitung.de/*",
"*://*.halternerzeitung.de/*"
],
"js": ["lib.js", "settingslib.js", "components/lensingmedia.js"],
"js": ["lib.js", "components/lensingmedia.js"],
"run_at": "document_end"
}
]

10
settings.js Normal file
View File

@ -0,0 +1,10 @@
// ____
// __ _____ ___ ___ ___ ___ _____ _/ / /
// / // / _ \/ _ \/ _ `/ // / |/|/ / _ `/ / /
// \_,_/_//_/ .__/\_,_/\_, /|__,__/\_,_/_/_/
// /_/ /___/
//
// settings content script
// github.com/tobimori/unpaywall
//

View File

@ -7,12 +7,3 @@
// settings library
// github.com/tobimori/unpaywall
//
browser.browserAction.onClicked.addListener((tab) => {
browser.cookies.set({
url: tab.url,
name: "unpaywallDisabled",
value: "true"
});
}
);