2017-07-08 17:40:29 +00:00
|
|
|
var defaultSites = {
|
|
|
|
'Baltimore Sun': 'baltimoresun.com',
|
2017-09-15 05:17:10 +00:00
|
|
|
'Barron\'s': 'barrons.com',
|
2018-05-06 00:53:07 +00:00
|
|
|
'Bloomberg': 'bloomberg.com',
|
2018-07-07 22:11:09 +00:00
|
|
|
'Business Insider': 'businessinsider.com',
|
2018-07-16 04:43:40 +00:00
|
|
|
'Caixin': 'caixinglobal.com',
|
2019-01-05 19:39:45 +00:00
|
|
|
'Chemical & Engineering News': 'cen.acs.org',
|
2017-07-08 17:40:29 +00:00
|
|
|
'Chicago Tribune': 'chicagotribune.com',
|
2018-10-29 04:17:36 +00:00
|
|
|
'Central Western Daily': 'centralwesterndaily.com.au',
|
|
|
|
'Crain\'s Chicago Business': 'chicagobusiness.com',
|
2018-04-06 06:22:58 +00:00
|
|
|
'Corriere Della Sera': 'corriere.it',
|
2017-07-08 17:40:29 +00:00
|
|
|
'Daily Press': 'dailypress.com',
|
2018-07-05 01:46:28 +00:00
|
|
|
'Denver Post': 'denverpost.com',
|
2019-02-02 22:52:20 +00:00
|
|
|
'De Tijd': 'tijd.be',
|
2019-04-06 21:47:59 +00:00
|
|
|
'de Volkskrant': 'volkskrant.nl',
|
2019-05-13 00:16:58 +00:00
|
|
|
'The Economist (javascript disabled)': 'economist.com',
|
2018-10-02 02:03:00 +00:00
|
|
|
'Examiner': 'examiner.com.au',
|
2017-07-08 17:40:29 +00:00
|
|
|
'Financial Times': 'ft.com',
|
2018-11-11 23:42:17 +00:00
|
|
|
'Foreign Policy': 'foreignpolicy.com',
|
2017-07-08 17:40:29 +00:00
|
|
|
'Glassdoor': 'glassdoor.com',
|
2018-12-02 04:33:21 +00:00
|
|
|
'Haaretz': 'haaretz.co.il',
|
2018-04-23 09:20:40 +00:00
|
|
|
'Haaretz English': 'haaretz.com',
|
2019-04-06 21:47:59 +00:00
|
|
|
'Handelsblatt': 'handelsblatt.com',
|
2017-07-08 17:40:29 +00:00
|
|
|
'Hartford Courant': 'courant.com',
|
|
|
|
'Harvard Business Review': 'hbr.org',
|
|
|
|
'Inc.com': 'inc.com',
|
2019-03-10 20:03:53 +00:00
|
|
|
'Investors Chronicle': 'investorschronicle.co.uk',
|
2018-12-06 21:23:04 +00:00
|
|
|
'La Repubblica': 'repubblica.it',
|
2017-09-15 05:17:10 +00:00
|
|
|
'Le Temps': 'letemps.ch',
|
2017-07-08 17:40:29 +00:00
|
|
|
'Los Angeles Times': 'latimes.com',
|
2018-01-31 05:08:11 +00:00
|
|
|
'Medium': 'medium.com',
|
2017-07-08 17:40:29 +00:00
|
|
|
'Medscape': 'medscape.com',
|
|
|
|
'MIT Technology Review': 'technologyreview.com',
|
2018-10-29 04:44:18 +00:00
|
|
|
'Mountain View Voice': 'mv-voice.com',
|
2019-04-06 21:47:59 +00:00
|
|
|
'National Post': 'nationalpost.com',
|
2018-07-23 01:55:35 +00:00
|
|
|
'New Statesman': 'newstatesman.com',
|
2019-02-19 01:25:35 +00:00
|
|
|
'New York Magazine': 'nymag.com',
|
2019-06-27 03:26:30 +00:00
|
|
|
'New Zealand Herald': 'nzherald.co.nz',
|
2017-07-08 17:40:29 +00:00
|
|
|
'Nikkei Asian Review': 'asia.nikkei.com',
|
|
|
|
'NRC': 'nrc.nl',
|
2018-10-29 04:44:18 +00:00
|
|
|
'Orange County Register': 'ocregister.com',
|
|
|
|
'Orlando Sentinel': 'orlandosentinel.com',
|
|
|
|
'Palo Alto Online': 'paloaltoonline.com',
|
|
|
|
'Quora': 'quora.com',
|
|
|
|
'SunSentinel': 'sun-sentinel.com',
|
2019-03-10 20:00:00 +00:00
|
|
|
'Tech in Asia': 'techinasia.com',
|
2018-10-02 02:03:00 +00:00
|
|
|
'The Advocate': 'theadvocate.com.au',
|
2019-04-06 23:34:30 +00:00
|
|
|
'The Age': 'theage.com.au',
|
|
|
|
'The Australian': 'theaustralian.com.au',
|
2018-12-18 07:45:33 +00:00
|
|
|
'The Australian Financial Review': 'afr.com',
|
2018-01-31 05:08:11 +00:00
|
|
|
'The Boston Globe': 'bostonglobe.com',
|
2018-06-30 19:48:40 +00:00
|
|
|
'The Business Journals': 'bizjournals.com',
|
2019-05-12 23:40:27 +00:00
|
|
|
'The Diplomat': 'thediplomat.com',
|
2019-05-12 23:31:18 +00:00
|
|
|
'The Globe and Mail (javascript disabled)': 'theglobeandmail.com',
|
2018-10-29 04:17:36 +00:00
|
|
|
'The Herald': 'theherald.com.au',
|
2018-09-09 20:21:36 +00:00
|
|
|
'The Japan Times': 'japantimes.co.jp',
|
2018-10-29 04:44:18 +00:00
|
|
|
'TheMarker': 'themarker.com',
|
2018-01-31 05:08:11 +00:00
|
|
|
'The Mercury News': 'mercurynews.com',
|
2017-07-08 17:40:29 +00:00
|
|
|
'The Morning Call': 'mcall.com',
|
|
|
|
'The Nation': 'thenation.com',
|
|
|
|
'The New York Times': 'nytimes.com',
|
|
|
|
'The New Yorker': 'newyorker.com',
|
2019-01-05 19:39:45 +00:00
|
|
|
'The News-Gazette': 'news-gazette.com',
|
2019-02-02 22:52:20 +00:00
|
|
|
'The Saturday Paper': 'thesaturdaypaper.com.au',
|
2018-07-23 02:04:27 +00:00
|
|
|
'The Spectator': 'spectator.co.uk',
|
2017-07-08 17:40:29 +00:00
|
|
|
'The Seattle Times': 'seattletimes.com',
|
|
|
|
'The Sydney Morning Herald': 'smh.com.au',
|
2019-04-06 23:34:30 +00:00
|
|
|
'The Telegraph': 'telegraph.co.uk',
|
|
|
|
'The Times': 'thetimes.co.uk',
|
2019-06-22 04:12:14 +00:00
|
|
|
'The Toronto Star (javascript disabled)': 'thestar.com',
|
2017-07-08 17:40:29 +00:00
|
|
|
'The Washington Post': 'washingtonpost.com',
|
2018-06-03 18:23:04 +00:00
|
|
|
'The Wall Street Journal': 'wsj.com',
|
2018-07-23 02:22:07 +00:00
|
|
|
'Towards Data Science': 'towardsdatascience.com',
|
2018-06-23 02:58:07 +00:00
|
|
|
'Vanity Fair': 'vanityfair.com',
|
2018-10-02 02:03:00 +00:00
|
|
|
'Wired': 'wired.com'
|
2017-07-08 17:40:29 +00: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 05:18:34 +00:00
|
|
|
status.textContent = 'Options saved.';
|
2017-07-08 17:40:29 +00: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;
|
|
|
|
inputEl.checked = key in sites;
|
|
|
|
|
|
|
|
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);
|
|
|
|
|