From 1982517c12978ec2f789e279fdd23bbfeb854c46 Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Thu, 20 Feb 2020 19:19:29 +0100 Subject: [PATCH] Add Australian Community Media daily newspapers Bendigo Advertiser, The Border Mail, The Daily Advertiser, Daily Liberal, Illawarra Mercury, The Northern Daily Leader and The Standard. --- README.md | 7 ++++++ contentScript.js | 59 ++++++++++++++++-------------------------------- sites.json | 7 ++++++ 3 files changed, 34 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 5488ce66..4b6fbccd 100644 --- a/README.md +++ b/README.md @@ -90,10 +90,13 @@ [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) – @@ -102,14 +105,18 @@ [The Age](https://www.theage.com.au) - [The Australian](https://www.theaustralian.com.au) - [The Australian Financial Review](https://www.afr.com) - +[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 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) - diff --git a/contentScript.js b/contentScript.js index 60264d67..7bb60bc9 100644 --- a/contentScript.js +++ b/contentScript.js @@ -162,17 +162,6 @@ if (window.location.href.indexOf('lemonde.fr') !== -1) { }); } -if (window.location.href.indexOf("canberratimes.com.au") !== -1) { - const paywall = document.querySelector('.subscribe-article.news-article-body.article__body'); - paywall.classList.remove('subscribe-article'); - let subscribe = document.getElementsByClassName('subscriber-container')[0]; - removeDOMElement(subscribe); - let content = document.getElementsByClassName('subscriber-hider'); - for (let i = 0; i < content.length; i++) { - content[i].classList.remove('subscriber-hider'); - } -} - if (window.location.href.indexOf("ledevoir.com") !== -1) { const counter = document.querySelector('.popup-msg'); removeDOMElement(counter); @@ -315,7 +304,7 @@ if (window.location.href.indexOf("afr.com") !== -1) { const hidden_image = document.querySelectorAll('img'); for (let i = 0; i < hidden_image.length; i++) { var src = hidden_image[i].src; - if ('src: ' + src.indexOf(".gif") !== -1) { + if (src.indexOf(".gif") !== -1) { var data_src = hidden_image[i].getAttribute("data-src"); if (data_src) hidden_image[i].setAttribute('src', data_src); @@ -327,7 +316,7 @@ if (window.location.href.indexOf("afr.com") !== -1) { } if (window.location.href.indexOf("theglobeandmail.com") !== -1) { - document.addEventListener('DOMContentLoaded', () => { + document.addEventListener('DOMContentLoaded', () => { const lazy_image = document.querySelectorAll('.js-lazyimage'); for (let i = 0; i < lazy_image.length; i++) { lazy_image[i].classList.remove('js-lazyimage'); @@ -347,19 +336,27 @@ if (window.location.href.indexOf("theglobeandmail.com") !== -1) { }); } -if (window.location.href.indexOf("newcastleherald.com.au") !== -1 - || window.location.href.indexOf("examiner.com.au") !== -1 - || window.location.href.indexOf("thecourier.com.au") !== -1 - || window.location.href.indexOf("theadvocate.com.au") !== -1) { - const subscribe_truncate = document.querySelector('.subscribe-truncate'); - if (subscribe_truncate) - subscribe_truncate.classList.remove('subscribe-truncate'); - const subscriber_hider = document.querySelectorAll('.subscriber-hider'); - for (let i = 0; i < subscriber_hider.length; i++) { - subscriber_hider[i].classList.remove('subscriber-hider'); +// Australian Community Media newspapers +if (window.location.href.indexOf(".com.au") !== -1 || window.location.href.indexOf(".net.au") !== -1) { + 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', 'standard.net.au', 'theadvocate.com.au', 'thecourier.com.au']; + let domain = new URL(window.location.href).hostname.replace('www.', ''); + if (au_sites.includes(domain)) { + const subscribe_truncate = document.querySelector('.subscribe-truncate'); + if (subscribe_truncate) + subscribe_truncate.classList.remove('subscribe-truncate'); + const subscriber_hider = document.querySelectorAll('.subscriber-hider'); + for (let i = 0; i < subscriber_hider.length; i++) { + subscriber_hider[i].classList.remove('subscriber-hider'); + } } } +if (window.location.href.indexOf("thesaturdaypaper.com.au") !== -1) { + const expand_button = document.querySelector('.continue-reading-button'); + if (expand_button) + expand_button.click(); +} + if (window.location.href.indexOf("sofrep.com") !== -1) { const banner = document.getElementById('scrollerCTA'); removeDOMElement(banner); @@ -401,16 +398,6 @@ if (window.location.href.indexOf("cen.acs.org") !== -1) { }); } -if (window.location.href.indexOf("centralwesterndaily.com.au") !== -1) { - const subscribe_truncate = document.querySelector('.subscribe-truncate'); - if (subscribe_truncate) - subscribe_truncate.classList.remove('subscribe-truncate'); - const subscriber_hider = document.querySelectorAll('.subscriber-hider'); - for (let i = 0; i < subscriber_hider.length; i++) { - subscriber_hider[i].classList.remove('subscriber-hider'); - } -} - if (window.location.href.indexOf("lesechos.fr") !== -1) { const ad_block = document.querySelectorAll('.jzxvkd-1'); for (let i=0; i < ad_block.length; i++) { @@ -418,12 +405,6 @@ if (window.location.href.indexOf("lesechos.fr") !== -1) { } } -if (window.location.href.indexOf("thesaturdaypaper.com.au") !== -1) { - const expand_button = document.querySelector('.continue-reading-button'); - if (expand_button) - expand_button.click(); -} - if (window.location.href.indexOf("lc.nl") !== -1 || window.location.href.indexOf("dvhn.nl") !== -1) { document.addEventListener('DOMContentLoaded', () => { const preview = document.querySelector('.preview'); diff --git a/sites.json b/sites.json index 84d7875a..dc9b0b96 100644 --- a/sites.json +++ b/sites.json @@ -5,6 +5,7 @@ "American Banker": "americanbanker.com", "Baltimore Sun": "baltimoresun.com", "Barron's": "barrons.com", + "Bendigo Advertiser": "bendigoadvertiser.com.au", "Bloomberg": "bloomberg.com", "Bloomberg Quint (free articles only)": "bloombergquint.com", "Business Insider": "businessinsider.com", @@ -20,6 +21,7 @@ "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", @@ -49,6 +51,7 @@ "Herald Sun": "heraldsun.com.au", "Het Financieel Dagblad": "fd.nl", "Inc.com": "inc.com", + "Illawarra Mercury": "illawarramercury.com.au", "Kleine Zeitung": "kleinezeitung.at", "L'Écho": "lecho.be", "La Nación": "lanacion.com.ar", @@ -108,12 +111,14 @@ "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", @@ -133,12 +138,14 @@ "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 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",