2017-07-08 19:40:29 +02:00
|
|
|
var defaultSites = {
|
2019-10-14 14:52:27 +02:00
|
|
|
'Algemeen Dagblad': 'ad.nl',
|
2017-07-08 19:40:29 +02:00
|
|
|
'Baltimore Sun': 'baltimoresun.com',
|
2017-09-15 07:17:10 +02:00
|
|
|
'Barron\'s': 'barrons.com',
|
2018-05-06 02:53:07 +02:00
|
|
|
'Bloomberg': 'bloomberg.com',
|
2019-10-06 19:28:35 +02:00
|
|
|
'Bloomberg Quint': 'bloombergquint.com',
|
2018-07-08 00:11:09 +02:00
|
|
|
'Business Insider': 'businessinsider.com',
|
2019-12-20 19:13:21 +01:00
|
|
|
'Caixin Global': 'caixinglobal.com',
|
2019-01-05 20:39:45 +01:00
|
|
|
'Chemical & Engineering News': 'cen.acs.org',
|
2017-07-08 19:40:29 +02:00
|
|
|
'Chicago Tribune': 'chicagotribune.com',
|
2018-10-29 05:17:36 +01:00
|
|
|
'Central Western Daily': 'centralwesterndaily.com.au',
|
|
|
|
'Crain\'s Chicago Business': 'chicagobusiness.com',
|
2018-04-06 08:22:58 +02:00
|
|
|
'Corriere Della Sera': 'corriere.it',
|
2017-07-08 19:40:29 +02:00
|
|
|
'Daily Press': 'dailypress.com',
|
2019-11-17 17:06:30 +01:00
|
|
|
'DeMorgen': 'demorgen.be',
|
2018-07-05 03:46:28 +02:00
|
|
|
'Denver Post': 'denverpost.com',
|
2019-10-14 14:52:27 +02:00
|
|
|
'De Groene Amsterdammer': 'groene.nl',
|
2019-02-02 23:52:20 +01:00
|
|
|
'De Tijd': 'tijd.be',
|
2019-04-06 23:47:59 +02:00
|
|
|
'de Volkskrant': 'volkskrant.nl',
|
2019-12-08 06:50:00 +01:00
|
|
|
'ET Prime': 'prime.economictimes.indiatimes.com',
|
2019-11-27 19:23:00 +01:00
|
|
|
'The Economist': 'economist.com',
|
2019-10-14 14:52:27 +02:00
|
|
|
'Eindhovens Dagblad': 'ed.nl',
|
2018-10-02 04:03:00 +02:00
|
|
|
'Examiner': 'examiner.com.au',
|
2017-07-08 19:40:29 +02:00
|
|
|
'Financial Times': 'ft.com',
|
2018-11-12 00:42:17 +01:00
|
|
|
'Foreign Policy': 'foreignpolicy.com',
|
2017-07-08 19:40:29 +02:00
|
|
|
'Glassdoor': 'glassdoor.com',
|
2018-12-02 05:33:21 +01:00
|
|
|
'Haaretz': 'haaretz.co.il',
|
2018-04-23 11:20:40 +02:00
|
|
|
'Haaretz English': 'haaretz.com',
|
2019-04-06 23:47:59 +02:00
|
|
|
'Handelsblatt': 'handelsblatt.com',
|
2019-12-07 19:28:19 +01:00
|
|
|
'Harper\'s Magazine': 'harpers.org',
|
2017-07-08 19:40:29 +02:00
|
|
|
'Hartford Courant': 'courant.com',
|
|
|
|
'Harvard Business Review': 'hbr.org',
|
|
|
|
'Inc.com': 'inc.com',
|
2019-03-10 21:03:53 +01:00
|
|
|
'Investors Chronicle': 'investorschronicle.co.uk',
|
2018-12-06 22:23:04 +01:00
|
|
|
'La Repubblica': 'repubblica.it',
|
2019-10-23 13:06:43 +02:00
|
|
|
'Le Monde': 'lemonde.fr',
|
2019-12-10 20:08:01 +01:00
|
|
|
'Le Parisien': 'leparisien.fr',
|
2017-09-15 07:17:10 +02:00
|
|
|
'Le Temps': 'letemps.ch',
|
2019-12-23 12:24:34 +01:00
|
|
|
'Les Echos': 'lesechos.fr',
|
2019-12-03 11:53:30 +01:00
|
|
|
'London Review of Books': 'lrb.co.uk',
|
2017-07-08 19:40:29 +02:00
|
|
|
'Los Angeles Times': 'latimes.com',
|
2018-01-31 06:08:11 +01:00
|
|
|
'Medium': 'medium.com',
|
2017-07-08 19:40:29 +02:00
|
|
|
'Medscape': 'medscape.com',
|
|
|
|
'MIT Technology Review': 'technologyreview.com',
|
2018-10-29 05:44:18 +01:00
|
|
|
'Mountain View Voice': 'mv-voice.com',
|
2019-04-06 23:47:59 +02:00
|
|
|
'National Post': 'nationalpost.com',
|
2019-09-21 15:50:50 +02:00
|
|
|
'New Statesman (javascript disabled)': 'newstatesman.com',
|
2019-02-19 02:25:35 +01:00
|
|
|
'New York Magazine': 'nymag.com',
|
2019-06-27 05:26:30 +02:00
|
|
|
'New Zealand Herald': 'nzherald.co.nz',
|
2020-01-05 16:48:54 +01:00
|
|
|
'Newcastle Herald': 'newcastleherald.com.au',
|
2017-07-08 19:40:29 +02:00
|
|
|
'Nikkei Asian Review': 'asia.nikkei.com',
|
2019-12-07 22:26:58 +01:00
|
|
|
'NK News': 'nknews.org',
|
2017-07-08 19:40:29 +02:00
|
|
|
'NRC': 'nrc.nl',
|
2018-10-29 05:44:18 +01:00
|
|
|
'Orange County Register': 'ocregister.com',
|
|
|
|
'Orlando Sentinel': 'orlandosentinel.com',
|
|
|
|
'Palo Alto Online': 'paloaltoonline.com',
|
2019-10-14 14:52:27 +02:00
|
|
|
'Parool': 'parool.nl',
|
2019-09-30 03:18:59 +02:00
|
|
|
'Quartz': 'qz.com',
|
2018-10-29 05:44:18 +01:00
|
|
|
'Quora': 'quora.com',
|
2019-11-01 18:40:39 +01:00
|
|
|
'Scientific American': 'scientificamerican.com',
|
2020-01-05 17:41:06 +01:00
|
|
|
'Scribd (documents only)': 'scribd.com',
|
2019-07-11 19:48:40 +02:00
|
|
|
'Statista': 'statista.com',
|
2018-10-29 05:44:18 +01:00
|
|
|
'SunSentinel': 'sun-sentinel.com',
|
2020-01-05 16:31:22 +01:00
|
|
|
'Tech in Asia': 'techinasia.com',
|
2019-10-14 14:52:27 +02:00
|
|
|
'Telegraaf': 'telegraaf.nl',
|
2018-10-02 04:03:00 +02:00
|
|
|
'The Advocate': 'theadvocate.com.au',
|
2019-04-07 01:34:30 +02:00
|
|
|
'The Age': 'theage.com.au',
|
2020-01-05 13:02:44 +01:00
|
|
|
'The Athletic': 'theathletic.com',
|
2019-09-30 02:47:26 +02:00
|
|
|
'The Atlantic': 'theatlantic.com',
|
2019-04-07 01:34:30 +02:00
|
|
|
'The Australian': 'theaustralian.com.au',
|
2019-09-30 02:34:16 +02:00
|
|
|
'The Australian Financial Review (javascript disabled)': 'afr.com',
|
2019-12-07 18:33:38 +01:00
|
|
|
'The Boston Globe': 'bostonglobe.com',
|
2018-06-30 21:48:40 +02:00
|
|
|
'The Business Journals': 'bizjournals.com',
|
2019-05-13 01:40:27 +02:00
|
|
|
'The Diplomat': 'thediplomat.com',
|
2020-01-05 17:23:28 +01:00
|
|
|
'The Globe and Mail': 'theglobeandmail.com',
|
2019-11-02 12:20:28 +01:00
|
|
|
'The Hindu': 'thehindu.com',
|
2018-09-09 22:21:36 +02:00
|
|
|
'The Japan Times': 'japantimes.co.jp',
|
2018-10-29 05:44:18 +01:00
|
|
|
'TheMarker': 'themarker.com',
|
2018-01-31 06:08:11 +01:00
|
|
|
'The Mercury News': 'mercurynews.com',
|
2019-11-01 02:31:54 +01:00
|
|
|
'The Mercury Tasmania': 'themercury.com.au',
|
2017-07-08 19:40:29 +02:00
|
|
|
'The Morning Call': 'mcall.com',
|
|
|
|
'The Nation': 'thenation.com',
|
|
|
|
'The New York Times': 'nytimes.com',
|
|
|
|
'The New Yorker': 'newyorker.com',
|
2019-01-05 20:39:45 +01:00
|
|
|
'The News-Gazette': 'news-gazette.com',
|
2019-12-08 19:34:26 +01:00
|
|
|
'The Philadelphia Inquirer': 'inquirer.com',
|
2019-02-02 23:52:20 +01:00
|
|
|
'The Saturday Paper': 'thesaturdaypaper.com.au',
|
2018-07-23 04:04:27 +02:00
|
|
|
'The Spectator': 'spectator.co.uk',
|
2017-07-08 19:40:29 +02:00
|
|
|
'The Seattle Times': 'seattletimes.com',
|
|
|
|
'The Sydney Morning Herald': 'smh.com.au',
|
2019-04-07 01:34:30 +02:00
|
|
|
'The Telegraph': 'telegraph.co.uk',
|
|
|
|
'The Times': 'thetimes.co.uk',
|
2020-01-05 17:08:07 +01:00
|
|
|
'The Toronto Star': 'thestar.com',
|
2017-07-08 19:40:29 +02:00
|
|
|
'The Washington Post': 'washingtonpost.com',
|
2018-06-03 20:23:04 +02:00
|
|
|
'The Wall Street Journal': 'wsj.com',
|
2019-12-05 21:32:20 +01:00
|
|
|
'Times Literary Supplement': 'the-tls.co.uk',
|
2018-07-23 04:22:07 +02:00
|
|
|
'Towards Data Science': 'towardsdatascience.com',
|
2019-10-14 14:52:27 +02:00
|
|
|
'Trouw': 'trouw.nl',
|
2018-06-23 04:58:07 +02:00
|
|
|
'Vanity Fair': 'vanityfair.com',
|
2019-10-14 14:52:27 +02:00
|
|
|
'Vrij Nederland': 'vn.nl',
|
2018-10-02 04:03:00 +02:00
|
|
|
'Wired': 'wired.com'
|
2017-07-08 19:40:29 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// Saves options to browser.storage
|
|
|
|
function save_options() {
|
|
|
|
var gh_url = document.getElementById('bypass_sites').value;
|
|
|
|
var inputEls = document.querySelectorAll('#bypass_sites input');
|
|
|
|
var sites = {};
|
|
|
|
|
|
|
|
var sites = Array.from(inputEls).reduce(function(memo, inputEl) {
|
|
|
|
if (inputEl.checked) {
|
|
|
|
memo[inputEl.dataset.key] = inputEl.dataset.value;
|
|
|
|
}
|
|
|
|
return memo;
|
|
|
|
}, {});
|
|
|
|
|
|
|
|
browser.storage.sync.set({
|
|
|
|
sites: sites
|
|
|
|
}, function() {
|
|
|
|
// Update status to let user know options were saved.
|
|
|
|
var status = document.getElementById('status');
|
2018-10-07 07:18:34 +02:00
|
|
|
status.textContent = 'Options saved.';
|
2017-07-08 19:40:29 +02:00
|
|
|
setTimeout(function() {
|
|
|
|
// status.textContent = '';
|
|
|
|
window.close();
|
|
|
|
}, 500);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// Restores checkbox input states using the preferences
|
|
|
|
// stored in browser.storage.
|
|
|
|
function renderOptions() {
|
|
|
|
browser.storage.sync.get({
|
|
|
|
sites: {}
|
|
|
|
}, function(items) {
|
|
|
|
var sites = items.sites;
|
|
|
|
var sitesEl = document.getElementById('bypass_sites');
|
|
|
|
for (var key in defaultSites) {
|
|
|
|
if (!defaultSites.hasOwnProperty(key)) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
var value = defaultSites[key];
|
|
|
|
var labelEl = document.createElement('label');
|
|
|
|
var inputEl = document.createElement('input');
|
|
|
|
inputEl.type = 'checkbox';
|
|
|
|
inputEl.dataset.key = key;
|
|
|
|
inputEl.dataset.value = value;
|
2019-11-05 18:13:46 +01:00
|
|
|
inputEl.checked = (key in sites) || (key.replace(/\s\(.*\)/, '') in sites);
|
2017-07-08 19:40:29 +02:00
|
|
|
|
|
|
|
labelEl.appendChild(inputEl);
|
|
|
|
labelEl.appendChild(document.createTextNode(' '+key));
|
|
|
|
sitesEl.appendChild(labelEl);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function selectAll() {
|
|
|
|
var inputEls = Array.from(document.querySelectorAll('input'));
|
|
|
|
inputEls.forEach(function(inputEl) {
|
|
|
|
inputEl.checked = true;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function selectNone() {
|
|
|
|
var inputEls = Array.from(document.querySelectorAll('input'));
|
|
|
|
inputEls.forEach(function(inputEl) {
|
|
|
|
inputEl.checked = false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
document.addEventListener('DOMContentLoaded', renderOptions);
|
|
|
|
document.getElementById('save').addEventListener('click', save_options);
|
|
|
|
document.getElementById('select-all').addEventListener('click', selectAll);
|
|
|
|
document.getElementById('select-none').addEventListener('click', selectNone);
|
|
|
|
|