Update options (excluded sites)
This commit is contained in:
parent
f7138e3c72
commit
f5911a88c0
@ -5,6 +5,7 @@
|
||||
* [Sites with limited number of free articles](#sites-with-limited-number-of-free-articles)
|
||||
* [New site requests](#new-site-requests)
|
||||
* [Add custom site](#add-custom-site)
|
||||
* [Add excluded site](#add-excluded-site)
|
||||
* [Troubleshooting](#troubleshooting)
|
||||
* [Changelog-releases](#changelog-releases)
|
||||
* [License](#license)
|
||||
@ -511,6 +512,10 @@ Make sure the (new) site is checked under Options (or check on/off-button).
|
||||
By default sites' cookies/local storage are removed after page loads (to bypass article limit).
|
||||
Also you can enable Googlebot user-agent or disable Javascript for (sub)domain(s)/external sources.
|
||||
|
||||
### Add excluded site
|
||||
Add excluded sites/domains (for your subscriptions).\
|
||||
You can also exclude a specific domain which is grouped in options.
|
||||
|
||||
### Troubleshooting
|
||||
* This extension works best alongside [uBlock Origin](https://chrome.google.com/webstore/detail/ublock-origin/cjpalhdlnbpafiamejdnhcphjbkeiagm).
|
||||
* If a site doesn't work, try turning off uBlock and refreshing.
|
||||
|
@ -132,7 +132,6 @@ const remove_cookies_select_hold = {
|
||||
|
||||
// select only specific cookie(s) to drop from remove_cookies domains
|
||||
var remove_cookies_select_drop = {
|
||||
'ad.nl': ['temptationTrackingId'],
|
||||
'caixinglobal.com': ['CAIXINGLB_LOGIN_UUID'],
|
||||
'dn.se': ['randomSplusId'],
|
||||
'fd.nl': ['socialread'],
|
||||
@ -227,7 +226,6 @@ var blockedRegexes = {
|
||||
'haaretz.com': /haaretz\.com\/hdc\/web\/js\/minified\/header-scripts-int.js.+/,
|
||||
'hbr.org': /cdn\.tinypass\.com\/.+/,
|
||||
'historyextra.com': /.+\.evolok\.net\/.+\/authorize\/.+/,
|
||||
'ilmessaggero.it': /utils\.cedsdigital\.it\/js\/PaywallMeter\.js/,
|
||||
'ilrestodelcarlino.it': /cdn\.tinypass\.com\/.+/,
|
||||
'independent.ie': /(cdn\.flip-pay\.com\/clients\/inm\/flip-pay\.js|cdn\.ampproject\.org\/v\d\/amp-(access|ad|consent)-.+\.js)/,
|
||||
'inquirer.com': /cdn\.tinypass\.com\/.+/,
|
||||
@ -298,9 +296,9 @@ const fi_alma_talent_domains = ['arvopaperi.fi', 'kauppalehti.fi', 'marmai.fi',
|
||||
const fr_be_groupe_rossel_domains = ['aisnenouvelle.fr', 'courrier-picard.fr', 'lardennais.fr', 'lavoixdunord.fr', 'lecho.be', 'lesoir.be', 'lest-eclair.fr', 'liberation-champagne.fr', 'lunion.fr', 'nordeclair.fr', 'paris-normandie.fr', 'sudinfo.be'];
|
||||
const fr_groupe_ebra_domains = ['bienpublic.com', 'dna.fr', 'estrepublicain.fr', 'lalsace.fr', 'ledauphine.com', 'lejsl.com', 'leprogres.fr', 'republicain-lorrain.fr', 'vosgesmatin.fr'];
|
||||
const fr_groupe_la_depeche_domains = ['centrepresseaveyron.fr', 'ladepeche.fr', 'lindependant.fr', 'midi-olympique.fr', 'midilibre.fr', 'nrpyrenees.fr', 'petitbleu.fr'];
|
||||
const it_ilmessaggero_domains = ['corriereadriatico.it', 'ilgazzettino.it', 'ilmattino.it', 'quotidianodipuglia.it'];
|
||||
const nl_ad_region_domains = ['bd.nl', 'ed.nl', 'tubantia.nl', 'bndestem.nl', 'pzc.nl', 'destentor.nl', 'gelderlander.nl'];
|
||||
const nymag_domains = ['grubstreet.com', 'thecut.com', 'vulture.com'];
|
||||
const it_ilmessaggero_domains = ['corriereadriatico.it', 'ilgazzettino.it', 'ilmattino.it', 'ilmessaggero.it', 'quotidianodipuglia.it'];
|
||||
const nl_ad_region_domains = ['ad.nl', 'bd.nl', 'ed.nl', 'tubantia.nl', 'bndestem.nl', 'pzc.nl', 'destentor.nl', 'gelderlander.nl'];
|
||||
const usa_nymag_domains = ['grubstreet.com', 'nymag.com', 'thecut.com', 'vulture.com'];
|
||||
|
||||
// grouped domains (rules only)
|
||||
const au_nine_domains = ['brisbanetimes.com.au', 'smh.com.au', 'theage.com.au', 'watoday.com.au'];
|
||||
@ -315,9 +313,10 @@ const userAgentMobileB = "Chrome/80.0.3987.92 Mobile Safari/537.36 (compatible;
|
||||
var enabledSites = [];
|
||||
var disabledSites = [];
|
||||
var defaultSites_grouped_domains = Object.values(defaultSites);
|
||||
var defaultSites_domains = defaultSites_grouped_domains.concat(au_comm_media_domains, au_news_corp_domains, au_prov_news_domains, de_funke_media_domains, de_madsack_domains, es_grupo_vocento_domains, fi_alma_talent_domains, fr_be_groupe_rossel_domains, fr_groupe_ebra_domains, fr_groupe_la_depeche_domains, it_ilmessaggero_domains, nl_ad_region_domains, nymag_domains);
|
||||
var defaultSites_domains = defaultSites_grouped_domains.concat(au_comm_media_domains, au_news_corp_domains, au_prov_news_domains, de_funke_media_domains, de_madsack_domains, es_grupo_vocento_domains, fi_alma_talent_domains, fr_be_groupe_rossel_domains, fr_groupe_ebra_domains, fr_groupe_la_depeche_domains, it_ilmessaggero_domains, nl_ad_region_domains, usa_nymag_domains);
|
||||
var customSites = {};
|
||||
var customSites_domains = [];
|
||||
var excludedSites = [];
|
||||
|
||||
function setDefaultOptions() {
|
||||
ext_api.storage.local.set({
|
||||
@ -361,9 +360,9 @@ var grouped_sites = {
|
||||
'###_fr_be_groupe_rossel': fr_be_groupe_rossel_domains,
|
||||
'###_fr_groupe_ebra': fr_groupe_ebra_domains,
|
||||
'###_fr_groupe_la_depeche': fr_groupe_la_depeche_domains,
|
||||
'ad.nl': nl_ad_region_domains,
|
||||
'ilmessaggero.it': it_ilmessaggero_domains,
|
||||
'nymag.com': nymag_domains
|
||||
'###_it_ilmessaggero': it_ilmessaggero_domains,
|
||||
'###_nl_ad_region': nl_ad_region_domains,
|
||||
'###_usa_nymag': usa_nymag_domains
|
||||
};
|
||||
|
||||
function add_grouped__enabled_domains(groups) {
|
||||
@ -372,6 +371,12 @@ function add_grouped__enabled_domains(groups) {
|
||||
enabledSites = enabledSites.concat(groups[key]);
|
||||
else
|
||||
disabledSites = disabledSites.concat(groups[key]);
|
||||
for (let site of excludedSites) {
|
||||
if (enabledSites.includes(site)) {
|
||||
enabledSites.splice(enabledSites.indexOf(site), 1);
|
||||
disabledSites.push(site);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -433,10 +438,12 @@ function add_grouped_sites(init_rules) {
|
||||
// Add googlebot- and block_javascript-settings for custom sites
|
||||
ext_api.storage.local.get({
|
||||
sites: {},
|
||||
sites_custom: {}
|
||||
sites_custom: {},
|
||||
sites_excluded: []
|
||||
}, function (items) {
|
||||
var sites = items.sites;
|
||||
var sites_custom = items.sites_custom;
|
||||
excludedSites = items.sites_excluded;
|
||||
|
||||
for (let key in sites_custom) {
|
||||
var domainVar = sites_custom[key]['domain'].toLowerCase();
|
||||
@ -458,7 +465,7 @@ ext_api.storage.local.get({
|
||||
customSites = sites_custom;
|
||||
customSites_domains = Object.values(sites_custom).map(x => x.domain);
|
||||
disabledSites = defaultSites_domains.concat(customSites_domains).filter(x => !enabledSites.includes(x) && x !== '###');
|
||||
add_grouped_sites(true);
|
||||
add_grouped_sites(true); //and exclude sites
|
||||
|
||||
for (let domainVar of enabledSites) {
|
||||
if (!allow_cookies.includes(domainVar) && !remove_cookies.includes(domainVar)) {
|
||||
@ -491,9 +498,6 @@ ext_api.storage.onChanged.addListener(function (changes, namespace) {
|
||||
remove_cookies.push(domainVar);
|
||||
}
|
||||
}
|
||||
// reset disableJavascriptOnListedSites eventListener
|
||||
ext_api.webRequest.onBeforeRequest.removeListener(disableJavascriptOnListedSites);
|
||||
ext_api.webRequest.handlerBehaviorChanged();
|
||||
}
|
||||
if (key === 'sites_custom') {
|
||||
var sites_custom = storageChange.newValue ? storageChange.newValue : {};
|
||||
@ -555,11 +559,33 @@ ext_api.storage.onChanged.addListener(function (changes, namespace) {
|
||||
block_js_custom_ext.push(domainVar);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (key === 'sites_excluded') {
|
||||
var sites_excluded = storageChange.newValue ? storageChange.newValue : [];
|
||||
var sites_excluded_old = storageChange.oldValue ? storageChange.oldValue : [];
|
||||
excludedSites = sites_excluded;
|
||||
|
||||
// add/remove excluded sites in en/disabledSites
|
||||
var sites_excluded_added = sites_excluded.filter(x => !sites_excluded_old.includes(x));
|
||||
var sites_excluded_removed = sites_excluded_old.filter(x => !sites_excluded.includes(x));
|
||||
|
||||
for (let site of sites_excluded_added) {
|
||||
if (enabledSites.includes(site)) {
|
||||
enabledSites.splice(enabledSites.indexOf(site), 1);
|
||||
disabledSites.push(site);
|
||||
}
|
||||
}
|
||||
for (let site of sites_excluded_removed) {
|
||||
if (disabledSites.includes(site)) {
|
||||
disabledSites.splice(disabledSites.indexOf(site), 1);
|
||||
enabledSites.push(site);
|
||||
}
|
||||
}
|
||||
}
|
||||
// reset disableJavascriptOnListedSites eventListener
|
||||
ext_api.webRequest.onBeforeRequest.removeListener(disableJavascriptOnListedSites);
|
||||
ext_api.webRequest.handlerBehaviorChanged();
|
||||
}
|
||||
|
||||
// Refresh the current tab
|
||||
ext_api.tabs.query({
|
||||
active: true,
|
||||
@ -973,10 +999,14 @@ function popup_show_toggle_tab(callback) {
|
||||
}, function (tabs) {
|
||||
if (tabs.length > 0 && tabs[0].url && tabs[0].url.indexOf("http") !== -1) {
|
||||
let currentUrl = tabs[0].url;
|
||||
let domain;
|
||||
let isExcludedSite = matchUrlDomain(excludedSites, currentUrl);
|
||||
if (!isExcludedSite) {
|
||||
let isDefaultSiteGrouped = matchUrlDomain(defaultSites_domains, currentUrl);
|
||||
let isDefaultSite = matchUrlDomain(defaultSites_domains, currentUrl);
|
||||
let isCustomSite = matchUrlDomain(Object.values(customSites_domains), currentUrl);
|
||||
let domain = isDefaultSiteGrouped || (!isDefaultSite && isCustomSite);
|
||||
domain = isDefaultSiteGrouped || (!isDefaultSite && isCustomSite);
|
||||
}
|
||||
callback(domain);
|
||||
}
|
||||
});
|
||||
|
@ -2,6 +2,7 @@
|
||||
Changelog Bypass Paywalls Clean - Chrome
|
||||
|
||||
Post-release
|
||||
Update options (excluded sites)
|
||||
|
||||
* v2.0.2.0 (2021-01-03)
|
||||
Add La Vanguardia (Spain)
|
||||
|
@ -402,5 +402,5 @@
|
||||
"*://*.repstatic.it/*",
|
||||
"*://*.userzoom.com/*"
|
||||
],
|
||||
"version": "2.0.2.0"
|
||||
"version": "2.0.2.1"
|
||||
}
|
@ -28,6 +28,7 @@
|
||||
<div style='float:left'>
|
||||
<small><button><a href="options_custom.html" style="text-decoration:none;color:inherit">Custom sites</a></button></small>
|
||||
<small><button><a href="optin/opt-in.html" style="text-decoration:none;color:inherit">Opt-in</a></button></small>
|
||||
<small><button><a href="options_excluded.html" style="text-decoration:none;color:inherit">Excluded sites</a></button></small>
|
||||
<small><button><a href="#save" style="text-decoration:none;color:inherit">Go to save</a></button></small>
|
||||
</div>
|
||||
<div style="clear:both;"></div>
|
||||
@ -41,6 +42,7 @@
|
||||
<button id="select-all">Select all</button>
|
||||
<button id="select-none">Select none</button>
|
||||
<button><a href="options_custom.html" style="text-decoration:none;color:inherit">Custom sites</a></button>
|
||||
<button><a href="options_excluded.html" style="text-decoration:none;color:inherit">Excluded sites</a></button>
|
||||
<button id="button-close">Close</button>
|
||||
</span>
|
||||
<script src="sites.js"></script>
|
||||
|
28
options.js
28
options.js
@ -21,6 +21,9 @@ function save_options() {
|
||||
// Update status to let user know options were saved.
|
||||
var status = document.getElementById('status');
|
||||
status.textContent = 'Options saved.';
|
||||
setTimeout(function () {
|
||||
status.textContent = '';
|
||||
}, 800);
|
||||
});
|
||||
}
|
||||
|
||||
@ -28,16 +31,16 @@ function save_options() {
|
||||
function renderOptions() {
|
||||
var labelEl;
|
||||
ext_api.storage.local.get({
|
||||
sites: {}, sites_custom: {}
|
||||
sites: {}, sites_custom: {}, sites_excluded: []
|
||||
}, function(items) {
|
||||
var sites = items.sites;
|
||||
var sites_excluded = items.sites_excluded;
|
||||
var sitesEl = document.getElementById('bypass_sites');
|
||||
var clean_key;
|
||||
for (var key in defaultSites) {
|
||||
if (!defaultSites.hasOwnProperty(key)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var value = defaultSites[key];
|
||||
labelEl = document.createElement('label');
|
||||
var inputEl = document.createElement('input');
|
||||
@ -45,7 +48,7 @@ function renderOptions() {
|
||||
inputEl.dataset.key = key;
|
||||
inputEl.dataset.value = value;
|
||||
clean_key = key.replace(/\s\(.*\)/, '');
|
||||
inputEl.checked = Object.keys(sites).some(title => (title.replace(/\s\(.*\)/, '') === clean_key));
|
||||
inputEl.checked = Object.keys(sites).some(title => (title.replace(/\s\(.*\)/, '') === clean_key)) && !sites_excluded.includes(value);
|
||||
if (value !== '###') {
|
||||
labelEl.appendChild(inputEl);
|
||||
} else {
|
||||
@ -68,20 +71,29 @@ function renderOptions() {
|
||||
if (defaultSites.hasOwnProperty(key) || defaultSites_domains.includes(domain)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
labelEl = document.createElement('label');
|
||||
var inputEl = document.createElement('input');
|
||||
inputEl.type = 'checkbox';
|
||||
inputEl.dataset.key = key;
|
||||
inputEl.dataset.value = domain;
|
||||
clean_key = key.replace(/\s\(.*\)/, '');
|
||||
inputEl.checked = Object.keys(sites).some(title => (title.replace(/\s\(.*\)/, '') === clean_key));
|
||||
inputEl.checked = Object.keys(sites).some(title => (title.replace(/\s\(.*\)/, '') === clean_key)) && !sites_excluded.includes(domain);
|
||||
if (value !== '' && value !== '###') {
|
||||
labelEl.appendChild(inputEl);
|
||||
}
|
||||
labelEl.appendChild(document.createTextNode(' '+key));
|
||||
sitesEl.appendChild(labelEl);
|
||||
}
|
||||
// excluded
|
||||
labelEl.appendChild(document.createElement('hr'));
|
||||
labelEl = document.createElement('label');
|
||||
labelEl.setAttribute('style', ' font-weight: bold;');
|
||||
labelEl.appendChild(document.createTextNode('* Excluded Sites (ignored when checked in list)'));
|
||||
sitesEl.appendChild(labelEl);
|
||||
labelEl = document.createElement('label');
|
||||
labelEl.appendChild(document.createTextNode(sites_excluded.join()));
|
||||
sitesEl.appendChild(labelEl);
|
||||
save_options();
|
||||
});
|
||||
}
|
||||
|
||||
@ -90,6 +102,12 @@ function selectAll() {
|
||||
inputEls.forEach(function (inputEl) {
|
||||
inputEl.checked = true;
|
||||
});
|
||||
// Update status to let user know all sites are selected.
|
||||
var status = document.getElementById('status');
|
||||
status.textContent = 'All sites selected.';
|
||||
setTimeout(function () {
|
||||
status.textContent = '';
|
||||
}, 800);
|
||||
}
|
||||
|
||||
function selectNone() {
|
||||
|
43
options_excluded.html
Normal file
43
options_excluded.html
Normal file
@ -0,0 +1,43 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Bypass Paywalls Clean Options Excluded</title>
|
||||
<style>
|
||||
#excluded_sites label {
|
||||
display: block;
|
||||
}
|
||||
body {
|
||||
font-size: 100%;
|
||||
}
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Excluded Sites</h2>
|
||||
<div style="width:90%;">
|
||||
Add excluded sites/domains (for your subscriptions) as a comma-separated list (www.-prefix and spaces are removed).<br>
|
||||
You can also exclude a specific domain which is grouped in options.<br>
|
||||
Checked sites in options are ignored (to still enable select all).<br>
|
||||
</div>
|
||||
<div style="clear:both;"></div>
|
||||
<div style="width:90%;">
|
||||
<h3>Sites</h3>
|
||||
</div>
|
||||
<br>
|
||||
<div id='excluded_sites'></div>
|
||||
<br>
|
||||
<div id="status"></div>
|
||||
<div id="error"></div>
|
||||
<span style='float:left;padding-bottom:50px'>
|
||||
<button id="save">Save</button>
|
||||
<button id="sort">Sort</button>
|
||||
<button><a href="options.html" style="text-decoration:none;color:inherit">Options</a></button>
|
||||
</span>
|
||||
|
||||
<script src="options_excluded.js"></script>
|
||||
</body>
|
||||
</html>
|
52
options_excluded.js
Normal file
52
options_excluded.js
Normal file
@ -0,0 +1,52 @@
|
||||
var ext_api = chrome || browser;
|
||||
|
||||
// Saves options to ext_api.storage
|
||||
function save_options() {
|
||||
var textareaEl = document.querySelector('#excluded_sites textarea');
|
||||
var sites_excluded = [];
|
||||
if (textareaEl.value !== '')
|
||||
var sites_excluded = textareaEl.value.split(',').map(function(item) { return item.trim().replace('www.', ''); });
|
||||
ext_api.storage.local.set({
|
||||
sites_excluded: sites_excluded
|
||||
}, function () {
|
||||
// Update status to let user know excluded sites were saved.
|
||||
var status = document.getElementById('status');
|
||||
status.textContent = 'Excluded sites saved.';
|
||||
});
|
||||
}
|
||||
|
||||
// Sort json by key in textarea
|
||||
function sort_options() {
|
||||
var textareaEl = document.querySelector('#excluded_sites textarea');
|
||||
var sites_excluded = [];
|
||||
if (textareaEl.value !== '') {
|
||||
var sites_excluded = textareaEl.value.split(',').map(function(item) { return item.trim().replace('www.', ''); });
|
||||
var sites_excluded_sorted = sites_excluded.sort();
|
||||
textareaEl.value = sites_excluded_sorted.join();
|
||||
}
|
||||
// Update status to let user know excluded sites were sorted.
|
||||
var status = document.getElementById('status');
|
||||
status.textContent = 'Excluded sites sorted (not saved yet)';
|
||||
}
|
||||
|
||||
function renderOptions() {
|
||||
ext_api.storage.local.get({
|
||||
sites_excluded: []
|
||||
}, function (items) {
|
||||
var sites_excluded = items.sites_excluded;
|
||||
var sitesEl = document.getElementById('excluded_sites');
|
||||
sitesEl.innerHTML = '';
|
||||
var labelEl = document.createElement('label');
|
||||
var textareaEl = document.createElement('textarea');
|
||||
textareaEl.placeholder = 'example1.com,example2.com';
|
||||
textareaEl.value = sites_excluded.join();
|
||||
textareaEl.rows = 12;
|
||||
textareaEl.cols = 40;
|
||||
labelEl.appendChild(textareaEl);
|
||||
sitesEl.appendChild(labelEl);
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', renderOptions);
|
||||
document.getElementById('save').addEventListener('click', save_options);
|
||||
document.getElementById('sort').addEventListener('click', sort_options);
|
6
sites.js
6
sites.js
@ -2,7 +2,7 @@ var defaultSites =
|
||||
{
|
||||
"ABC.es": "abc.es",
|
||||
"Adweek": "adweek.com",
|
||||
"Algemeen Dagblad (+ regional)": "ad.nl",
|
||||
"Algemeen Dagblad (+ regional)": "###_nl_ad_region",
|
||||
"Alma Talent (Finland)": "###_fi_alma_talent",
|
||||
"Alternatives Economiques": "alternatives-economiques.fr",
|
||||
"American Affairs": "americanaffairsjournal.org",
|
||||
@ -90,7 +90,7 @@ var defaultSites =
|
||||
"Humo.be": "humo.be",
|
||||
"Il Fatto Quotidiano": "ilfattoquotidiano.it",
|
||||
"Il Manifesto": "ilmanifesto.it",
|
||||
"Il Messaggero (+ regional)": "ilmessaggero.it",
|
||||
"Il Messaggero (+ regional)": "###_it_ilmessaggero",
|
||||
"Il Resto del Carlino": "ilrestodelcarlino.it",
|
||||
"Inc.com": "inc.com",
|
||||
"Inkl": "inkl.com",
|
||||
@ -138,7 +138,7 @@ var defaultSites =
|
||||
"National Review": "nationalreview.com",
|
||||
"Nautilus": "nautil.us",
|
||||
"Neue Zürcher Zeitung": "nzz.ch",
|
||||
"New York Magazine (+ Grub Street, The Cut & Vulture)": "nymag.com",
|
||||
"New York Magazine (+ Grub Street, The Cut & Vulture)": "###_usa_nymag",
|
||||
"New Zealand Herald": "nzherald.co.nz",
|
||||
"Newsweek": "newsweek.com",
|
||||
"Nikkei Asian Review": "asia.nikkei.com",
|
||||
|
Loading…
x
Reference in New Issue
Block a user