From 8d2390b648183873b0886c69831d93782f131a1a Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Mon, 6 Jul 2020 19:30:48 +0200 Subject: [PATCH] Add Geelong Advertiser & Western Advocate Plus grouping Australian sites (check readme). --- README.md | 60 +++++++++++++++++++++++++++--------------------- background.js | 49 +++++++++++++++++++-------------------- contentScript.js | 2 +- lp/manifest.json | 2 ++ sites.js | 24 ++----------------- 5 files changed, 63 insertions(+), 74 deletions(-) diff --git a/README.md b/README.md index 67f1b66..6291af3 100644 --- a/README.md +++ b/README.md @@ -106,43 +106,51 @@ Install add-on by downloading xpi-file. [Winston-Salem Journal](https://www.journalnow.com) #### Australia/New Zealand -[Bendigo Advertiser](https://www.bendigoadvertiser.com.au) - -[Cairns Post](https://www.cairnspost.com.au) – -[Central Western Daily](https://www.centralwesterndaily.com.au) - -[Daily Liberal](https://www.dailyliberal.com.au) - -[Gold Coast Bulletin](https://www.goldcoastbulletin.com.au) – -[Herald Sun](https://www.heraldsun.com.au) – -[Illawarra Mercury](https://www.illawarramercury.com.au) - + [New Zealand Herald](https://www.nzherald.co.nz) - -[Newcastle Herald](https://www.newcastleherald.com.au) - -[Northern Territory News](https://www.ntnews.com.au) – -[The Advertiser/AdelaideNow](https://www.adelaidenow.com.au) – -[The Advocate](https://www.theadvocate.com.au) - [The Age](https://www.theage.com.au) - [The Australian](https://www.theaustralian.com.au) - +[The Australian Financial Review](https://www.afr.com) - +[The Mercury Tasmania](https://www.themercury.com.au) - +[The Saturday Paper](https://www.thesaturdaypaper.com.au) - +[The Spectator Australia](https://www.spectator.com.au) - +[The Sydney Morning Herald](https://www.smh.com.au) – +[The Weekly Times](https://www.weeklytimesnow.com.au) – +[WAtoday](https://www.watoday.com.au) + +##### > News Corps Australia +[Cairns Post](https://www.cairnspost.com.au) – +[Geelong Advertiser](https://www.geelongadvertiser.com.au) - +[Gold Coast Bulletin](https://www.goldcoastbulletin.com.au) – +[Herald Sun](https://www.heraldsun.com.au) – +[Northern Territory News](https://www.ntnews.com.au) – +[The Advertiser/AdelaideNow](https://www.adelaidenow.com.au) – +[The Courier-Mail](https://www.couriermail.com.au) – +[The Daily Telegraph](https://www.dailytelegraph.com.au) – +[Townsville Bulletin](https://www.townsvillebulletin.com.au) + +##### > Financial + +[Eureka Report](https://www.eurekareport.com.au) - +[Intelligent Investor](https://www.intelligentinvestor.com.au) - +[Switzer Report](https://switzersuperreport.com.au) + +##### > Australian Community Media +[Bendigo Advertiser](https://www.bendigoadvertiser.com.au) - +[Central Western Daily](https://www.centralwesterndaily.com.au) - +[Daily Liberal](https://www.dailyliberal.com.au) - +[Illawarra Mercury](https://www.illawarramercury.com.au) - +[Newcastle Herald](https://www.newcastleherald.com.au) - +[The Advocate](https://www.theadvocate.com.au) - [The Border Mail](https://www.bordermail.com.au) - [The Canberra Times](https://www.canberratimes.com.au) - [The Courier](https://www.thecourier.com.au) - -[The Courier-Mail](https://www.couriermail.com.au) – [The Daily Advertiser](https://www.dailyadvertiser.com.au) - -[The Daily Telegraph](https://www.dailytelegraph.com.au) – [The Examiner](https://www.examiner.com.au) - -[The Mercury Tasmania](https://www.themercury.com.au) - [The Northern Daily Leader](https://www.northerndailyleader.com.au) - [The Port Macquarie News](https://www.portnews.com.au) - -[The Saturday Paper](https://www.thesaturdaypaper.com.au) - -[The Spectator Australia](https://www.spectator.com.au) - [The Standard](https://www.standard.net.au) - -[The Sydney Morning Herald](https://www.smh.com.au) – -[The Weekly Times](https://www.weeklytimesnow.com.au) – -[Townsville Bulletin](https://www.townsvillebulletin.com.au) - -[WAtoday](https://www.watoday.com.au) - -##### > Financial -[Eureka Report](https://www.eurekareport.com.au) - -[Intelligent Investor](https://www.intelligentinvestor.com.au) - -[Switzer Report](https://switzersuperreport.com.au) - -[The Australian Financial Review](https://www.afr.com) +[Western Advocate](https://www.westernadvocate.com.au) #### Canada [National Post](https://www.nationalpost.com) - diff --git a/background.js b/background.js index bf1bb91..2dd5306 100644 --- a/background.js +++ b/background.js @@ -20,15 +20,11 @@ const restrictions = { // allow_cookies are completed with domains in sites.js (default allow/remove_cookies) var allow_cookies = [ 'abc.es', -'adelaidenow.com.au', 'aftonbladet.se', 'belfasttelegraph.co.uk', 'bostonglobe.com', 'business-standard.com', -'cairnspost.com.au', 'clarin.com', -'couriermail.com.au', -'dailytelegraph.com.au', 'demorgen.be', 'dn.se', 'dvhn.nl', @@ -38,11 +34,9 @@ var allow_cookies = [ 'folha.uol.com.br', 'ftm.nl', 'gestion.pe', -'goldcoastbulletin.com.au', 'haaretz.co.il', 'haaretz.com', 'handelsblatt.com', -'heraldsun.com.au', 'humo.be', 'ilfattoquotidiano.it', 'independent.ie', @@ -56,7 +50,6 @@ var allow_cookies = [ 'nationalgeographic.com', 'nationalreview.com', 'newrepublic.com', -'ntnews.com.au', 'nytimes.com', 'parool.nl', 'quora.com', @@ -71,7 +64,6 @@ var allow_cookies = [ 'theaustralian.com.au', 'themarker.com', 'themercury.com.au', -'townsvillebulletin.com.au', 'trouw.nl', 'volkskrant.nl', 'weeklytimesnow.com.au', @@ -110,26 +102,19 @@ for (var domainIndex in ad_region_domains) { } // Override User-Agent with Googlebot -const use_google_bot_default = [ +var use_google_bot_default = [ 'abc.es', -'adelaidenow.com.au', 'aftonbladet.se', 'barrons.com', -'cairnspost.com.au', -'couriermail.com.au', -'dailytelegraph.com.au', 'dn.se', 'eurekareport.com.au', 'ft.com', -'goldcoastbulletin.com.au', 'haaretz.co.il', 'haaretz.com', 'handelsblatt.com', -'heraldsun.com.au', 'intelligentinvestor.com.au', 'mexiconewsdaily.com', 'miamiherald.com', -'ntnews.com.au', 'quora.com', 'republic.ru', 'seekingalpha.com', @@ -140,7 +125,6 @@ const use_google_bot_default = [ 'themarker.com', 'themercury.com.au', 'thetimes.co.uk', -'townsvillebulletin.com.au', 'weeklytimesnow.com.au', 'worldpoliticsreview.com', 'wsj.com', @@ -197,12 +181,10 @@ var blockedRegexes = { 'modernhealthcare.com': /.+\.tinypass\.com\/.+/, 'nationalgeographic.com': /.+\.blueconic\.net\/.+/, 'nationalreview.com': /.+\.blueconic\.net\/.+/, -'newcastleherald.com.au': /.+cdn-au\.piano\.io\/api\/tinypass.+\.js/, 'newrepublic.com': /.+\.onecount\.net\/js\/.+/, 'newsweek.com': /.+\.googletagmanager\.com\/gtm\.js/, 'nytimes.com': /(.+meter-svc\.nytimes\.com\/meter\.js.+|.+mwcm\.nyt\.com\/.+\.js)/, 'nzherald.co.nz': /nzherald\.co\.nz\/.+\/headjs\/.+\.js/, -'portnews.com.au': /.+cdn-au\.piano\.io\/api\/tinypass.+\.js/, 'repubblica.it': /scripts\.repubblica\.it\/pw\/pw\.js.+/, 'science-et-vie.com': /.+\.qiota\.com\/.+/, 'sciencesetavenir.fr': /.+\.poool\.fr\/.+/, @@ -210,14 +192,15 @@ var blockedRegexes = { 'spectator.co.uk': /.+\.tinypass\.com\/.+/, 'spectator.com.au': /.+\.tinypass\.com\/.+/, 'telegraph.co.uk': /.+\.tinypass\.com\/.+/, -'theadvocate.com.au': /.+cdn-au\.piano\.io\/api\/tinypass.+\.js/, -'thecourier.com.au': /.+cdn-au\.piano\.io\/api\/tinypass.+\.js/, 'thedailybeast.com': /.+\.tinypass\.com\/.+/, 'thenation.com': /.+\.tinypass\.com\/.+/, 'valeursactuelles.com': /.+\.poool\.fr\/.+/, 'wsj.com': /cdn\.ampproject\.org\/v\d\/amp-access-.+\.js/ }; +const au_comm_media_domains = ['bendigoadvertiser.com.au', 'bordermail.com.au', 'canberratimes.com.au', 'centralwesterndaily.com.au', 'dailyadvertiser.com.au', 'dailyliberal.com.au', 'examiner.com.au', 'illawarramercury.com.au', 'newcastleherald.com.au', 'northerndailyleader.com.au', 'portnews.com.au', 'standard.net.au', 'theadvocate.com.au', 'thecourier.com.au', 'westernadvocate.com.au']; +const au_news_corps_domains = ['adelaidenow.com.au', 'cairnspost.com.au', 'couriermail.com.au', 'dailytelegraph.com.au', 'geelongadvertiser.com.au', 'goldcoastbulletin.com.au', 'heraldsun.com.au', 'ntnews.com.au', 'townsvillebulletin.com.au']; + const userAgentDesktop = "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" const userAgentMobile = "Chrome/41.0.2272.96 Mobile Safari/537.36 (compatible ; Googlebot/2.1 ; +http://www.google.com/bot.html)" @@ -258,8 +241,21 @@ ext_api.storage.sync.get({ }).map(function (key) { return sites[key].toLowerCase(); }); - if (enabledSites.includes('ad.nl')) { + if (enabledSites.includes('ad.nl')) enabledSites = enabledSites.concat(ad_region_domains); + if (enabledSites.includes('###_au_comm_media')) { + enabledSites = enabledSites.concat(au_comm_media_domains); + for (let domain of au_comm_media_domains) { + blockedRegexes[domain] = /.+cdn-au\.piano\.io\/api\/tinypass.+\.js/; + } + } + if (enabledSites.includes('###_au_news_corps')) { + enabledSites = enabledSites.concat(au_news_corps_domains); + for (let domain of au_news_corps_domains) { + allow_cookies.push(domain); + use_google_bot_default.push(domain); + } + use_google_bot = use_google_bot_default.slice(); } for (let domainVar of enabledSites) { @@ -282,10 +278,13 @@ ext_api.storage.onChanged.addListener(function (changes, namespace) { }).map(function (key) { return sites[key]; }); - if (enabledSites.includes('ad.nl')) { + if (enabledSites.includes('ad.nl')) enabledSites = enabledSites.concat(ad_region_domains); - } - // reset disableJavascriptOnListedSites eventListener + if (enabledSites.includes('###_au_comm_media')) + enabledSites = enabledSites.concat(au_comm_media_domains); + if (enabledSites.includes('###_au_news_corps')) + enabledSites = enabledSites.concat(au_news_corps_domains); + // reset disableJavascriptOnListedSites eventListener ext_api.webRequest.onBeforeRequest.removeListener(disableJavascriptOnListedSites); ext_api.webRequest.handlerBehaviorChanged(); } diff --git a/contentScript.js b/contentScript.js index a51c7bc..3e2ac3f 100644 --- a/contentScript.js +++ b/contentScript.js @@ -8,7 +8,7 @@ if (!matchDomain(arr_localstorage_hold)){ // Australian Community Media newspapers if (window.location.hostname.endsWith(".com.au") || window.location.hostname.endsWith(".net.au")) { - let au_sites = ['bendigoadvertiser.com.au', 'bordermail.com.au', 'canberratimes.com.au', 'centralwesterndaily.com.au', 'dailyadvertiser.com.au', 'dailyliberal.com.au', 'examiner.com.au', 'illawarramercury.com.au', 'newcastleherald.com.au', 'northerndailyleader.com.au', 'portnews.com.au', 'standard.net.au', 'theadvocate.com.au', 'thecourier.com.au']; + let au_sites = ['bendigoadvertiser.com.au', 'bordermail.com.au', 'canberratimes.com.au', 'centralwesterndaily.com.au', 'dailyadvertiser.com.au', 'dailyliberal.com.au', 'examiner.com.au', 'illawarramercury.com.au', 'newcastleherald.com.au', 'northerndailyleader.com.au', 'portnews.com.au', 'standard.net.au', 'theadvocate.com.au', 'thecourier.com.au', 'westernadvocate.com.au']; let au_piano_script = document.querySelector('script[src="https://cdn-au.piano.io/api/tinypass.min.js"]'); if (matchDomain(au_sites) || au_piano_script) { const subscribe_truncate = document.querySelector('.subscribe-truncate'); diff --git a/lp/manifest.json b/lp/manifest.json index 3faa82f..b9bcf5e 100644 --- a/lp/manifest.json +++ b/lp/manifest.json @@ -98,6 +98,7 @@ "*://*.fortune.com/*", "*://*.ft.com/*", "*://*.ftm.nl/*", + "*://*.geelongadvertiser.com.au/*", "*://*.gestion.pe/*", "*://*.glassdoor.com/*", "*://*.globes.co.il/*", @@ -233,6 +234,7 @@ "*://*.washingtonpost.com/*", "*://*.watoday.com.au/*", "*://*.weeklytimesnow.com.au/*", + "*://*.westernadvocate.com.au/*", "*://*.wired.com/*", "*://*.worldpoliticsreview.com/*", "*://*.wsj.com/*", diff --git a/sites.js b/sites.js index 95f455b..13e10d7 100644 --- a/sites.js +++ b/sites.js @@ -7,18 +7,17 @@ var defaultSites = "American Affairs": "americanaffairsjournal.org", "American Banker": "americanbanker.com", "Atavist Magazine": "atavist.com", + "Australia News Corps": "###_au_news_corps", + "Australian Community Media (daily)": "###_au_comm_media", "Baltimore Sun": "baltimoresun.com", "Barron's": "barrons.com", "BBC History Extra": "historyextra.com", "Belfast Telegraph": "belfasttelegraph.co.uk", - "Bendigo Advertiser": "bendigoadvertiser.com.au", "Bloomberg": "bloomberg.com", "Bloomberg Quint (free articles only)": "bloombergquint.com", "Business Insider": "businessinsider.com", "Business Standard": "business-standard.com", - "Cairns Post": "cairnspost.com.au", "Caixin Global": "caixinglobal.com", - "Central Western Daily": "centralwesterndaily.com.au", "Challenges": "challenges.fr", "Chemical & Engineering News": "cen.acs.org", "Chicago Tribune": "chicagotribune.com", @@ -28,7 +27,6 @@ var defaultSites = "Crain's Chicago Business": "chicagobusiness.com", "Dagblad van het Noorden": "dvhn.nl", "Dagens Nyheter": "dn.se", - "Daily Liberal": "dailyliberal.com.au", "Daily Press": "dailypress.com", "Dark Reading": "darkreading.com", "De Tijd": "tijd.be", @@ -53,7 +51,6 @@ var defaultSites = "Gestión": "gestion.pe", "Glassdoor": "glassdoor.com", "Globes": "globes.co.il", - "Gold Coast Bulletin": "goldcoastbulletin.com.au", "Groene Amsterdammer": "groene.nl", "Haaretz English": "haaretz.com", "Haaretz": "haaretz.co.il", @@ -62,13 +59,11 @@ var defaultSites = "Hartford Courant": "courant.com", "Harvard Business Review": "hbr.org", "Harvard Business Review Taiwan": "hbrtaiwan.com", - "Herald Sun": "heraldsun.com.au", "Het Financieel Dagblad": "fd.nl", "Humo.be": "humo.be", "Il Fatto Quotidiano": "ilfattoquotidiano.it", "Il Manifesto": "ilmanifesto.it", "Il Messaggero": "ilmessaggero.it", - "Illawarra Mercury": "illawarramercury.com.au", "Inc.com": "inc.com", "Inkl": "inkl.com", "Intelligent Investor": "intelligentinvestor.com.au", @@ -108,10 +103,8 @@ var defaultSites = "Neue Zürcher Zeitung": "nzz.ch", "New York Magazine": "nymag.com", "New Zealand Herald": "nzherald.co.nz", - "Newcastle Herald": "newcastleherald.com.au", "Newsweek": "newsweek.com", "Nikkei Asian Review": "asia.nikkei.com", - "Northern Territory News": "ntnews.com.au", "NRC Handelsblad": "nrc.nl", "O Estado de S. Paulo": "estadao.com.br", "O Globo": "globo.com", @@ -138,8 +131,6 @@ var defaultSites = "Switzer Report": "switzersuperreport.com.au", "Tech in Asia": "techinasia.com", "Telegraaf": "telegraaf.nl", - "The Advertiser": "adelaidenow.com.au", - "The Advocate": "theadvocate.com.au", "The Age": "theage.com.au", "The American Interest": "the-american-interest.com", "The Athletic": "theathletic.com", @@ -147,20 +138,13 @@ var defaultSites = "The Atlantic": "theatlantic.com", "The Australian Financial Review": "afr.com", "The Australian": "theaustralian.com.au", - "The Border Mail": "bordermail.com.au", "The Boston Globe": "bostonglobe.com", "The Business Journals": "bizjournals.com", - "The Canberra Times": "canberratimes.com.au", "The Christian Science Monitor": "csmonitor.com", - "The Courier": "thecourier.com.au", - "The Courier-Mail": "couriermail.com.au", - "The Daily Advertiser": "dailyadvertiser.com.au", "The Daily Beast (free articles only)": "thedailybeast.com", - "The Daily Telegraph": "dailytelegraph.com.au", "The Denver Post": "denverpost.com", "The Diplomat": "thediplomat.com", "The Economist": "economist.com", - "The Examiner": "examiner.com.au", "The Globe and Mail": "theglobeandmail.com", "The Hindu": "thehindu.com", "The Irish Times (free articles only)": "irishtimes.com", @@ -175,15 +159,12 @@ var defaultSites = "The New York Times": "nytimes.com", "The New Yorker": "newyorker.com", "The News-Gazette": "news-gazette.com", - "The Northern Daily Leader": "northerndailyleader.com.au", "The Philadelphia Inquirer": "inquirer.com", - "The Port Macquarie News": "portnews.com.au", "The Sacramento Bee (free articles only)": "sacbee.com", "The Saturday Paper": "thesaturdaypaper.com.au", "The Seattle Times": "seattletimes.com", "The Spectator": "spectator.co.uk", "The Spectator Australia": "spectator.com.au", - "The Standard": "standard.net.au", "The Sydney Morning Herald": "smh.com.au", "The Telegraph": "telegraph.co.uk", "The Times": "thetimes.co.uk", @@ -193,7 +174,6 @@ var defaultSites = "The Washington Post": "washingtonpost.com", "The Weekly Times": "weeklytimesnow.com.au", "Towards Data Science": "towardsdatascience.com", - "Townsville Bulletin": "townsvillebulletin.com.au", "Trouw": "trouw.nl", "Valeurs Actuelles": "valeursactuelles.com", "Vanity Fair": "vanityfair.com",