Bela Lubkin 1c3d8d622c Merge 'bypass-paywalls-firefox' extension into 'bypass-paywalls-chrome'
- include the best versions of everything (to the best of my ability...)
- include all supported sites
- update docs to always point to 'bypass-paywalls-chrome' repository
- update docs to be -- not browser-agnostic, but poly-browser
- (tested the 1st 11 sites in alphabetical order, plus WSJ -- using Opera)
- cen.acs.org: retain localstorage ('cookie warning' accepted)
- cen.acs.org: remove .meteredBar '2/3 articles remaining' bar
- XXX centralwesterndaily.com.au: not working (article window-shaded)
- all others tested seem fine (intentionally provoked failures w/ bypass
  disabled, demonstrated success when enabled)
- (end of alphabetical testing)
- move defaultSites{} from background.js & options.js to common.js
- uncertain whether FF contentScript.js code for businessinsider.com,
  haaretz.co.il, wsj.com was helpful, I left them commented out
- use browser-agnostic 'extension_api.*' in place of browser.*, chrome.*
- use 'comma-on-last-item' syntax to allow insertion & sorting without
  breaking structures, minimize commit footprints
- replace 'location.whatever' refs with consistent 'window.location.whatever'
- break structure inits into multi-line format where appropriate
- convert TABs to spaces (background.js had 2-space tabs, manifest.json 4!)
- remove trailing spaces
- sort tables which ought to be sorted, consistently using Linux `LANG=C sort`
  (strict ASCII ordering)
- XXX use of window.location.href.indexOf() considered harmful: for instance,
  'ft.com' will match 'loft.com', or 'ibm.co' (Columbia) matches 'ibm.com';
  intend to replace with something like hostDomainIs('ft.com') -- not now
- XXX Firefox completely untested; I believe a *.xpi with manifest-ff.json
  in place of manifest.json will work, but have not tried
- XXX did not attempt to update updates.json (FF), updates.xml (Chrome)
- XXX why do bypass.svg, *_screenshot.png exist?  At least should not be
  included in *.crx, *.xpi
- XXX same Google Analytics code now in FF build, not sure if this is OK
- version arbitrarily slammed to '1.7.0' (could be '2.0.0')
- code delta -283 lines (mainly defaultSites{}); or -1585 + 3 binaries,
  counting prospective retirement of 'bypass-paywalls-firefox'
- should have been something like 20 separate commits, but got out of hand...

(note 'XXX' problem areas)
2020-03-19 11:04:17 -07:00

138 lines
5.5 KiB
JavaScript

