Remove nknews.org (obsolete)

Plus maintenance: filter empty custom domains.
This commit is contained in:
magnolia1234 2020-02-29 20:08:32 +01:00 committed by GitHub
parent 769959b8ed
commit e8cd4dd62d
4 changed files with 284 additions and 287 deletions

View file

@ -190,7 +190,6 @@
[CommonWealth Magazine Taiwan](https://www.cw.com.tw) - [CommonWealth Magazine Taiwan](https://www.cw.com.tw) -
[Harvard Business Review Taiwan](https://www.hbrtaiwan.com) - [Harvard Business Review Taiwan](https://www.hbrtaiwan.com) -
[Nikkei Asian Review](https://asia.nikkei.com) - [Nikkei Asian Review](https://asia.nikkei.com) -
[NK News](https://www.nknews.org) -
[Tech in Asia](https://www.techinasia.com) - [Tech in Asia](https://www.techinasia.com) -
[The Diplomat](https://www.thediplomat.com) - [The Diplomat](https://www.thediplomat.com) -
[The Japan Times](https://www.japantimes.co.jp) [The Japan Times](https://www.japantimes.co.jp)

View file

@ -41,7 +41,6 @@ var allow_cookies = [
'mexiconewsdaily.com', 'mexiconewsdaily.com',
'modernhealthcare.com', 'modernhealthcare.com',
'nationalreview.com', 'nationalreview.com',
'nknews.org',
'ntnews.com.au', 'ntnews.com.au',
'nytimes.com', 'nytimes.com',
'parool.nl', 'parool.nl',
@ -104,7 +103,6 @@ const use_google_bot_default = [
'heraldsun.com.au', 'heraldsun.com.au',
'lemonde.fr', 'lemonde.fr',
'mexiconewsdaily.com', 'mexiconewsdaily.com',
'nknews.org',
'ntnews.com.au', 'ntnews.com.au',
'prime.economictimes.indiatimes.com', 'prime.economictimes.indiatimes.com',
'quora.com', 'quora.com',
@ -206,12 +204,12 @@ browser.storage.sync.get({
}); });
block_js = block_js_default.slice(); block_js = block_js_default.slice();
enabledSites = Object.keys(items.sites).map(function (key) { enabledSites = Object.keys(sites).filter(function (key) {
return items.sites[key]; return (sites[key] !== '' && sites[key] !== '###');
}); }).map(function (key) {
enabledSites = enabledSites.filter(function (el) { return sites[key];
return (el !== '###');
}); });
for (var domainIndex in enabledSites) { for (var domainIndex in enabledSites) {
var domainVar = enabledSites[domainIndex]; var domainVar = enabledSites[domainIndex];
if (!allow_cookies.includes(domainVar) && !remove_cookies.includes(domainVar)) { if (!allow_cookies.includes(domainVar) && !remove_cookies.includes(domainVar)) {
@ -230,12 +228,13 @@ browser.storage.sync.get({
// Listen for changes to options // Listen for changes to options
browser.storage.onChanged.addListener(function (changes, namespace) { browser.storage.onChanged.addListener(function (changes, namespace) {
for (var key in changes) { for (var key in changes) {
var storageChange = changes[key]; var storageChange = changes[key];
if (key === 'sites') { if (key === 'sites') {
var sites = storageChange.newValue; var sites = storageChange.newValue;
enabledSites = Object.keys(sites).map(function (key) { enabledSites = Object.keys(sites).filter(function (key) {
return (sites[key] !== '' && sites[key] !== '###');
}).map(function (key) {
return sites[key]; return sites[key];
}); });
} }
@ -250,7 +249,7 @@ browser.storage.onChanged.addListener(function (changes, namespace) {
use_google_bot = use_google_bot_default.slice(); use_google_bot = use_google_bot_default.slice();
for (var domainIndex in use_google_bot_custom) { for (var domainIndex in use_google_bot_custom) {
var domainVar = use_google_bot_custom[domainIndex]; var domainVar = use_google_bot_custom[domainIndex];
if (!use_google_bot.includes(domainVar)) { if (domainVar && !use_google_bot.includes(domainVar)) {
use_google_bot.push(domainVar); use_google_bot.push(domainVar);
} }
} }
@ -263,7 +262,7 @@ browser.storage.onChanged.addListener(function (changes, namespace) {
block_js = block_js_default.slice(); block_js = block_js_default.slice();
for (var domainIndex in block_js_custom) { for (var domainIndex in block_js_custom) {
var domainVar = block_js_custom[domainIndex]; var domainVar = block_js_custom[domainIndex];
if (!block_js.includes(domainVar)) { if (domainVar && !block_js.includes(domainVar)) {
block_js.push("*://*." + domainVar + "/*"); // subdomains of site block_js.push("*://*." + domainVar + "/*"); // subdomains of site
block_js.push("*://" + domainVar + "/*"); // site without www.-prefix block_js.push("*://" + domainVar + "/*"); // site without www.-prefix
} }

View file

@ -73,7 +73,7 @@ function renderOptions() {
inputEl.dataset.key = key; inputEl.dataset.key = key;
inputEl.dataset.value = value; inputEl.dataset.value = value;
inputEl.checked = (key in sites) || (key.replace(/\s\(.*\)/, '') in sites); inputEl.checked = (key in sites) || (key.replace(/\s\(.*\)/, '') in sites);
if (value !=='###') { if (value !== '' && value !== '###') {
labelEl.appendChild(inputEl); labelEl.appendChild(inputEl);
} }
labelEl.appendChild(document.createTextNode(' '+key)); labelEl.appendChild(document.createTextNode(' '+key));

View file

@ -84,7 +84,6 @@ var defaultSites =
"New Zealand Herald": "nzherald.co.nz", "New Zealand Herald": "nzherald.co.nz",
"Newcastle Herald": "newcastleherald.com.au", "Newcastle Herald": "newcastleherald.com.au",
"Nikkei Asian Review": "asia.nikkei.com", "Nikkei Asian Review": "asia.nikkei.com",
"NK News": "nknews.org",
"Northern Territory News": "ntnews.com.au", "Northern Territory News": "ntnews.com.au",
"NRC Handelsblad": "nrc.nl", "NRC Handelsblad": "nrc.nl",
"O Estado de S. Paulo": "estadao.com.br", "O Estado de S. Paulo": "estadao.com.br",