forked from tilwegener/unpaywall
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackground.js
42 lines (38 loc) · 1.03 KB
/
background.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// ____
// __ _____ ___ ___ ___ ___ _____ _/ / /
// / // / _ \/ _ \/ _ `/ // / |/|/ / _ `/ / /
// \_,_/_//_/ .__/\_,_/\_, /|__,__/\_,_/_/_/
// /_/ /___/
//
// background listener
// blocks scripts before loading
// github.com/tobimori/unpaywall
//
const tinypassPaywalls = [
"ruhrnachrichten",
"hellwegeranzeiger",
"dorstenerzeitung",
"muensterlandzeitung",
"halternerzeitung",
"thueringer-allgemeine",
"abendblatt",
"waz",
"nrz",
"wr",
"wp",
"otz",
"morgenpost",
"ikz-online"
]
const isTinypass = (origin) => { if(tinypassPaywalls.includes(origin.split(".",2)[1])) return true;};
// block all tinypass scripts (used by lensing media & funke)
browser.webRequest.onBeforeRequest.addListener(
function(details) {
if (!isTinypass(details.originUrl)) return;
return {cancel: true};
}, {
urls: ["*://*.tinypass.com/*"],
types: ["script"]
},
["blocking"]
);