const extension_api =
(typeof browser === 'object' &&
typeof browser.runtime === 'object' &&
typeof browser.runtime.getManifest === 'function') ? browser :
(typeof chrome === 'object' &&
typeof chrome.runtime === 'object' &&
typeof chrome.runtime.getManifest === 'function') ? chrome :
console.log('Cannot find extension_api under namespace "browser" or "chrome"');
// Cookies from this list are blocked by default
const defaultSites = {
'Adweek': 'adweek.com',
'Algemeen Dagblad': 'ad.nl',
'American Banker': 'americanbanker.com',
'Baltimore Sun': 'baltimoresun.com',
'Barron\'s': 'barrons.com',
'Bloomberg': 'bloomberg.com',
'Bloomberg Quint': 'bloombergquint.com',
'Business Insider': 'businessinsider.com',
'Caixin': 'caixinglobal.com',
'Central Western Daily': 'centralwesterndaily.com.au', // articles blanked
'Chemical & Engineering News': 'cen.acs.org', // '2/3 free articles' banner, keeps asking about cookies
'Chicago Tribune': 'chicagotribune.com',
'Corriere Della Sera': 'corriere.it',
'Crain\'s Chicago Business': 'chicagobusiness.com',
'Daily Press': 'dailypress.com',
'De Groene Amsterdammer': 'groene.nl',
'DeMorgen': 'demorgen.be',
'Denver Post': 'denverpost.com',
'De Tijd': 'tijd.be',
'de Volkskrant': 'volkskrant.nl',
'Dynamed Plus': 'dynamed.com',
'Eindhovens Dagblad': 'ed.nl',
'El Pais': 'elpais.com',
'Encyclopedia Britannica': 'britannica.com',
'ET Prime': 'prime.economictimes.indiatimes.com',
'Examiner': 'examiner.com.au',
'Financial News': 'fnlondon.com',
'Financial Times': 'ft.com',
'First Things': 'firstthings.com',
'Foreign Policy': 'foreignpolicy.com',
'Glassdoor': 'glassdoor.com',
'Haaretz English': 'haaretz.com',
'Haaretz': 'haaretz.co.il',
'Handelsblatt': 'handelsblatt.com',
'Harper\'s Magazine': 'harpers.org',
'Hartford Courant': 'courant.com',
'Harvard Business Review': 'hbr.org',
'Het Financieele Dagblad': 'fd.nl',
'Inc.com': 'inc.com',
'Investors Chronicle': 'investorschronicle.co.uk',
'La Nacion': 'lanacion.com.ar',
'La Repubblica': 'repubblica.it',
'La Stampa': 'lastampa.it',
'La Tercera': 'latercera.com',
'L\'Echo': 'lecho.be',
'Le Devoir': 'ledevoir.com',
'Le Monde': 'lemonde.fr',
'Le Parisien': 'leparisien.fr',
'Les Echos': 'lesechos.fr',
'Loeb Classical Library': 'loebclassics.com',
'London Review of Books': 'lrb.co.uk',
'Los Angeles Business Journal': 'labusinessjournal.com',
'Los Angeles Times': 'latimes.com',
'Medium': 'medium.com',
'Mexico News Daily': 'mexiconewsdaily.com',
'MIT Sloan Management Review': 'sloanreview.mit.edu',
'MIT Technology Review': 'technologyreview.com',
'Mountain View Voice': 'mv-voice.com',
'National Post': 'nationalpost.com',
'New Statesman': 'newstatesman.com',
'New York Magazine': 'nymag.com',
'New Zealand Herald': 'nzherald.co.nz',
'Nikkei Asian Review': 'asia.nikkei.com',
'NRC': 'nrc.nl',
'Orange County Register': 'ocregister.com',
'Orlando Sentinel': 'orlandosentinel.com',
'Palo Alto Online': 'paloaltoonline.com',
'Parool': 'parool.nl',
'Quartz': 'qz.com',
'Quora': 'quora.com',
'San Diego Union Tribune': 'sandiegouniontribune.com',
'San Francisco Chronicle': 'sfchronicle.com',
'Scientific American': 'scientificamerican.com',
'Seeking Alpha': 'seekingalpha.com',
'SOFREP': 'sofrep.com',
'Statista': 'statista.com',
'SunSentinel': 'sun-sentinel.com',
'Tech in Asia': 'techinasia.com',
'Telegraaf': 'telegraaf.nl',
'The Advocate': 'theadvocate.com.au',
'The Age': 'theage.com.au',
'The American Interest': 'the-american-interest.com',
'The Athletic': 'theathletic.com',
'The Atlantic': 'theatlantic.com',
'The Australian Financial Review': 'afr.com',
'The Australian': 'theaustralian.com.au',
'The Boston Globe': 'bostonglobe.com',
'The Business Journals': 'bizjournals.com',
'The Canberra Times': 'canberratimes.com.au',
'The Courier': 'thecourier.com.au',
'The Daily Telegraph': 'dailytelegraph.com.au',
'The Diplomat': 'thediplomat.com',
'The Economist': 'economist.com',
'The Globe and Mail': 'theglobeandmail.com',
'The Herald': 'theherald.com.au',
'The Hindu': 'thehindu.com',
'The Irish Times (free articles only)': 'irishtimes.com',
'The Japan Times': 'japantimes.co.jp',
'TheMarker': 'themarker.com',
'The Mercury News': 'mercurynews.com',
'The Mercury Tasmania': 'themercury.com.au',
'The Morning Call': 'mcall.com',
'The Nation': 'thenation.com',
'The News-Gazette': 'news-gazette.com',
'The New Yorker': 'newyorker.com',
'The New York Times': 'nytimes.com',
'The Philadelphia Inquirer': 'inquirer.com',
'The Saturday Paper': 'thesaturdaypaper.com.au',
'The Seattle Times': 'seattletimes.com',
'The Spectator Australia': 'spectator.com.au',
'The Spectator': 'spectator.co.uk',
'The Sydney Morning Herald': 'smh.com.au',
'The Telegraph': 'telegraph.co.uk',
'The Times': 'thetimes.co.uk',
'The Toronto Star': 'thestar.com',
'The Wall Street Journal': 'wsj.com',
'The Washington Post': 'washingtonpost.com',
'Times Literary Supplement': 'the-tls.co.uk',
'Towards Data Science': 'towardsdatascience.com',
'Trouw': 'trouw.nl',
'Vanity Fair': 'vanityfair.com',
'Vrij Nederland': 'vn.nl',
'Winston-Salem Journal': 'journalnow.com',
'Wired': 'wired.com',
'*General Paywall Bypass*': 'generalpaywallbypass',
};