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) -
[Harvard Business Review Taiwan](https://www.hbrtaiwan.com) -
[Nikkei Asian Review](https://asia.nikkei.com) -
[NK News](https://www.nknews.org) -
[Tech in Asia](https://www.techinasia.com) -
[The Diplomat](https://www.thediplomat.com) -
[The Japan Times](https://www.japantimes.co.jp)

View file

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

View file

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

View file

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