├── README.md └── bypass-paywalls-tampermonkey.user.js /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 | 5 |

Bypass Paywalls

6 | 7 | *Bypass Paywalls is a web browser extension to help bypass paywalls for selected sites.* 8 | 9 | This is a fork from the [bypass paywalls extention for chrome and firefox](https://github.com/iamadamdev/bypass-paywalls-chrome), to use with tampermonkey. The script included can be used in tampermonkey to have almost the same functionality. 10 | 11 | You can add it quick to tampermonkey via this link: [Add to Tampermonkey](https://github.com/LegeBeker/bypass-paywalls-tampermonkey/raw/master/bypass-paywalls-tampermonkey.user.js) 12 | 13 | ### Bypass the following sites' paywalls with this extension: 14 | 15 | [Adweek](https://www.adweek.com)\ 16 | [American Banker](https://www.americanbanker.com)\ 17 | [Ámbito](https://www.ambito.com)\ 18 | [Baltimore Sun](https://www.baltimoresun.com)\ 19 | [Barron's](https://www.barrons.com)\ 20 | [Bloomberg Quint](https://www.bloombergquint.com)\ 21 | [Bloomberg](https://www.bloomberg.com)\ 22 | [Boston Globe](https://www.bostonglobe.com)\ 23 | [Brisbane Times](https://www.brisbanetimes.com.au)\ 24 | [Business Insider](https://www.businessinsider.com)\ 25 | [Caixin](https://www.caixinglobal.com)\ 26 | [Central Western Daily](https://www.centralwesterndaily.com.au)\ 27 | [Chemical & Engineering News](https://cen.acs.org)\ 28 | [Chicago Tribune](https://www.chicagotribune.com)\ 29 | [Corriere Della Sera](https://www.corriere.it)\ 30 | [Crain's Chicago Business](https://www.chicagobusiness.com)\ 31 | [Daily Press](https://www.dailypress.com)\ 32 | [De Groene Amsterdammer](https://www.groene.nl)\ 33 | [De Speld](https://speld.nl)\ 34 | [De Tijd](https://www.tijd.be)\ 35 | [De Volkskrant](https://www.volkskrant.nl)\ 36 | [DeMorgen](https://www.demorgen.be)\ 37 | [Denver Post](https://www.denverpost.com)\ 38 | [Diario Financiero](https://www.df.cl)\ 39 | [Domani](https://www.editorialedomani.it)\ 40 | [Dynamed Plus](https://www.dynamed.com)\ 41 | [El Mercurio](https://www.elmercurio.com)\ 42 | [El Pais](https://www.elpais.com)\ 43 | [El Periodico](https://www.elperiodico.com)\ 44 | [Elu24](https://www.elu24.ee)\ 45 | [Encyclopedia Britannica](https://www.britannica.com)\ 46 | [Estadão](https://www.estadao.com.br)\ 47 | [Examiner](https://www.examiner.com.au)\ 48 | [Expansión](https://www.expansion.com)\ 49 | [Financial News](https://www.fnlondon.com)\ 50 | [Financial Post](https://www.financialpost.com)\ 51 | [Financial Times](https://www.ft.com)\ 52 | [First Things](https://www.firstthings.com)\ 53 | [Foreign Policy](https://www.foreignpolicy.com)\ 54 | [Fortune](https://www.fortune.com)\ 55 | [Genomeweb](https://www.genomeweb.com)\ 56 | [Glassdoor](https://www.glassdoor.com)\ 57 | [Globes](https://www.globes.co.il)\ 58 | [Grubstreet](https://www.grubstreet.com)\ 59 | [Haaretz.co.il](https://www.haaretz.co.il)\ 60 | [Haaretz.com](https://www.haaretz.com)\ 61 | [Harper's Magazine](https://harpers.org)\ 62 | [Hartford Courant](https://www.courant.com)\ 63 | [Harvard Business Review](https://www.hbr.org)\ 64 | [Harvard Business Review China](https://www.hbrchina.org)\ 65 | [Herald Sun](https://www.heraldsun.com.au)\ 66 | [Het Financieel Dagblad](https://fd.nl)\ 67 | [History Extra](https://www.historyextra.com)\ 68 | [Humo](https://www.humo.be)\ 69 | [Il Manifesto](https://www.ilmanifesto.it)\ 70 | [Il Messaggero](https://www.ilmessaggero.it)\ 71 | [Inc.com](https://www.inc.com)\ 72 | [Interest.co.nz](https://www.interest.co.nz)\ 73 | [Investors Chronicle](https://www.investorschronicle.co.uk) 74 | [L'Écho](https://www.lecho.be)\ 75 | [L.A. Business Journal](https://labusinessjournal.com)\ 76 | [La Nación](https://www.lanacion.com.ar)\ 77 | [La Repubblica](https://www.repubblica.it)\ 78 | [La Stampa](https://www.lastampa.it)\ 79 | [La Tercera](https://www.latercera.com)\ 80 | [La Voix du Nord](https://www.lavoixdunord.fr)\ 81 | [Le Devoir](https://www.ledevoir.com)\ 82 | [Le Parisien](https://www.leparisien.fr)\ 83 | [Les Échos](https://www.lesechos.fr)\ 84 | [Loeb Classical Library](https://www.loebclassics.com)\ 85 | [London Review of Books](https://www.lrb.co.uk)\ 86 | [Los Angeles Times](https://www.latimes.com)\ 87 | [MIT Sloan Management Review](https://sloanreview.mit.edu)\ 88 | [MIT Technology Review](https://www.technologyreview.com)\ 89 | [Medium](https://www.medium.com)\ 90 | [Medscape](https://www.medscape.com)\ 91 | [Mexicon News Daily](https://mexiconewsdaily.com)\ 92 | [Mountain View Voice](https://www.mv-voice.com)\ 93 | [National Geographic](https://www.nationalgeographic.com)\ 94 | [New York Daily News](https://www.nydailynews.com)\ 95 | [NRC Handelsblad](https://www.nrc.nl)\ 96 | [NT News](https://www.ntnews.com.au)\ 97 | [National Post](https://www.nationalpost.com)\ 98 | [Neue Zürcher Zeitung](https://www.nzz.ch)\ 99 | [New York Magazine](https://www.nymag.com)\ 100 | [New Zealand Herald](https://www.nzherald.co.nz)\ 101 | [Orange County Register](https://www.ocregister.com)\ 102 | [Orlando Sentinel](https://www.orlandosentinel.com)\ 103 | [Palo Alto Online](https://www.paloaltoonline.com)\ 104 | [Parool](https://www.parool.nl)\ 105 | [Postimees](https://www.postimees.ee)\ 106 | [Quartz](https://qz.com)\ 107 | [Quora](https://www.quora.com)\ 108 | [Quotidiani Gelocal](https://quotidiani.gelocal.it)\ 109 | [Republic.ru](https://republic.ru)\ 110 | [Reuters](https://www.reuters.com)\ 111 | [San Diego Union Tribune](https://www.sandiegouniontribune.com)\ 112 | [San Francisco Chronicle](https://www.sfchronicle.com)\ 113 | [Scientific American](https://www.scientificamerican.com)\ 114 | [Seeking Alpha](https://seekingalpha.com)\ 115 | [Slate](https://slate.com)\ 116 | [SOFREP](https://sofrep.com)\ 117 | [Statista](https://www.statista.com)\ 118 | [Star Tribune](https://www.startribune.com)\ 119 | [Stuff](https://www.stuff.co.nz)\ 120 | [SunSentinel](https://www.sun-sentinel.com)\ 121 | [Tech in Asia](https://www.techinasia.com)\ 122 | [Telegraaf](https://www.telegraaf.nl)\ 123 | [The Advertiser](https://www.adelaidenow.com.au)\ 124 | [The Advocate](https://www.theadvocate.com.au)\ 125 | [The Age](https://www.theage.com.au)\ 126 | [The American Interest](https://www.the-american-interest.com)\ 127 | [The Athletic](https://www.theathletic.com)\ 128 | [The Athletic (UK)](https://www.theathletic.co.uk)\ 129 | [The Atlantic](https://www.theatlantic.com)\ 130 | [The Australian Financial Review](https://www.afr.com)\ 131 | [The Australian](https://www.theaustralian.com.au)\ 132 | [The Business Journals](https://www.bizjournals.com)\ 133 | [The Canberra Times](https://www.canberratimes.com.au)\ 134 | [The Courier](https://www.thecourier.com.au)\ 135 | [The Courier Mail](https://www.couriermail.com.au)\ 136 | [The Cut](https://www.thecut.com)\ 137 | [The Daily Telegraph](https://www.dailytelegraph.com.au)\ 138 | [The Diplomat](https://www.thediplomat.com)\ 139 | [The Economist](https://www.economist.com)\ 140 | [The Globe and Mail](https://www.theglobeandmail.com)\ 141 | [The Herald](https://www.theherald.com.au)\ 142 | [The Hindu](https://www.thehindu.com)\ 143 | [The Irish Times](https://www.irishtimes.com)\ 144 | [The Japan Times](https://www.japantimes.co.jp)\ 145 | [The Kansas City Star](https://www.kansascity.com)\ 146 | [The Mercury News](https://www.mercurynews.com)\ 147 | [The Mercury Tasmania](https://www.themercury.com.au)\ 148 | [The Morning Call](https://www.mcall.com)\ 149 | [The Nation](https://www.thenation.com)\ 150 | [The National](https://www.thenational.scot)\ 151 | [The New Statesman](https://www.newstatesman.com)\ 152 | [The New York Times](https://www.nytimes.com)\ 153 | [The New Yorker](https://www.newyorker.com)\ 154 | [The News-Gazette](https://www.news-gazette.com)\ 155 | [The Olive Press](https://www.theolivepress.es)\ 156 | [The Philadelphia Inquirer](https://www.inquirer.com)\ 157 | [The Saturday Paper](https://www.thesaturdaypaper.com.au)\ 158 | [The Seattle Times](https://www.seattletimes.com)\ 159 | [The Spectator Australia](https://www.spectator.com.au)\ 160 | [The Spectator](https://www.spectator.co.uk)\ 161 | [The Sydney Morning Herald](https://www.smh.com.au)\ 162 | [The Telegraph](https://www.telegraph.co.uk)\ 163 | [The Toronto Star](https://www.thestar.com)\ 164 | [The Wall Street Journal](https://www.wsj.com)\ 165 | [The Washington Post](https://www.washingtonpost.com)\ 166 | [The Wrap](https://www.thewrap.com)\ 167 | [TheMarker](https://www.themarker.com)\ 168 | [Times Literary Supplement](https://www.the-tls.co.uk)\ 169 | [Towards Data Science](https://www.towardsdatascience.com)\ 170 | [Trouw](https://www.trouw.nl)\ 171 | [Vanity Fair](https://www.vanityfair.com)\ 172 | [Vrij Nederland](https://www.vn.nl)\ 173 | [Vulture](https://www.vulture.com)\ 174 | [Winston-Salem Journal](https://journalnow.com)\ 175 | [Wired](https://www.wired.com)\ 176 | [Zeit Online](https://www.zeit.de) 177 | 178 | ### Sites with limited number of free articles 179 | The free article limit can normally be bypassed by removing cookies for the site.* 180 | 181 | Install the Cookie Remover extension [for Google Chrome](https://chrome.google.com/webstore/detail/cookie-remover/kcgpggonjhmeaejebeoeomdlohicfhce) or [for Mozilla Firefox](https://addons.mozilla.org/en-US/firefox/addon/cookie-remover/). Please rate it 5 stars if you find it useful. 182 | 183 | When coming across a paywall click the cookie icon to remove the cookies then refresh the page. 184 | 185 | _*May not always succeed_ 186 | 187 | ### New site requests 188 | Only large or major sites will be considered. Usually premium articles cannot be bypassed as they are behind a hard paywall. 189 | 190 | 1. Install the uBlock Origin extension if it hasn't been installed already. See if you are still getting a paywall. 191 | 2. Check if using Cookie Remover ([Google Chrome version](https://chrome.google.com/webstore/detail/cookie-remover/kcgpggonjhmeaejebeoeomdlohicfhce) or [Mozilla Firefox version](https://addons.mozilla.org/en-US/firefox/addon/cookie-remover/)) can bypass the paywall. If not, continue to the next step. 192 | 3. First search [Issues](https://github.com/iamadamdev/bypass-paywalls-chrome/issues) to see if the site has been requested already. 193 | 4. Visit an article on the site you want to bypass the paywall for and copy the article title. 194 | 5. Open up a new incognito window (Ctrl+Shift+N on Chrome) or Private window (Ctrl+Shift+P on Firefox), and paste the article title into Google. 195 | 6. Click on the same article from the Google search results page. 196 | 7. If it loads without a paywall you can [submit a request](https://github.com/iamadamdev/bypass-paywalls-chrome/issues/new/choose) and replace the entire template text with the word "Confirmed". Otherwise please do not submit an issue as this extension cannot bypass it either. 197 | 198 | ### Troubleshooting 199 | * This extension works best alongside uBlock Origin [for Google Chrome](https://chrome.google.com/webstore/detail/ublock-origin/cjpalhdlnbpafiamejdnhcphjbkeiagm) or [for Mozilla Firefox](https://addons.mozilla.org/en-US/firefox/addon/ublock-origin/). 200 | * If a site doesn't work, try turning off uBlock and refreshing. 201 | * Try clearing [cookies](https://chrome.google.com/webstore/detail/cookie-remover/kcgpggonjhmeaejebeoeomdlohicfhce). 202 | * Make sure you're running the latest version of Bypass Paywalls. 203 | * If a site is having problems try unchecking "\*General Paywall Bypass\*" in Options. 204 | * If none of these work, you can submit an issue [here](https://github.com/iamadamdev/bypass-paywalls-chrome/issues/new/choose). 205 | 206 | ### Disclaimer 207 | * This software is provided for educational purposes only and 208 | is provided "AS IS", without warranty of any kind, express or 209 | implied, including but not limited to the warranties of merchantability, 210 | fitness for a particular purpose and noninfringement. in no event shall the 211 | authors or copyright holders be liable for any claim, damages or other 212 | liability, whether in an action of contract, tort or otherwise, arising from, 213 | out of or in connection with the software or the use or other dealings in the 214 | software. 215 | -------------------------------------------------------------------------------- /bypass-paywalls-tampermonkey.user.js: -------------------------------------------------------------------------------- 1 | // ==UserScript== 2 | // @name Bypass Paywalls 3 | // @description A way to bypass paywalls for popular news sites 4 | // @author LegeBeker (https://github.com/LegeBeker), (Fork from https://github.com/iamadamdev/bypass-paywalls-chrome) 5 | // @namespace https://github.com/LegeBeker/bypass-paywalls-tampermonkey/ 6 | // @supportURL https://github.com/LegeBeker/bypass-paywalls-tampermonkey/issues 7 | // @updateURL https://github.com/LegeBeker/bypass-paywalls-tampermonkey/raw/master/bypass-paywalls-tampermonkey.user.js 8 | // @downloadURL https://github.com/LegeBeker/bypass-paywalls-tampermonkey/raw/master/bypass-paywalls-tampermonkey.user.js 9 | // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAQAAABpN6lAAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfkBhAPLAM1PCwiAAABZ0lEQVR42u3aPUoDURiG0bsBU6W2UKLrMQoWrkIY3Yu9INhaBldidBNGrJLXQhS9MYU4guM9TzkzCdyT+flIUookSZIkSVJV/nkAAAAAAABAywC9iw1srgEAAAAAAAAAbF7gd/f3PZn99vsBAAAAAAAAAPoD+PFgMvRBCAAAAAAAAADQG0DzgxAAAAAAAADg+wCTIAAAAAAAAOD/AX4ZAgAAAAAAAP4QwNACAAAAAAAAABiEAAAAAAAAAAAGIQAAmgdYVFu2Ph0+qvYuBr78ej2PJffVpoNPLzis9j4MHKBez7zktt6U8fvh48yrvTeDXv76emYl52uPznmmGWWUw7WzIzkd8Mn/1Xq6kv2s0mrLTEopuWoW4PL15NjNU5PLX2Tn7fqYNngZrHL88RZx1hjBKl19lzxq6EJ4zslXD4rtXGTZwGd/nd3NT8u9dJnlbm1A/g+3vLvM0mVSJEmSJEmSJElSo70AqgAJADOYlfQAAAAldEVYdGRhdGU6Y3JlYXRlADIwMjAtMDYtMTZUMTU6NDM6NTcrMDA6MDAT/mVIAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIwLTA2LTE2VDE1OjQzOjU3KzAwOjAwYqPd9AAAAABJRU5ErkJggg== 10 | // @run-at document-end 11 | // @version 0.1.2 12 | // @match *://*.adweek.com/* 13 | // @match *://*.ad.nl/* 14 | // @match *://*.americanbanker.com/* 15 | // @match *://*.ambito.com/* 16 | // @match *://*.baltimoresun.com/* 17 | // @match *://*.barrons.com/* 18 | // @match *://*.bloombergquint.com/* 19 | // @match *://*.bloomberg.com/* 20 | // @match *://*.bndestem.nl/* 21 | // @match *://*.bostonglobe.com/* 22 | // @match *://*.bd.nl/* 23 | // @match *://*.brisbanetimes.com.au/* 24 | // @match *://*.businessinsider.com/* 25 | // @match *://*.caixinglobal.com/* 26 | // @match *://*.centralwesterndaily.com.au/* 27 | // @match *://*.acs.org/* 28 | // @match *://*.chicagotribune.com/* 29 | // @match *://*.corriere.it/* 30 | // @match *://*.chicagobusiness.com/* 31 | // @match *://*.dailypress.com/* 32 | // @match *://*.gelderlander.nl/* 33 | // @match *://*.groene.nl/* 34 | // @match *://*.destentor.nl/* 35 | // @match *://*.speld.nl/* 36 | // @match *://*.tijd.be/* 37 | // @match *://*.volkskrant.nl/* 38 | // @match *://*.demorgen.be/* 39 | // @match *://*.denverpost.com/* 40 | // @match *://*.df.cl/* 41 | // @match *://*.editorialedomani.it/* 42 | // @match *://*.dynamed.com/* 43 | // @match *://*.ed.nl/* 44 | // @match *://*.elmercurio.com/* 45 | // @match *://*.elpais.com/* 46 | // @match *://*.elperiodico.com/* 47 | // @match *://*.elu24.ee/* 48 | // @match *://*.britannica.com/* 49 | // @match *://*.estadao.com.br/* 50 | // @match *://*.examiner.com.au/* 51 | // @match *://*.expansion.com/* 52 | // @match *://*.fnlondon.com/* 53 | // @match *://*.financialpost.com/* 54 | // @match *://*.ft.com/* 55 | // @match *://*.firstthings.com/* 56 | // @match *://*.foreignpolicy.com/* 57 | // @match *://*.fortune.com/* 58 | // @match *://*.genomeweb.com/* 59 | // @match *://*.glassdoor.com/* 60 | // @match *://*.globes.co.il/* 61 | // @match *://*.grubstreet.com/* 62 | // @match *://*.haaretz.co.il/* 63 | // @match *://*.haaretz.com/* 64 | // @match *://*.handelsblatt.com/* 65 | // @match *://*.harpers.org/* 66 | // @match *://*.courant.com/* 67 | // @match *://*.hbr.org/* 68 | // @match *://*.heraldsun.com.au/* 69 | // @match *://*.fd.nl/* 70 | // @match *://*.historyextra.com/* 71 | // @match *://*.humo.be/* 72 | // @match *://*.ilmanifesto.it/* 73 | // @match *://*.inc.com/* 74 | // @match *://*.interest.co.nz/* 75 | // @match *://*.investorschronicle.co.uk/* 76 | // @match *://*.lecho.be/* 77 | // @match *://*.labusinessjournal.com/* 78 | // @match *://*.lanacion.com.ar/* 79 | // @match *://*.repubblica.it/* 80 | // @match *://*.lastampa.it/* 81 | // @match *://*.latercera.com/* 82 | // @match *://*.lavoixdunord.fr/* 83 | // @match *://*.ledevoir.com/* 84 | // @match *://*.leparisien.fr/* 85 | // @match *://*.lesechos.fr/* 86 | // @match *://*.loebclassics.com/* 87 | // @match *://*.lrb.co.uk/* 88 | // @match *://*.latimes.com/* 89 | // @match *://*.mit.edu/* 90 | // @match *://*.technologyreview.com/* 91 | // @match *://*.medium.com/* 92 | // @match *://*.medscape.com/* 93 | // @match *://*.mexiconewsdaily.com/* 94 | // @match *://*.mv-voice.com/* 95 | // @match *://*.nationalgeographic.com/* 96 | // @match *://*.nydailynews.com/* 97 | // @match *://*.nrc.nl/* 98 | // @match *://*.ntnews.com.au/* 99 | // @match *://*.nationalpost.com/* 100 | // @match *://*.nzz.ch/* 101 | // @match *://*.nymag.com/* 102 | // @match *://*.nzherald.co.nz/* 103 | // @match *://*.ocregister.com/* 104 | // @match *://*.orlandosentinel.com/* 105 | // @match *://*.pzc.nl/* 106 | // @match *://*.paloaltoonline.com/* 107 | // @match *://*.parool.nl/* 108 | // @match *://*.postimees.ee/* 109 | // @match *://*.qz.com/* 110 | // @match *://*.quora.com/* 111 | // @match *://*.gelocal.it/* 112 | // @match *://*.republic.ru/* 113 | // @match *://*.reuters.com/* 114 | // @match *://*.sandiegouniontribune.com/* 115 | // @match *://*.sfchronicle.com/* 116 | // @match *://*.scientificamerican.com/* 117 | // @match *://*.seekingalpha.com/* 118 | // @match *://*.slate.com/* 119 | // @match *://*.sofrep.com/* 120 | // @match *://*.statista.com/* 121 | // @match *://*.startribune.com/* 122 | // @match *://*.stuff.co.nz/* 123 | // @match *://*.sun-sentinel.com/* 124 | // @match *://*.techinasia.com/* 125 | // @match *://*.telegraaf.nl/* 126 | // @match *://*.adelaidenow.com.au/* 127 | // @match *://*.theadvocate.com.au/* 128 | // @match *://*.theage.com.au/* 129 | // @match *://*.the-american-interest.com/* 130 | // @match *://*.theathletic.com/* 131 | // @match *://*.theathletic.co.uk/* 132 | // @match *://*.theatlantic.com/* 133 | // @match *://*.afr.com/* 134 | // @match *://*.theaustralian.com.au/* 135 | // @match *://*.bizjournals.com/* 136 | // @match *://*.canberratimes.com.au/* 137 | // @match *://*.thecourier.com.au/* 138 | // @match *://*.couriermail.com.au/* 139 | // @match *://*.thecut.com/* 140 | // @match *://*.dailytelegraph.com.au/* 141 | // @match *://*.thediplomat.com/* 142 | // @match *://*.economist.com/* 143 | // @match *://*.theglobeandmail.com/* 144 | // @match *://*.theherald.com.au/* 145 | // @match *://*.thehindu.com/* 146 | // @match *://*.irishtimes.com/* 147 | // @match *://*.kansascity.com/* 148 | // @match *://*.mercurynews.com/* 149 | // @match *://*.themercury.com.au/* 150 | // @match *://*.mcall.com/* 151 | // @match *://*.thenation.com/* 152 | // @match *://*.thenational.scot/* 153 | // @match *://*.newstatesman.com/* 154 | // @match *://*.nytimes.com/* 155 | // @match *://*.newyorker.com/* 156 | // @match *://*.news-gazette.com/* 157 | // @match *://*.theolivepress.es/* 158 | // @match *://*.inquirer.com/* 159 | // @match *://*.thesaturdaypaper.com.au/* 160 | // @match *://*.seattletimes.com/* 161 | // @match *://*.spectator.com.au/* 162 | // @match *://*.spectator.co.uk/* 163 | // @match *://*.smh.com.au/* 164 | // @match *://*.telegraph.co.uk/* 165 | // @match *://*.thestar.com/* 166 | // @match *://*.wsj.com/* 167 | // @match *://*.washingtonpost.com/* 168 | // @match *://*.thewrap.com/* 169 | // @match *://*.themarker.com/* 170 | // @match *://*.the-tls.co.uk/* 171 | // @match *://*.towardsdatascience.com/* 172 | // @match *://*.trouw.nl/* 173 | // @match *://*.tubantia.nl/* 174 | // @match *://*.vanityfair.com/* 175 | // @match *://*.vn.nl/* 176 | // @match *://*.vulture.com/* 177 | // @match *://*.journalnow.com/* 178 | // @match *://*.wired.com/* 179 | // @match *://*.worldpoliticsreview.com/* 180 | // @match *://*.zeit.de/* 181 | // ==/UserScript== 182 | 183 | (function () { 184 | 'use strict'; 185 | 186 | if (!matchDomain(['seekingalpha.com', 'sfchronicle.com', 'cen.acs.org', 'elmundo.es', 'scmp.com', 'nytimes.com'])) { 187 | window.localStorage.clear(); 188 | } 189 | 190 | if (matchDomain('elmercurio.com')) { 191 | if (window.location.href.toLowerCase().includes('/inversiones/')) { 192 | document.addEventListener('DOMContentLoaded', () => { 193 | const paywall = document.querySelector('#modal_limit_articulos'); 194 | const body = document.querySelector('body'); 195 | removeDOMElement(paywall); 196 | if (body.hasAttribute('class')) { body.removeAttribute('class'); } 197 | }); 198 | } 199 | } else if (matchDomain('estadao.com.br')) { 200 | setTimeout(function () { 201 | const paywall = document.querySelector('#paywall-wrapper-iframe-estadao'); 202 | const body = document.querySelector('html'); 203 | 204 | removeDOMElement(paywall); 205 | body.removeAttribute('style'); 206 | }, 300); // Delay (in milliseconds) 207 | } else if (matchDomain('rep.repubblica.it')) { 208 | window.setTimeout(function () { 209 | if (window.location.href.includes('/pwa/')) { 210 | window.location.href = window.location.href.replace('/pwa/', '/ws/detail/'); 211 | } 212 | }, 500); 213 | if (window.location.href.includes('/ws/detail/')) { 214 | const paywall = document.querySelector('.paywall'); 215 | if (paywall) { 216 | ampUnhideSubscriptionsSection(); 217 | } 218 | } 219 | } else if (matchDomain('americanbanker.com')) { 220 | const inlineGate = document.querySelector('.inline-gate'); 221 | if (inlineGate) { 222 | inlineGate.classList.remove('inline-gate'); 223 | const inlineGated = document.querySelectorAll('.inline-gated'); 224 | for (const elem of inlineGated) { elem.classList.remove('inline-gated'); } 225 | } 226 | } else if (matchDomain('telegraaf.nl')) { 227 | if (window.location.href.startsWith('https://www.telegraaf.nl/error?ref=/')) { 228 | window.location.href = window.location.href.split('&')[0].replace('error?ref=/', ''); 229 | } 230 | const articleWrapper = document.querySelector('.ArticlePageWrapper__uid'); 231 | const spotXBanner = document.querySelector('.ArticleBodyBlocks__inlineArticleSpotXBanner'); 232 | const paywall = document.querySelector('.PopupBackdrop__block'); 233 | removeDOMElement(spotXBanner, paywall); 234 | const premium = document.querySelector('.PremiumLabelWithLine__body'); 235 | const articleId = articleWrapper ? articleWrapper.innerText : '123'; 236 | const articleBodyDone = document.querySelector('#articleBody' + articleId); 237 | if (premium && !articleBodyDone) { 238 | const articleBodyOld = document.querySelector('[id^=articleBody]'); 239 | removeDOMElement(articleBodyOld); 240 | const json = document.querySelector('script[type="application/ld+json"][data-react-helmet="true"]'); 241 | if (json) { 242 | const jsonText = JSON.parse(json.text).articleBody; 243 | const articleBody = document.querySelector('section.TextArticlePage__bodyText'); 244 | if (articleBody) { 245 | const divMain = document.createElement('div'); 246 | divMain.setAttribute('id', 'articleBody' + articleId); 247 | const divElem = document.createElement('div'); 248 | divElem.setAttribute('data-element', 'articleBodyBlocks'); 249 | const textArray = jsonText.split('\n\n'); 250 | textArray.forEach(pText => { 251 | const pDiv = document.createElement('p'); 252 | pDiv.setAttribute('class', 'ArticleBodyBlocks__paragraph ArticleBodyBlocks__paragraph--nieuws'); 253 | pDiv.innerText = pText; 254 | divElem.appendChild(pDiv); 255 | }); 256 | divMain.appendChild(divElem); 257 | articleBody.appendChild(divMain); 258 | } 259 | } 260 | } 261 | } else if (matchDomain('nrc.nl')) { 262 | const paywall = document.querySelector('.paywall--topbanner'); 263 | removeDOMElement(paywall); 264 | } else if (matchDomain('washingtonpost.com')) { 265 | const leaderboard = document.querySelector('#leaderboard-wrapper'); 266 | const adverts = document.querySelectorAll('div[data-qa="article-body-ad"]'); 267 | const softwall = document.querySelector('[id^="softwall"]'); 268 | removeDOMElement(leaderboard, softwall, ...adverts); 269 | if (window.location.href.includes('/gdpr-consent/')) { 270 | const freeButton = document.querySelector('.gdpr-consent-container .continue-btn.button.free'); 271 | if (freeButton) { freeButton.click(); } 272 | window.setTimeout(function () { 273 | const gdprcheckbox = document.querySelector('.gdpr-consent-container .consent-page:not(.hide) #agree'); 274 | if (gdprcheckbox) { 275 | gdprcheckbox.checked = true; 276 | gdprcheckbox.dispatchEvent(new Event('change')); 277 | document.querySelector('.gdpr-consent-container .consent-page:not(.hide) .continue-btn.button.accept-consent').click(); 278 | } 279 | }, 300); // Delay (in milliseconds) 280 | } else { 281 | const url = window.location.href; 282 | function main(element) { 283 | removeDOMElement(element); 284 | window.location.href = url.split('?')[0] + '?outputType=amp'; 285 | } 286 | if (!url.includes('outputType=amp')) { 287 | waitDOMElement('div[id^="paywall-"]', 'DIV', main, false); 288 | } else { 289 | const subscriptionsSections = document.querySelectorAll('[subscriptions-section="content"]'); 290 | for (const subscriptionsSection of subscriptionsSections) { subscriptionsSection.removeAttribute('subscriptions-section'); } 291 | } 292 | } 293 | } else if (matchDomain('wsj.com') && !matchDomain('cn.wsj.com')) { 294 | if (window.location.href.includes('/articles/')) { 295 | const closeButton = document.querySelector('div.close-btn[role="button"]'); 296 | if (closeButton) { closeButton.click(); } 297 | } 298 | document.addEventListener('DOMContentLoaded', () => { 299 | const url = window.location.href; 300 | const snippet = document.querySelector('.snippet-promotion'); 301 | const wsjPro = document.querySelector('meta[name="page.site"][content="wsjpro"]'); 302 | if (snippet || wsjPro) { 303 | if (!window.location.hash) { 304 | if (url.includes('?')) { 305 | window.location.href = url.replace('?', '#refreshed?'); 306 | } else { window.location.href = url + '#refreshed'; } 307 | } else { window.location.href = window.location.href.replace('wsj.com', 'wsj.com/amp').replace('#refreshed', ''); } 308 | } 309 | }); 310 | } else if (matchDomain('sloanreview.mit.edu')) { 311 | const readMore = document.querySelector('.btn-read-more'); 312 | if (readMore) { 313 | readMore.click(); 314 | } 315 | } else if (matchDomain('mexiconewsdaily.com')) { 316 | window.setTimeout(function () { 317 | const popup = document.querySelector('div.pigeon-widget-prompt'); 318 | const cproOverlay = document.querySelector('.cpro-overlay'); 319 | removeDOMElement(popup, cproOverlay); 320 | }, 500); // Delay (in milliseconds) 321 | } else if (matchDomain('the-american-interest.com')) { 322 | const counter = document.getElementById('article-counter'); 323 | removeDOMElement(counter); 324 | } else if (matchDomain('nzherald.co.nz')) { 325 | const articleContent = document.querySelector('.article__content'); 326 | if (articleContent) { 327 | const articleOffer = document.querySelector('.article-offer'); 328 | if (articleOffer) { 329 | const cssSelector = articleContent.querySelectorAll('p')[5].getAttribute('class'); 330 | const hiddenNotPars = articleContent.querySelectorAll('.' + cssSelector + ':not(p)'); 331 | for (const hiddenNotPar of hiddenNotPars) { 332 | hiddenNotPar.classList.remove(cssSelector); 333 | hiddenNotPar.removeAttribute('style'); 334 | } 335 | const hiddenPars = articleContent.querySelectorAll('p.' + cssSelector); 336 | const parser = new DOMParser(); 337 | for (const hiddenPar of hiddenPars) { 338 | const parHtml = parser.parseFromString('
' + hiddenPar.innerHTML + '
', 'text/html'); 339 | const parDom = parHtml.querySelector('div'); 340 | articleContent.insertBefore(parDom, hiddenPar); 341 | } 342 | const firstSpan = document.querySelector('p > span'); 343 | if (firstSpan) { firstSpan.removeAttribute('class'); } 344 | removeDOMElement(articleOffer); 345 | } 346 | } 347 | const premiumToaster = document.querySelector('#premium-toaster'); 348 | removeDOMElement(premiumToaster); 349 | } else if (matchDomain('interest.co.nz')) { 350 | const wrapper = document.getElementById('pp-ablock-banner-wrapper'); 351 | const overlay = document.querySelector('.black-overlay'); 352 | removeDOMElement(overlay, wrapper); 353 | } else if (matchDomain('stuff.co.nz')) { 354 | const overlay = document.querySelector('.x0'); 355 | removeDOMElement(overlay); 356 | } else if (matchDomain('thenational.scot')) { 357 | const overlay = document.querySelector('.template-container'); 358 | removeDOMElement(overlay); 359 | } else if (matchDomain('thestar.com')) { 360 | setTimeout(function () { 361 | const paywall = document.querySelector('.basic-paywall-new'); 362 | removeDOMElement(paywall); 363 | const tbc = document.querySelectorAll('.text-block-container'); 364 | for (const el of tbc) { 365 | el.removeAttribute('style'); 366 | } 367 | }, 1000); // Delay (in milliseconds) 368 | } else if (matchDomain('afr.com')) { 369 | document.addEventListener('DOMContentLoaded', () => { 370 | const hiddenImage = document.querySelectorAll('img'); 371 | for (const image of hiddenImage) { 372 | const src = image.src; 373 | if ('src: ' + src.indexOf('.gif') !== -1) { 374 | const dataSrc = image.getAttribute('data-src'); 375 | if (dataSrc) { 376 | image.setAttribute('src', dataSrc); 377 | } 378 | } 379 | } 380 | const plista = document.querySelector('div[data-plista-placement="underArticle_Group"]'); 381 | removeDOMElement(plista); 382 | }); 383 | } else if (matchDomain(['parool.nl', 'trouw.nl', 'volkskrant.nl', 'demorgen.be', 'humo.be'])) { 384 | document.addEventListener('DOMContentLoaded', () => { 385 | const topBanner = document.querySelector('div[data-temptation-position="PAGE_TOP"]'); 386 | const paywall = document.querySelector('div[data-temptation-position="ARTICLE_BOTTOM"]'); 387 | const hiddenSection = document.querySelector('div[data-temptation-position="ARTICLE_INLINE"]'); 388 | const overlay = document.querySelector('div[data-temptation-position="PAGE_BOTTOM"]'); 389 | removeDOMElement(topBanner, paywall, hiddenSection, overlay); 390 | }); 391 | } else if (matchDomain('firstthings.com')) { 392 | const paywall = document.getElementsByClassName('paywall')[0]; 393 | removeDOMElement(paywall); 394 | } else if (matchDomain('bloomberg.com')) { 395 | blockElement('#graphics-paywall-overlay', true); 396 | } else if (matchDomain('bloombergquint.com')) { 397 | const articlesLeftModal = document.getElementsByClassName('paywall-meter-module__story-paywall-container__1UgCE')[0]; 398 | const paywall = document.getElementById('paywallDmp'); 399 | removeDOMElement(articlesLeftModal, paywall); 400 | } else if (matchDomain('medium.com') || document.querySelector('script[src^="https://cdn-client.medium.com/"]')) { 401 | const paywall = document.querySelector('div#paywall-background-color'); 402 | removeDOMElement(paywall); 403 | if (paywall) { 404 | extensionApi.runtime.sendMessage({ request: 'refreshCurrentTab' }); 405 | } 406 | window.setTimeout(function () { 407 | const meter = document.querySelector('[id*="highlight-meter-"]'); 408 | if (meter) { 409 | meter.hidden = true; 410 | } 411 | }, 500); // Delay (in milliseconds) 412 | } else if (matchDomain('theglobeandmail.com')) { 413 | const articleBodySubscribed = document.querySelector('.c-article-body--subscribed'); 414 | if (articleBodySubscribed) { 415 | articleBodySubscribed.removeAttribute('class'); 416 | } 417 | } else if (matchDomain(['examiner.com.au', 'thecourier.com.au', 'theadvocate.com.au'])) { 418 | const subscribeTruncate = document.querySelector('.subscribe-truncate'); 419 | if (subscribeTruncate) { subscribeTruncate.classList.remove('subscribe-truncate'); } 420 | const subscriberHider = document.querySelectorAll('.subscriber-hider'); 421 | for (const el of subscriberHider) { 422 | el.classList.remove('subscriber-hider'); 423 | } 424 | } else if (matchDomain('canberratimes.com.au')) { 425 | const paywall = document.querySelector('.subscribe-article.news-article-body.article__body'); 426 | paywall.classList.remove('subscribe-article'); 427 | const subscribe = document.getElementsByClassName('subscriber-container')[0]; 428 | removeDOMElement(subscribe); 429 | const content = document.getElementsByClassName('subscriber-hider'); 430 | for (const el of content) { 431 | el.classList.remove('subscriber-hider'); 432 | } 433 | } else if (matchDomain('ledevoir.com')) { 434 | const counter = document.querySelector('.full.hidden-print.popup-msg'); 435 | removeDOMElement(counter); 436 | } else if (matchDomain('ft.com')) { 437 | const cookieBanner = document.querySelector('.o-banner__outer'); 438 | const ribbon = document.querySelector('.js-article-ribbon'); 439 | const ads = document.querySelector('.o-ads'); 440 | removeDOMElement(cookieBanner, ads, ribbon); 441 | } else if (matchDomain('thehindu.com')) { 442 | document.addEventListener('DOMContentLoaded', () => { 443 | const counter = document.querySelector('#test'); 444 | const coBanner = document.querySelector('.co-banner'); 445 | const support = document.querySelector('div.support-jlm'); 446 | removeDOMElement(counter, coBanner, support); 447 | }); 448 | } else if (matchDomain('nytimes.com')) { 449 | const banners = document.querySelectorAll('div[data-testid="inline-message"], div[id^="ad-"], div.expanded-dock, div.pz-ad-box'); 450 | removeDOMElement(...banners); 451 | } else if (matchDomain('technologyreview.com')) { 452 | window.setTimeout(function () { 453 | const bodyObscured = document.querySelector('body[class*="body__obscureContent"]'); 454 | if (bodyObscured) { removeClassesByPrefix(bodyObscured, 'body__obscureContent'); } 455 | const overlay = document.querySelector('div[class*="overlayFooter__wrapper"]'); 456 | if (overlay) { overlay.setAttribute('style', 'display:none'); } 457 | const contentBodyHidden = document.querySelector('div[class*="contentBody__contentHidden"]'); 458 | if (contentBodyHidden) { removeClassesByPrefix(contentBodyHidden, 'contentBody__contentHidden'); } 459 | const contentBodyOverlay = document.querySelector('div[class*="contentBody__overlay"]'); 460 | if (contentBodyOverlay) { contentBodyOverlay.removeAttribute('class'); } 461 | }, 500); 462 | } else if (matchDomain('leparisien.fr')) { 463 | window.removeEventListener('scroll', this.scrollListener); 464 | const paywall = document.querySelector('.relative.piano-paywall.below_nav.sticky'); 465 | removeDOMElement(paywall); 466 | setTimeout(function () { 467 | const content = document.getElementsByClassName('content'); 468 | for (const el of content) { 469 | el.removeAttribute('style'); 470 | } 471 | }, 300); // Delay (in milliseconds) 472 | } else if (matchDomain('caixinglobal.com')) { 473 | const payTips = document.querySelectorAll('.cons-pay-tip'); 474 | for (const payTip of payTips) { 475 | payTip.removeAttribute('style'); 476 | } 477 | const appContent = document.getElementById('appContent'); 478 | if (appContent) { 479 | const pHidden = document.querySelectorAll('p:not([style="display:block;"]'); 480 | for (const el of pHidden) { 481 | el.setAttribute('style', 'display:block;'); 482 | } 483 | } 484 | } else if (matchDomain('bizjournals.com')) { 485 | const sheetOverlay = document.querySelector('.sheet-overlay'); 486 | const chunkPaywall = document.querySelector('.chunk--paywall'); 487 | removeDOMElement(sheetOverlay, chunkPaywall); 488 | const overlaid = document.querySelectorAll('.is-overlaid'); 489 | for (const el of overlaid) { 490 | el.classList.remove('is-overlaid'); 491 | } 492 | const bodyHidden = document.querySelector('.js-pre-chunks__story-body'); 493 | bodyHidden.removeAttribute('style'); 494 | } else if (matchDomain('the-tls.co.uk')) { 495 | const paywall = document.querySelector('.tls-subscriptions-banner__closed-skin'); 496 | removeDOMElement(paywall); 497 | } else if (matchDomain('cen.acs.org')) { 498 | const paywall = document.querySelector('.meteredBar'); 499 | removeDOMElement(paywall); 500 | } else if (matchDomain('elperiodico.com')) { 501 | setTimeout(function () { 502 | const unavailableArea = document.querySelector('.closed'); 503 | const infoBox = document.querySelector('.ep-masPeriodico-info'); 504 | if (unavailableArea) { 505 | unavailableArea.classList.remove('closed'); 506 | } 507 | if (infoBox) { 508 | infoBox.parentNode.removeChild(infoBox); 509 | } 510 | }, 1000); 511 | } else if (matchDomain('techinasia.com')) { 512 | const paywall = document.querySelector('.paywall-content'); 513 | if (paywall) { 514 | paywall.classList.remove('paywall-content'); 515 | } 516 | const splashSubscribe = document.querySelector('.splash-subscribe'); 517 | const paywallHard = document.querySelector('.paywall-hard'); 518 | removeDOMElement(splashSubscribe, paywallHard); 519 | } else if (matchDomain('thewrap.com')) { 520 | const embed = document.querySelector('.embed'); 521 | if (embed) { 522 | // Display feature video 523 | const container = document.querySelector('.featured-image-container'); 524 | removeDOMElement(container); 525 | embed.classList.remove('d-none'); 526 | } 527 | } else if (matchDomain('hbr.org')) { 528 | const banner = document.querySelector('.persistent-banner'); 529 | removeDOMElement(banner); 530 | } else if (matchDomain('spectator.co.uk')) { 531 | const banner = document.querySelector('#subscribe-ribbon'); 532 | removeDOMElement(banner); 533 | } else if (matchDomain('barrons.com')) { 534 | const url = window.location.href; 535 | if (!url.includes('barrons.com/amp/')) { 536 | const bodyContinuous = document.querySelector('body.is-continuous'); 537 | const snippet = document.querySelector('meta[content="snippet"]'); 538 | if (bodyContinuous && snippet) { 539 | removeDOMElement(snippet); 540 | window.location.href = url.replace('barrons.com', 'barrons.com/amp'); 541 | } 542 | const signinLinks = document.querySelectorAll('a.primary-button--link[href*="target="]'); 543 | for (const signinLink of signinLinks) { 544 | signinLink.href = decodeURIComponent(signinLink.href.split('target=')[1]).split('?')[0]; 545 | signinLink.text = 'Click'; 546 | } 547 | const barronsAds = document.querySelectorAll('.barrons-body-ad-placement'); 548 | removeDOMElement(...barronsAds); 549 | } else { 550 | const preview = document.querySelector('section[subscriptions-section="content-not-granted"]'); 551 | removeDOMElement(preview); 552 | const subscrSection = document.querySelector('section[subscriptions-section="content"]'); 553 | if (subscrSection) { 554 | subscrSection.removeAttribute('subscriptions-section'); 555 | } 556 | } 557 | removeDOMElement(document.querySelector('.login-section-container')); 558 | } else if (matchDomain('nzz.ch')) { 559 | const paywall = document.querySelector('.dynamic-regwall'); 560 | removeDOMElement(paywall); 561 | } else if (matchDomain('irishtimes.com')) { 562 | document.addEventListener('DOMContentLoaded', () => { 563 | const stubArticleMsg = document.querySelector('div.stub-article-msg'); 564 | const url = window.location.href; 565 | if (url.includes('mode=sample') || stubArticleMsg) { window.location.href = new URL(url).pathname + '?mode=amp'; } 566 | }); 567 | } else if (matchDomain('thesaturdaypaper.com.au')) { 568 | const paywall = document.querySelector('div.paywall-hard-always-show'); 569 | removeDOMElement(paywall); 570 | } else if (matchDomain('lesechos.fr') && window.location.href.match(/-\d{6,}/)) { 571 | window.setTimeout(function () { 572 | const aboBanner = document.querySelector('[class^="pgxf3b"]'); 573 | const adBlocks = document.querySelectorAll('[class*="jzxvkd"'); 574 | for (const adBlock of adBlocks) { adBlock.setAttribute('style', 'display:none'); } 575 | if (aboBanner) { 576 | removeDOMElement(aboBanner); 577 | const url = window.location.href; 578 | const html = document.documentElement.outerHTML; 579 | let state; 580 | const split1 = html.split('window.__PRELOADED_STATE__=')[1]; 581 | const split2 = split1.split('')[0].trim(); 582 | if (split2.includes('; window.__DATA__=')) { state = split2.split('; window.__DATA__=')[0].trim(); } else { state = split2.substr(0, split2.length - 1); } 583 | try { 584 | const data = JSON.parse(state); 585 | const article = data.article.data.stripes[0].mainContent[0].data.description; 586 | const urlLoaded = data.article.data.path; 587 | if (!url.includes(urlLoaded)) { window.location.reload(true); } 588 | const paywallNode = document.querySelector('.post-paywall'); 589 | if (paywallNode) { 590 | const contentNode = document.createElement('div'); 591 | const parser = new DOMParser(); 592 | const articleHtml = parser.parseFromString('
' + article + '
', 'text/html'); 593 | const articlePar = articleHtml.querySelector('div'); 594 | if (articlePar) { 595 | contentNode.appendChild(articlePar); 596 | contentNode.className = paywallNode.className; 597 | paywallNode.parentNode.insertBefore(contentNode, paywallNode); 598 | removeDOMElement(paywallNode); 599 | const paywallLastChildNode = document.querySelector('.post-paywall > :last-child'); 600 | if (paywallLastChildNode) { 601 | paywallLastChildNode.setAttribute('style', 'height: auto !important; overflow: hidden !important; max-height: none !important;'); 602 | } 603 | } 604 | } 605 | const styleElem = document.head.appendChild(document.createElement('style')); 606 | styleElem.innerHTML = '.post-paywall::after {height: auto !important;}'; 607 | } catch (err) { 608 | window.location.reload(true); 609 | } 610 | } 611 | }, 500); // Delay (in milliseconds) 612 | } else if (matchDomain('startribune.com')) { 613 | // remove active class from all elements 614 | document.querySelectorAll('div.ReactModalPortal').forEach(function (el) { 615 | removeDOMElement(el); 616 | }); 617 | // Enable Scroll. Reveal Hiddlen Paragraph 618 | document.getElementsByTagName('body')[0].removeAttribute('class'); 619 | } else if (matchDomain('seattletimes.com')) { 620 | window.setTimeout(function () { 621 | // remove modal class from all elements 622 | document.querySelectorAll('div.modal').forEach(function (el) { 623 | removeDOMElement(el); 624 | }); 625 | // Remove Blurred Style from all matching Divs 626 | document.getElementById('container').removeAttribute('style'); 627 | document.querySelectorAll('div[style~="filter"]').forEach(function (el) { 628 | el.removeAttribute('style'); 629 | }); 630 | document 631 | .querySelectorAll('div[class~="NewsletterSignupSplash"]') 632 | .forEach(function (el) { 633 | el.removeAttribute('class'); 634 | }); 635 | }, 1000); // Delay (in milliseconds) 636 | } else if (matchDomain('theatlantic.com')) { 637 | // Remove all nudge elements 638 | document.querySelectorAll('div[class*="c-nudge"]').forEach(function (el) { 639 | removeDOMElement(el); 640 | }); 641 | // Remove all FancyBox ads 642 | document.querySelectorAll('div[class*="fancybox"]').forEach(function (el) { 643 | removeDOMElement(el); 644 | }); 645 | } else if (matchDomain(['theathletic.com', 'theathletic.co.uk'])) { 646 | window.setInterval(function () { 647 | const paywall = document.querySelector('#slideup-paywall'); 648 | const darken = document.querySelector('#darken-overlay'); 649 | if (paywall && darken) { 650 | removeDOMElement(paywall); 651 | removeDOMElement(darken); 652 | window.clearInterval(); 653 | } 654 | }, 100); 655 | 656 | const styleElement = document.createElement('style'); 657 | 658 | const cssRules = ` 659 | .noscroll { 660 | overflow: auto !important; 661 | height: auto !important; 662 | width: auto !important; 663 | position: static !important; 664 | } 665 | `; 666 | 667 | styleElement.innerHTML = cssRules; 668 | document.head.appendChild(styleElement); 669 | 670 | if (!window.location.href.includes('?amp')) { 671 | const paywall = document.querySelectorAll('div#paywall-container, div[subscriptions-action="subscribe"], a.headline-paywall'); 672 | const amphtml = document.querySelector('link[rel="amphtml"]'); 673 | if (paywall.length && amphtml) { 674 | removeDOMElement(...paywall); 675 | window.setTimeout(function () { 676 | window.location.href = amphtml.href; 677 | }, 500); 678 | } 679 | } else { 680 | ampUnhideSubscriptionsSection(); 681 | const subscriptionsActions = document.querySelectorAll('[subscriptions-actions]'); 682 | removeDOMElement(...subscriptionsActions); 683 | } 684 | } else if (matchDomain('newyorker.com')) { 685 | blockElement('.paywall-bar', true); 686 | blockElement('.paywall-modal'); 687 | } else if (matchDomain('vanityfair.com')) { 688 | const paywall = document.querySelector('.paywall-bar'); 689 | removeDOMElement(paywall); 690 | } else if (matchDomain(['postimees.ee', 'elu24.ee'])) { 691 | setTimeout(function () { 692 | // Remove 'adblocker-detected' footer notification 693 | const adblockNotif = document.querySelector('.ad-block-notification-overlay'); 694 | removeDOMElement(adblockNotif); 695 | document.body.removeAttribute('style'); 696 | }, 800); // Delay (in milliseconds) 697 | } else if (matchDomain('theolivepress.es')) { 698 | const modalBackdrop = document.querySelector('.modal-backdrop'); 699 | const paywall = document.querySelector('.ev-open-modal-paywall-REQUIRE_LOGIN_WITH_ENTITLEMENT'); 700 | removeDOMElement(modalBackdrop, paywall); 701 | 702 | for (const clazz of ['ev-modals', 'modal-open']) { 703 | document.body.classList.remove(clazz); 704 | } 705 | } else if (matchDomain('themarker.com')) { 706 | setTimeout(function () { 707 | const paywall = document.querySelector('[data-test="bottomStrip"]'); 708 | const notifications = document.querySelector('#pwSubscribePopup'); 709 | const banner = document.querySelector('#themarker\\.com\\.billboard\\.desktop'); 710 | const newsBanner = document.querySelector('#themarker\\.com\\.news\\.banner'); 711 | const midBanner = document.querySelector('#themarker\\.com.headline\\.banner\\.desktop'); 712 | const financeBanner = document.querySelector('#themarker\\.com\\.finance\\.banner'); 713 | const topStrip = document.querySelector('[data-test="topStrip"]'); 714 | const otherBanners = Array.from(document.querySelectorAll('[data-audtarget]')); 715 | removeDOMElement(paywall, notifications, banner, topStrip, midBanner, newsBanner, financeBanner, ...otherBanners); 716 | }, 500); 717 | } else if (matchDomain('haaretz.co.il')) { 718 | setTimeout(function () { 719 | const notifications = document.querySelector('#pwSubscribePopup'); 720 | const paywall = document.querySelector('[data-test="bottomStrip"]'); 721 | const banner = document.querySelector('#haaretz\\.co\\.il\\.billboard\\.desktop'); 722 | const editorsBanner = document.querySelector('#haaretz\\.co\\.il\\.editors\\.banner'); 723 | const headlinesBanner = document.querySelector('#haaretz\\.co\\.il\\.headline\\.box\\.desktop'); 724 | const topStrip = document.querySelector('[data-test="topStrip"]'); 725 | const otherBanners = Array.from(document.querySelectorAll('[data-audtarget]')); 726 | removeDOMElement(paywall, notifications, banner, editorsBanner, topStrip, headlinesBanner, ...otherBanners); 727 | }, 500); 728 | } else if (matchDomain('sueddeutsche.de')) { 729 | const url = window.location.href; 730 | document.addEventListener('DOMContentLoaded', () => { 731 | const offerPage = document.querySelector('div.offer-page'); 732 | if (url.startsWith('https://www.sueddeutsche.de') && (url.includes('reduced=true') || offerPage)) { window.location.href = url.split('?')[0].replace('www.', 'amphtml.'); } else if (url.startsWith('https://sz-magazin.sueddeutsche.de')) { 733 | if (url.includes('reduced=true') || offerPage) { window.location.href = new URL(url).pathname + '!amp'; } 734 | } 735 | }); 736 | window.setTimeout(function () { 737 | if (url.includes('!amp')) { 738 | const paragraphReduced = document.querySelector('.paragraph--reduced'); 739 | if (paragraphReduced) { paragraphReduced.classList.remove('paragraph--reduced'); } 740 | const paragraphHidden = document.querySelectorAll('.paragraph--hidden'); 741 | for (const parHidden of paragraphHidden) { parHidden.classList.remove('paragraph--hidden'); } 742 | const paragraphDynamic = document.querySelector('.paragraph--dynamic'); 743 | if (paragraphDynamic) { paragraphDynamic.classList.remove('paragraph--dynamic'); } 744 | const ampOfferpage = document.querySelector('.amp-offerpage'); 745 | removeDOMElement(ampOfferpage); 746 | } 747 | }, 500); // Delay (in milliseconds) 748 | } else if (matchDomain('adweek.com')) { 749 | const bodySingle = document.querySelector('body.single'); 750 | const ampHtml = document.querySelector('link[rel="amphtml"]'); 751 | if (bodySingle && ampHtml) { 752 | bodySingle.classList.remove('single'); 753 | window.location.href = ampHtml.href; 754 | } 755 | } else if (matchDomain('gelocal.it')) { 756 | if (!window.location.href.includes('/amp/')) { 757 | const paywallAdagio = document.querySelector('.paywall-adagio'); 758 | removeDOMElement(paywallAdagio); 759 | } else { 760 | const paywall = document.querySelector('div[amp-access="showContent"]'); 761 | if (paywall) { paywall.removeAttribute('amp-access-hide'); } 762 | const ampAds = document.querySelectorAll('amp-ad'); 763 | removeDOMElement(...ampAds); 764 | } 765 | } else if (matchDomain('elmundo.es')) { 766 | const premium = document.querySelector('.ue-c-article__premium'); 767 | const url = window.location.href; 768 | if (!url.includes('/amp.' + 'elmundo.es' + '/')) { 769 | if (premium) { 770 | removeDOMElement(premium); 771 | window.location.href = window.location.href.replace('/www.', '/amp.'); 772 | } 773 | } else { 774 | const paywall = document.querySelector('div[amp-access="authorized!=true"]'); 775 | if (paywall) { 776 | removeDOMElement(paywall); 777 | const divHidden = document.querySelector('div[amp-access="authorized=true"]'); 778 | if (divHidden) { 779 | divHidden.removeAttribute('amp-access-hide'); 780 | } 781 | } 782 | const advertising = document.querySelectorAll('.advertising, amp-embed'); 783 | removeDOMElement(...advertising); 784 | } 785 | } else if (matchDomain('speld.nl')) { 786 | const paywallPopup = document.querySelector('.c-paywall-notice'); 787 | removeDOMElement(paywallPopup); 788 | } else if (matchDomain('lastampa.it')) { 789 | const url = window.location.href; 790 | if (!url.includes('/amp/')) { 791 | const premium = document.querySelector('.paywall-adagio'); 792 | removeDOMElement(premium); 793 | window.setTimeout(function () { 794 | if (premium) { 795 | window.location.href = url.split('?')[0] + '/amp/'; 796 | } 797 | const articleBody = document.querySelector('div#article-body[style]'); 798 | if (articleBody) { 799 | articleBody.removeAttribute('style'); 800 | } 801 | }, 500); 802 | } else { 803 | const paywall = document.querySelector('div[id^="paywall-banner"]'); 804 | removeDOMElement(paywall); 805 | const subscriptionSection = document.querySelector('[subscriptions-section="content"]'); 806 | if (subscriptionSection) { 807 | subscriptionSection.removeAttribute('subscriptions-section'); 808 | const preview = document.querySelector('div[subscriptions-section="content-not-granted"]'); 809 | removeDOMElement(preview); 810 | } 811 | const ampAds = document.querySelectorAll('amp-ad, amp-embed'); 812 | removeDOMElement(...ampAds); 813 | } 814 | } else if (matchDomain('time.com')) { 815 | const body = document.querySelector('body'); 816 | if (body) { 817 | body.setAttribute('style', 'position:relative !important;'); 818 | } 819 | } else if (matchDomain('expansion.com')) { 820 | const premium = document.querySelector('.ue-c-article__premium'); 821 | const url = window.location.href; 822 | if (!url.includes('/amp.' + 'expansion.com' + '/')) { 823 | if (premium) { 824 | removeDOMElement(premium); 825 | window.location.href = window.location.href.replace('/www.', '/amp.'); 826 | } 827 | } else { 828 | const paywall = document.querySelector('div[amp-access="authorized!=true"]'); 829 | if (paywall) { 830 | removeDOMElement(paywall); 831 | const divHidden = document.querySelector('div[amp-access="authorized=true"]'); 832 | if (divHidden) { 833 | divHidden.removeAttribute('amp-access-hide'); 834 | } 835 | } 836 | const advertising = document.querySelectorAll('.advertising, amp-embed'); 837 | removeDOMElement(...advertising); 838 | } 839 | } else if (matchDomain('chicagobusiness.com')) { 840 | const body = document.querySelector('body[class]'); 841 | if (body) { 842 | body.removeAttribute('class'); 843 | } 844 | } else if (matchDomain('latimes.com')) { 845 | const paywall = document.querySelector('metering-modal'); 846 | const incognitoWall = document.querySelector('metering-toppanel'); 847 | if (paywall) { 848 | removeDOMElement(paywall); 849 | } else if (incognitoWall) { 850 | removeDOMElement(incognitoWall); 851 | } 852 | if (paywall || incognitoWall) { 853 | document.body.removeAttribute('style'); 854 | } 855 | } else if (matchDomain('foreignpolicy.com')) { 856 | const contentUngated = document.querySelector('div.content-ungated'); 857 | removeDOMElement(contentUngated); 858 | const contentGated = document.querySelector('div.content-gated'); 859 | if (contentGated) { 860 | contentGated.classList.remove('content-gated'); 861 | } 862 | } else if (matchDomain('bostonglobe.com')) { 863 | // Remove the portion covering the paywall 864 | const paywall = document.querySelector('div.meter-paywall'); 865 | if (paywall) { 866 | removeDOMElement(paywall); 867 | } 868 | // Re-enable scrolling 869 | const body = document.querySelector('body'); 870 | if (body) { 871 | document.body.removeAttribute('style'); 872 | } 873 | // Click the button to reveal the rest of the article 874 | const buttonDiv = document.querySelector('[id="continue_button"]'); 875 | if (buttonDiv) { 876 | const button = buttonDiv.querySelector('button'); 877 | if (button) { 878 | button.click(); 879 | } 880 | } 881 | } else if (matchDomain('nationalgeographic.com')) { 882 | // prevent modal from showing up, then remove scroll-locking, and article blur 883 | new window.MutationObserver(function (mutations) { 884 | for (const mutation of mutations) { 885 | for (const node of mutation.addedNodes) { 886 | if (node instanceof window.HTMLElement) { 887 | if (node.matches('#fittPortal_0')) { 888 | removeDOMElement(node); 889 | const body = document.body; 890 | body.removeAttribute('class'); 891 | body.removeAttribute('style'); 892 | body.removeAttribute('overflow'); 893 | const blur = document.querySelector('#natgeo-template1-frame-1-module-1 > div > div > section > article > section > div.Article__Content__Overlay--gated'); 894 | if (blur) removeDOMElement(blur); 895 | 896 | this.disconnect(); // Stop watching for element being added after one removal 897 | } 898 | } 899 | } 900 | } 901 | }).observe(document, { subtree: true, childList: true }); 902 | } else if (matchDomain('hbrchina.org')) { 903 | const hiddenDiv = document.querySelector('div#the_content'); 904 | if (hiddenDiv) { 905 | hiddenDiv.removeAttribute('style'); 906 | } 907 | } else if (matchDomain('scmp.com')) { 908 | if (window.location.href.includes('/amp.')) { 909 | const divHidden = document.querySelectorAll('div.article-body[amp-access][amp-access-hide]'); 910 | for (const elem of divHidden) { 911 | elem.removeAttribute('amp-access-hide'); 912 | } 913 | const defaultMeters = document.querySelectorAll('div.default-meter, div#archive-article-meter'); 914 | const ads = document.querySelectorAll('amp-ad, div.ad-banner, div.advert-fly-carpet-container, div.inline-advert'); 915 | removeDOMElement(...defaultMeters, ...ads); 916 | } 917 | } else if (matchDomain('fortune.com')) { 918 | const paywalledArticle = document.querySelector('.paywall.paywallActive'); 919 | if (paywalledArticle) { 920 | for (const clazz of ['paywall', 'paywallActive']) { 921 | paywalledArticle.classList.remove(clazz); 922 | } 923 | } 924 | } 925 | 926 | function matchDomain(domains) { 927 | const hostname = window.location.hostname; 928 | if (typeof domains === 'string') { domains = [domains]; } 929 | return domains.some(domain => hostname === domain || hostname.endsWith('.' + domain)); 930 | } 931 | 932 | function waitDOMElement(selector, tagName = '', callback, multiple = false) { 933 | new window.MutationObserver(function (mutations) { 934 | for (const mutation of mutations) { 935 | for (const node of mutation.addedNodes) { 936 | if (!tagName || (node.tagName === tagName)) { 937 | if (node.matches(selector)) { 938 | callback(node); 939 | if (!multiple) { this.disconnect(); } 940 | } 941 | } 942 | } 943 | } 944 | }).observe(document, { 945 | subtree: true, 946 | childList: true 947 | }); 948 | } 949 | 950 | function removeDOMElement(...elements) { 951 | for (const element of elements) { 952 | if (element) { element.remove(); } 953 | } 954 | } 955 | 956 | function removeClassesByPrefix(el, prefix) { 957 | for (const clazz of el.classList) { 958 | if (clazz.startsWith(prefix)) { 959 | el.classList.remove(clazz); 960 | } 961 | } 962 | } 963 | 964 | // Prevent element from being added the first time to the DOM 965 | function blockElement(selector, blockAlways = false) { 966 | new window.MutationObserver(function (mutations) { 967 | for (const mutation of mutations) { 968 | for (const node of mutation.addedNodes) { 969 | if (node instanceof window.HTMLElement) { 970 | if (node.matches(selector)) { 971 | removeDOMElement(node); 972 | if (!blockAlways) { 973 | this.disconnect(); // Stop watching for element being added after one removal 974 | } 975 | } 976 | } 977 | } 978 | } 979 | }).observe(document, { subtree: true, childList: true }); 980 | } 981 | 982 | function ampUnhideSubscriptionsSection(ampAdsSel = 'amp-ad, .ad') { 983 | const preview = document.querySelector('[subscriptions-section="content-not-granted"]'); 984 | removeDOMElement(preview); 985 | const subscriptionsSection = document.querySelectorAll('[subscriptions-section="content"]'); 986 | for (const elem of subscriptionsSection) { 987 | elem.removeAttribute('subscriptions-section'); 988 | } 989 | const ampAds = document.querySelectorAll(ampAdsSel); 990 | removeDOMElement(...ampAds); 991 | } 992 | 993 | const restrictions = { 994 | 'adweek.com': /^((?!\.adweek\.com\/(.+\/)?(amp|agencyspy|tvnewser|tvspy)\/).)*$/, 995 | 'barrons.com': /.+\.barrons\.com\/(amp\/)?article(s)?\/.+/, 996 | 'economist.com': /.+economist\.com\/.+\/\d{1,4}\/\d{1,2}\/\d{2}\/.+/, 997 | 'seekingalpha.com': /.+seekingalpha\.com\/article\/.+/, 998 | 'techinasia.com': /\.techinasia\.com\/.+/, 999 | 'ft.com': /.+\.ft.com\/content\//, 1000 | 'nytimes.com': /^((?!\/timesmachine\.nytimes\.com\/).)*$/ 1001 | }; 1002 | 1003 | // Don't remove cookies before page load 1004 | const allowCookies = [ 1005 | 'brisbanetimes.com.au', 1006 | 'canberratimes.com.au', 1007 | 'cen.acs.org', 1008 | 'demorgen.be', 1009 | 'denverpost.com', 1010 | 'examiner.com.au', 1011 | 'gelocal.it', 1012 | 'grubstreet.com', 1013 | 'harpers.org', 1014 | 'hbr.org', 1015 | 'humo.be', 1016 | 'lesechos.fr', 1017 | 'lrb.co.uk', 1018 | 'medium.com', 1019 | 'mercurynews.com', 1020 | 'newstatesman.com', 1021 | 'nrc.nl', 1022 | 'nymag.com', 1023 | 'ocregister.com', 1024 | 'parool.nl', 1025 | 'qz.com', 1026 | 'scientificamerican.com', 1027 | 'seattletimes.com', 1028 | 'seekingalpha.com', 1029 | 'sofrep.com', 1030 | 'spectator.co.uk', 1031 | 'speld.nl', 1032 | 'techinasia.com', 1033 | 'telegraaf.nl', 1034 | 'the-american-interest.com', 1035 | 'theadvocate.com.au', 1036 | 'theage.com.au', 1037 | 'theatlantic.com', 1038 | 'theaustralian.com.au', 1039 | 'thecut.com', 1040 | 'thediplomat.com', 1041 | 'themercury.com.au', 1042 | 'towardsdatascience.com', 1043 | 'trouw.nl', 1044 | 'vn.nl', 1045 | 'volkskrant.nl', 1046 | 'vulture.com', 1047 | 'nzz.ch', 1048 | 'thehindu.com', 1049 | 'financialpost.com', 1050 | 'haaretz.co.il', 1051 | 'haaretz.com', 1052 | 'themarker.com', 1053 | 'sueddeutsche.de', 1054 | 'gelocal.it', 1055 | 'elmundo.es', 1056 | 'time.com', 1057 | 'zeit.de', 1058 | 'expansion.com', 1059 | 'dailytelegraph.com.au', 1060 | 'washingtonpost.com' 1061 | ]; 1062 | 1063 | // Removes cookies after page load 1064 | const removeCookies = [ 1065 | 'bloomberg.com', 1066 | 'bloombergquint.com', 1067 | 'brisbanetimes.com.au', 1068 | 'canberratimes.com.au', 1069 | 'cen.acs.org', 1070 | 'demorgen.be', 1071 | 'denverpost.com', 1072 | 'examiner.com.au', 1073 | 'globes.co.il', 1074 | 'grubstreet.com', 1075 | 'harpers.org', 1076 | 'hbr.org', 1077 | 'humo.be', 1078 | 'lesechos.fr', 1079 | 'mercurynews.com', 1080 | 'newstatesman.com', 1081 | 'nrc.nl', 1082 | 'nymag.com', 1083 | 'ocregister.com', 1084 | 'qz.com', 1085 | 'scientificamerican.com', 1086 | 'seattletimes.com', 1087 | 'sofrep.com', 1088 | 'spectator.co.uk', 1089 | 'speld.nl', 1090 | 'telegraaf.nl', 1091 | 'theadvocate.com.au', 1092 | 'theage.com.au', 1093 | 'theatlantic.com', 1094 | 'thecut.com', 1095 | 'thediplomat.com', 1096 | 'towardsdatascience.com', 1097 | 'vn.nl', 1098 | 'vulture.com', 1099 | 'wsj.com', 1100 | 'medium.com', 1101 | 'washingtonpost.com', 1102 | 'japantimes.co.jp', 1103 | 'nytimes.com' 1104 | ]; 1105 | 1106 | // Contains remove cookie sites above plus any custom sites 1107 | let _removeCookies = removeCookies; 1108 | 1109 | // select specific cookie(s) to hold from removeCookies domains 1110 | const removeCookiesSelectHold = { 1111 | 'qz.com': ['gdpr'], 1112 | 'wsj.com': ['wsjregion'], 1113 | 'seattletimes.com': ['st_newsletter_splash_seen'] 1114 | }; 1115 | 1116 | // select only specific cookie(s) to drop from removeCookies domains 1117 | const removeCookiesSelectDrop = { 1118 | 'ambito.com': ['TDNotesRead'], 1119 | 'demorgen.be': ['TID_ID'], 1120 | 'fd.nl': ['socialread'], 1121 | 'humo.be': ['TID_ID'], 1122 | 'nrc.nl': ['counter'], 1123 | 'speld.nl': ['speld-paywall'] 1124 | }; 1125 | 1126 | // Override User-Agent with Googlebot 1127 | const useGoogleBotSites = [ 1128 | 'adelaidenow.com.au', 1129 | 'barrons.com', 1130 | 'couriermail.com.au', 1131 | 'fd.nl', 1132 | 'genomeweb.com', 1133 | 'heraldsun.com.au', 1134 | 'lavoixdunord.fr', 1135 | 'ntnews.com.au', 1136 | 'quora.com', 1137 | 'seekingalpha.com', 1138 | 'telegraph.co.uk', 1139 | 'theaustralian.com.au', 1140 | 'themercury.com.au', 1141 | 'thenational.scot', 1142 | 'wsj.com', 1143 | 'kansascity.com', 1144 | 'republic.ru', 1145 | 'nzz.ch', 1146 | 'df.cl', 1147 | 'ft.com', 1148 | 'wired.com', 1149 | 'zeit.de' 1150 | ]; 1151 | 1152 | // Override User-Agent with Bingbot 1153 | const useBingBot = []; 1154 | 1155 | const useMsnBot = [ 1156 | 'haaretz.co.il', 1157 | 'haaretz.com', 1158 | 'themarker.com' 1159 | ]; 1160 | 1161 | // Contains google bot sites above plus any custom sites 1162 | let _useGoogleBotSites = useGoogleBotSites; 1163 | 1164 | function setDefaultOptions() { 1165 | extensionApi.storage.sync.set({ 1166 | sites: defaultSites 1167 | }, function () { 1168 | extensionApi.runtime.openOptionsPage(); 1169 | }); 1170 | } 1171 | 1172 | // Block external scripts 1173 | const blockedRegexes = { 1174 | 'adweek.com': /.+\.lightboxcdn\.com\/.+/, 1175 | 'afr.com': /afr\.com\/assets\/vendorsReactRedux_client.+\.js/, 1176 | 'businessinsider.com': /(.+\.tinypass\.com\/.+|cdn\.onesignal\.com\/sdks\/.+\.js)/, 1177 | 'chicagotribune.com': /.+:\/\/.+\.tribdss\.com\//, 1178 | 'economist.com': /(.+\.tinypass\.com\/.+|economist\.com\/engassets\/_next\/static\/chunks\/framework.+\.js)/, 1179 | 'editorialedomani.it': /(js\.pelcro\.com\/.+|editorialedomani.it\/pelcro\.js)/, 1180 | 'foreignpolicy.com': /(cdn\.cxense\.com\/|\.tinypass\.com\/)/, 1181 | 'fortune.com': /.+\.tinypass\.com\/.+/, 1182 | 'haaretz.co.il': /haaretz\.co\.il\/htz\/js\/inter\.js/, 1183 | 'haaretz.com': /haaretz\.com\/hdc\/web\/js\/minified\/header-scripts-int.js.+/, 1184 | 'inquirer.com': /.+\.tinypass\.com\/.+/, 1185 | 'lastampa.it': /.+\.repstatic\.it\/minify\/sites\/lastampa\/.+\/config\.cache\.php\?name=social_js/, 1186 | 'lrb.co.uk': /.+\.tinypass\.com\/.+/, 1187 | 'medscape.com': /.+\.medscapestatic\.com\/.*medscape-library\.js/, 1188 | 'interest.co.nz': /(.+\.presspatron\.com.+|.+interest\.co\.nz.+pp-ablock-banner\.js)/, 1189 | 'repubblica.it': /scripts\.repubblica\.it\/pw\/pw\.js.+/, 1190 | 'spectator.co.uk': /.+\.tinypass\.com\/.+/, 1191 | 'spectator.com.au': /.+\.tinypass\.com\/.+/, 1192 | 'telegraph.co.uk': /.+telegraph\.co\.uk.+martech.+/, 1193 | 'thecourier.com.au': /.+cdn-au\.piano\.io\/api\/tinypass.+\.js/, 1194 | 'thenation.com': /thenation\.com\/.+\/paywall-script\.php/, 1195 | 'thenational.scot': /(.+\.tinypass\.com\/.+|.+thenational\.scot.+omniture\.js|.+thenational\.scot.+responsive-sync.+)/, 1196 | 'thewrap.com': /thewrap\.com\/.+\/wallkit\.js/, 1197 | 'wsj.com': /cdn\.ampproject\.org\/v\d\/amp-access-.+\.js/, 1198 | 'historyextra.com': /.+\.evolok\.net\/.+\/authorize\/.+/, 1199 | 'barrons.com': /cdn\.ampproject\.org\/v\d\/amp-access-.+\.js/, 1200 | 'irishtimes.com': /cdn\.ampproject\.org\/v\d\/amp-access-.+\.js/, 1201 | 'elmercurio.com': /(merreader\.emol\.cl\/assets\/js\/merPramV2.js|staticmer\.emol\.cl\/js\/inversiones\/PramModal.+\.js)/, 1202 | 'sloanreview.mit.edu': /(.+\.tinypass\.com\/.+|.+\.netdna-ssl\.com\/wp-content\/themes\/smr\/assets\/js\/libs\/welcome-ad\.js)/, 1203 | 'latercera.com': /.+\.cxense\.com\/+/, 1204 | 'lesechos.fr': /.+\.tinypass\.com\/.+/, 1205 | 'thehindu.com': /ajax\.cloudflare\.com\/cdn-cgi\/scripts\/.+\/cloudflare-static\/rocket-loader\.min\.js/, 1206 | 'technologyreview.com': /.+\.blueconic\.net\/.+/, 1207 | 'spectator.us': /(cdn\.cxense\.com\/.+|\.tinypass\.com\/.+)/, 1208 | 'gelocal.it': /(\.repstatic\.it\/minify\/sites\/gelocal\/.+\/config\.cache(_\d)?\.php|cdn\.ampproject\.org\/v\d\/amp-(access|ad)-.+\.js)/, 1209 | 'elmundo.es': /cdn\.ampproject\.org\/v\d\/amp-(access|ad|consent)-.+\.js/, 1210 | 'time.com': /\/time\.com\/dist\/meter-wall-client-js\..+\.js/, 1211 | 'thestar.com': /\.com\/api\/overlaydata/, 1212 | 'elpais.com': /(\.epimg\.net\/js\/.+\/(noticia|user)\.min\.js|\/elpais\.com\/arc\/subs\/p\.min\.js|cdn\.ampproject\.org\/v\d\/amp-(access|(sticky-)?ad|consent)-.+\.js)/, 1213 | 'expansion.com': /cdn\.ampproject\.org\/v\d\/amp-(access|ad|consent)-.+\.js/, 1214 | 'chicagobusiness.com': /(\.tinypass\.com\/|\.chicagobusiness\.com\/.+\/js\/js_.+\.js)/, 1215 | 'dailytelegraph.com.au': /cdn\.ampproject\.org\/v\d\/amp-(access|ad|consent)-.+\.js/, 1216 | 'theglobeandmail.com': /(\.theglobeandmail\.com\/pf\/dist\/engine\/react\.js|smartwall\.theglobeandmail\.com\/)/, 1217 | 'nytimes.com': /(\.nytimes\.com\/meter\.js|mwcm\.nyt\.com\/.+\.js|cooking\.nytimes\.com\/api\/.+\/access)/, 1218 | 'latimes.com': /(metering\.platform\.latimes\.com\/|cdn\.ampproject\.org\/v\d\/amp-(access|subscriptions)-.+\.js)/, 1219 | 'theathletic.com': /cdn\.ampproject\.org\/v\d\/amp-(access|subscriptions)-.+\.js/, 1220 | 'japantimes.co.jp': /cdn\.cxense\.com\//, 1221 | 'scmp.com': /(\.tinypass\.com\/|cdn\.ampproject\.org\/v\d\/amp-access-.+\.js)/, 1222 | 'ilmessaggero.it': /(utils\.cedsdigital\.it\/js\/PaywallMeter\.js)/, 1223 | 'washingtonpost.com': /\.washingtonpost\.com\/tetro\/metering\/evaluate/ 1224 | }; 1225 | 1226 | const userAgentDesktop = 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)'; 1227 | const userAgentMobile = 'Chrome/41.0.2272.96 Mobile Safari/537.36 (compatible ; Googlebot/2.1 ; +http://www.google.com/bot.html)'; 1228 | const userAgentDesktopBingBot = 'Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)'; 1229 | const userAgentMobileBingBot = 'Chrome/80.0.3987.92 Mobile Safari/537.36 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)'; 1230 | const userAgentMsnBot = 'msnbot/2.0b (+http://search.msn.com/msnbot.htm)'; 1231 | 1232 | let enabledSites = []; 1233 | 1234 | // Get the enabled sites 1235 | extensionApi.storage.sync.get({ 1236 | sites: {}, 1237 | customSites: [] 1238 | }, function (items) { 1239 | enabledSites = Object.values(items.sites).concat(items.customSites); 1240 | 1241 | // Use googlebot UA for custom sites 1242 | _useGoogleBotSites = useGoogleBotSites.concat(items.customSites); 1243 | 1244 | // Remove cookies for custom sites 1245 | _removeCookies = removeCookies.concat(items.customSites); 1246 | 1247 | if (extensionApi === chrome) { 1248 | initGA(); 1249 | } 1250 | }); 1251 | 1252 | // Listen for changes to options 1253 | extensionApi.storage.onChanged.addListener(function (changes, namespace) { 1254 | if (changes.sites && changes.sites.newValue) { 1255 | const sites = changes.sites.newValue; 1256 | enabledSites = Object.values(sites); 1257 | } 1258 | }); 1259 | 1260 | // Set and show default options on install 1261 | extensionApi.runtime.onInstalled.addListener(function (details) { 1262 | if (details.reason === 'install') { 1263 | setDefaultOptions(); 1264 | } else if (details.reason === 'update') { 1265 | // User updated extension 1266 | } 1267 | }); 1268 | 1269 | extensionApi.tabs.onUpdated.addListener(function (tabId, info, tab) { 1270 | updateBadge(tab); 1271 | }); 1272 | extensionApi.tabs.onActivated.addListener(function (activeInfo) { 1273 | extensionApi.tabs.get(activeInfo.tabId, updateBadge); 1274 | }); 1275 | 1276 | function updateBadge(activeTab) { 1277 | if (extensionApi.runtime.lastError || !activeTab) { return; } 1278 | const badgeText = getBadgeText(activeTab.url); 1279 | extensionApi.browserAction.setBadgeBackgroundColor({ color: 'blue' }); 1280 | extensionApi.browserAction.setBadgeText({ text: badgeText }); 1281 | } 1282 | 1283 | function getBadgeText(currentUrl) { 1284 | return currentUrl && isSiteEnabled({ url: currentUrl }) ? 'ON' : ''; 1285 | } 1286 | 1287 | // AMP redirect for dailytelegraph.com.au 1288 | extensionApi.webRequest.onBeforeRequest.addListener(function (details) { 1289 | if (!isSiteEnabled(details)) { 1290 | return; 1291 | } 1292 | const updatedUrl = decodeURIComponent(details.url.split('&dest=')[1].split('&')[0]).replace('www.', 'amp.'); 1293 | return { redirectUrl: updatedUrl }; 1294 | }, 1295 | { urls: ['*://www.dailytelegraph.com.au/subscribe/*'], types: ['main_frame'] }, 1296 | ['blocking'] 1297 | ); 1298 | 1299 | // nytimes.com 1300 | extensionApi.webRequest.onHeadersReceived.addListener(function (details) { 1301 | if (!isSiteEnabled(details)) { 1302 | return; 1303 | } 1304 | let headers = details.responseHeaders; 1305 | headers = headers.map(function (header) { 1306 | if (header.name === 'x-frame-options') { header.value = 'SAMEORIGIN'; } 1307 | return header; 1308 | }); 1309 | return { 1310 | responseHeaders: headers 1311 | }; 1312 | }, { 1313 | urls: ['*://*.nytimes.com/*'] 1314 | }, 1315 | ['blocking', 'responseHeaders']); 1316 | 1317 | // Disable javascript for these sites 1318 | extensionApi.webRequest.onBeforeRequest.addListener(function (details) { 1319 | const headerReferer = details.originUrl ? details.originUrl : details.initiator; 1320 | if (!isSiteEnabled(details) && (!enabledSites.includes('generalpaywallbypass') || matchUrlDomain('japantimes.co.jp', headerReferer))) { 1321 | return; 1322 | } 1323 | return { cancel: true }; 1324 | }, 1325 | { 1326 | urls: [ 1327 | '*://*.newstatesman.com/*', 1328 | '*://*.outbrain.com/*', 1329 | '*://*.piano.io/*', 1330 | '*://*.poool.fr/*', 1331 | '*://*.qiota.com/*', 1332 | '*://*.tinypass.com/*' 1333 | ], 1334 | types: ['script'] 1335 | }, 1336 | ['blocking'] 1337 | ); 1338 | 1339 | const extraInfoSpec = ['blocking', 'requestHeaders']; 1340 | if (Object.prototype.hasOwnProperty.call(extensionApi.webRequest.OnBeforeSendHeadersOptions, 'EXTRA_HEADERS')) { 1341 | extraInfoSpec.push('extraHeaders'); 1342 | } 1343 | 1344 | extensionApi.webRequest.onBeforeSendHeaders.addListener(function (details) { 1345 | let requestHeaders = details.requestHeaders; 1346 | 1347 | let headerReferer = ''; 1348 | for (const n in requestHeaders) { 1349 | if (requestHeaders[n].name.toLowerCase() === 'referer') { 1350 | headerReferer = requestHeaders[n].value; 1351 | continue; 1352 | } 1353 | } 1354 | 1355 | // check for blocked regular expression: domain enabled, match regex, block on an internal or external regex 1356 | const blockedDomains = Object.keys(blockedRegexes); 1357 | const domain = matchUrlDomain(blockedDomains, headerReferer); 1358 | if (domain && details.url.match(blockedRegexes[domain]) && isSiteEnabled({ url: headerReferer })) { 1359 | return { cancel: true }; 1360 | } 1361 | 1362 | if (!isSiteEnabled(details) && !matchUrlDomain('cdn.ampproject.org', details.url)) { 1363 | return; 1364 | } 1365 | 1366 | const tabId = details.tabId; 1367 | let useUserAgentMobile = false; 1368 | let setReferer = false; 1369 | 1370 | // if referer exists, set it to google 1371 | requestHeaders = requestHeaders.map(function (requestHeader) { 1372 | if (requestHeader.name === 'Referer') { 1373 | if (details.url.includes('cooking.nytimes.com/api/v1/users/bootstrap')) { 1374 | // this fixes images not being loaded on cooking.nytimes.com main page 1375 | // referrer has to be *nytimes.com otherwise returns 403 1376 | requestHeader.value = 'https://cooking.nytimes.com'; 1377 | } else if (matchUrlDomain('fd.nl', details.url)) { 1378 | requestHeader.value = 'https://www.facebook.com/'; 1379 | } else if (matchUrlDomain('medium.com', details.url)) { 1380 | requestHeader.value = 'https://t.co/x?amp=1'; 1381 | } else { 1382 | requestHeader.value = 'https://www.google.com/'; 1383 | } 1384 | setReferer = true; 1385 | } 1386 | if (requestHeader.name === 'User-Agent') { 1387 | useUserAgentMobile = requestHeader.value.toLowerCase().includes('mobile'); 1388 | } 1389 | 1390 | return requestHeader; 1391 | }); 1392 | 1393 | // otherwise add it 1394 | if (!setReferer) { 1395 | if (matchUrlDomain('fd.nl', details.url)) { 1396 | requestHeaders.push({ 1397 | name: 'Referer', 1398 | value: 'https://www.facebook.com/' 1399 | }); 1400 | } else if (matchUrlDomain('medium.com', details.url)) { 1401 | requestHeaders.push({ 1402 | name: 'Referer', 1403 | value: 'https://t.co/x?amp=1' 1404 | }); 1405 | } else { 1406 | requestHeaders.push({ 1407 | name: 'Referer', 1408 | value: 'https://www.google.com/' 1409 | }); 1410 | } 1411 | } 1412 | 1413 | // override User-Agent to use Googlebot 1414 | const useGoogleBot = _useGoogleBotSites.some(function (item) { 1415 | return typeof item === 'string' && matchUrlDomain(item, details.url); 1416 | }); 1417 | 1418 | if (useGoogleBot) { 1419 | requestHeaders.push({ 1420 | name: 'User-Agent', 1421 | value: useUserAgentMobile ? userAgentMobile : userAgentDesktop 1422 | }); 1423 | requestHeaders.push({ 1424 | name: 'X-Forwarded-For', 1425 | value: '66.249.66.1' 1426 | }); 1427 | } 1428 | 1429 | // override User-Agent to use Bingbot 1430 | if (matchUrlDomain(useBingBot, details.url)) { 1431 | requestHeaders.push({ 1432 | name: 'User-Agent', 1433 | value: useUserAgentMobile ? userAgentMobileBingBot : userAgentDesktopBingBot 1434 | }); 1435 | } 1436 | 1437 | // override User-Agent to use Google AdsBot Mobile Web 1438 | if (matchUrlDomain(useMsnBot, details.url)) { 1439 | requestHeaders.push({ 1440 | name: 'User-Agent', 1441 | value: userAgentMsnBot 1442 | }); 1443 | } 1444 | 1445 | // remove cookies before page load 1446 | const enabledCookies = allowCookies.some(function (site) { 1447 | return matchUrlDomain(site, details.url); 1448 | }); 1449 | if (!enabledCookies) { 1450 | requestHeaders = requestHeaders.map(function (requestHeader) { 1451 | if (requestHeader.name === 'Cookie') { 1452 | requestHeader.value = ''; 1453 | } 1454 | return requestHeader; 1455 | }); 1456 | } 1457 | 1458 | if (tabId !== -1) { 1459 | extensionApi.tabs.get(tabId, function (currentTab) { 1460 | // Validate url of current tab to avoid injecting script to unrelated sites 1461 | if (currentTab && currentTab.url && isSiteEnabled(currentTab)) { 1462 | // run contentScript inside tab 1463 | extensionApi.tabs.executeScript(tabId, { 1464 | file: 'src/js/contentScript.js', 1465 | runAt: 'document_start' 1466 | }, function (res) { 1467 | if (extensionApi.runtime.lastError || res[0]) { 1468 | 1469 | } 1470 | }); 1471 | } 1472 | }); 1473 | } 1474 | 1475 | return { requestHeaders: requestHeaders }; 1476 | }, { 1477 | urls: [''] 1478 | }, extraInfoSpec); 1479 | 1480 | // remove cookies after page load 1481 | extensionApi.webRequest.onCompleted.addListener(function (details) { 1482 | let domainToRemove; 1483 | for (const domain of _removeCookies) { 1484 | if (enabledSites.includes(domain) && matchUrlDomain(domain, details.url)) { 1485 | domainToRemove = domain; 1486 | break; 1487 | } 1488 | } 1489 | if (domainToRemove) { 1490 | extensionApi.cookies.getAll({ domain: domainToRemove }, function (cookies) { 1491 | for (const ck of cookies) { 1492 | const cookie = { 1493 | url: (ck.secure ? 'https://' : 'http://') + ck.domain + ck.path, 1494 | name: ck.name, 1495 | storeId: ck.storeId 1496 | }; 1497 | // .firstPartyDomain = undefined on Chrome (doesn't support it) 1498 | if (ck.firstPartyDomain !== undefined) { 1499 | cookie.firstPartyDomain = ck.firstPartyDomain; 1500 | } 1501 | const cookieDomain = ck.domain; 1502 | const rcDomain = cookieDomain.replace(/^(\.?www\.|\.)/, ''); 1503 | // hold specific cookie(s) from removeCookies domains 1504 | if ((rcDomain in removeCookiesSelectHold) && removeCookiesSelectHold[rcDomain].includes(ck.name)) { 1505 | continue; // don't remove specific cookie 1506 | } 1507 | // drop only specific cookie(s) from removeCookies domains 1508 | if ((rcDomain in removeCookiesSelectDrop) && !(removeCookiesSelectDrop[rcDomain].includes(ck.name))) { 1509 | continue; // only remove specific cookie 1510 | } 1511 | extensionApi.cookies.remove(cookie); 1512 | } 1513 | }); 1514 | } 1515 | }, { 1516 | urls: [''] 1517 | }); 1518 | 1519 | // Google Analytics to anonymously track DAU (Chrome only) 1520 | function initGA() { 1521 | (function (i, s, o, g, r, a, m) { 1522 | i.GoogleAnalyticsObject = r; 1523 | i[r] = i[r] || function () { 1524 | (i[r].q = i[r].q || []).push(arguments); 1525 | }, i[r].l = 1 * new Date(); 1526 | a = s.createElement(o), m = s.getElementsByTagName(o)[0]; 1527 | a.async = 1; 1528 | a.src = g; 1529 | m.parentNode.insertBefore(a, m); 1530 | })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga'); 1531 | ga('create', 'UA-69824169-2', 'auto'); 1532 | ga('set', 'checkProtocolTask', null); 1533 | ga('set', 'anonymizeIp', true); 1534 | ga('send', 'pageview'); 1535 | } 1536 | 1537 | function isSiteEnabled(details) { 1538 | const enabledSite = matchUrlDomain(enabledSites, details.url); 1539 | if (enabledSite in restrictions) { 1540 | return restrictions[enabledSite].test(details.url); 1541 | } 1542 | return !!enabledSite; 1543 | } 1544 | 1545 | function matchUrlDomain(domains, url) { 1546 | return matchDomain(domains, urlHost(url)); 1547 | } 1548 | 1549 | function matchDomain(domains, hostname) { 1550 | let matchedDomain = false; 1551 | if (!hostname) { hostname = window.location.hostname; } 1552 | if (typeof domains === 'string') { domains = [domains]; } 1553 | domains.some(domain => (hostname === domain || hostname.endsWith('.' + domain)) && (matchedDomain = domain)); 1554 | return matchedDomain; 1555 | } 1556 | 1557 | function urlHost(url) { 1558 | if (url && url.startsWith('http')) { 1559 | try { 1560 | return new URL(url).hostname; 1561 | } catch (e) { 1562 | console.log(`url not valid: ${url} error: ${e}`); 1563 | } 1564 | } 1565 | return url; 1566 | } 1567 | })(); 1568 | --------------------------------------------------------------------------------