diff options
Diffstat (limited to 'chrome')
| -rw-r--r-- | chrome/README.md | 33 | ||||
| -rw-r--r-- | chrome/free_haaretz.css | 6 | ||||
| -rw-r--r-- | chrome/free_haaretz.js | 61 | ||||
| -rw-r--r-- | chrome/manifest.json | 22 |
4 files changed, 122 insertions, 0 deletions
diff --git a/chrome/README.md b/chrome/README.md new file mode 100644 index 0000000..c6c7c07 --- /dev/null +++ b/chrome/README.md @@ -0,0 +1,33 @@ +# Free Haaretz + +A nefarious Chrome extension that easily bypasses the Haaretz paywall. + +If things aren't working as expected, make sure to reinstall (update) the extension from time to time, to make sure you have the latest code. + +(Looking for the [Firefox version](https://github.com/yuvadm/free-haaretz-ff)?) + +## Install + +This extension can't be installed via the Google App Store since I couldn't care less about paying $5.00 and registering to work with it. + +You can follow these steps to install manually: + + 1. Download the [extension ZIP file](https://github.com/yuvadm/free-haaretz/archive/master.zip), also located on the right side bar. + + 2. Unzip the file. + + 3. In Google Chrome (or Chromium), in the address bar go to [chrome://extensions](chrome://extensions) + + 4. In the top right corner, click to enable **Developer Mode**. + + 5. Click the **Load unpacked extension** button. + + 6. Navigate to the folder you unziped your code to, and select it. + + 7. The **FreeHaaretz** extension should now be loaded + +## License + +This code is in the Public Domain, do whatever you want with it, I'm not responsible. + + diff --git a/chrome/free_haaretz.css b/chrome/free_haaretz.css new file mode 100644 index 0000000..2329aa5 --- /dev/null +++ b/chrome/free_haaretz.css @@ -0,0 +1,6 @@ +section#header-reading-list { + display: none; +} +section#header-user-menu { + display: none; +}
\ No newline at end of file diff --git a/chrome/free_haaretz.js b/chrome/free_haaretz.js new file mode 100644 index 0000000..bce3207 --- /dev/null +++ b/chrome/free_haaretz.js @@ -0,0 +1,61 @@ +chrome.webRequest.onBeforeRequest.addListener( + function (details) { + var url_parts = details.url.split('?'); + if (url_parts[1]) { + return { + redirectUrl: url_parts[0] + } + } + }, + { + urls: [ + 'http://*.haaretz.co.il/*', + 'http://*.haaretz.com/*', + ] + }, + [ + 'blocking', + ] +); + +var addresses = [ + 'http://hrz.haaretz.co.il/bots.js', + 'http://www.haaretz.co.il/htz/js/bots.js', + 'http://www.haaretz.co.il/htz/js/resp/body_scripts/internal/plugins/adblock.js', + 'http://www.haaretz.co.il/htz/js/resp/header_scripts/internal/util/z_adblockutil.js' +]; + + +chrome.webRequest.onBeforeSendHeaders.addListener( + function (details) { + for (var i = 0; i < details.requestHeaders.length; ++i) { + if (details.requestHeaders[i].name === 'User-Agent') { + details.requestHeaders[i].value = 'Googlebot/2.1 (+http://www.googlebot.com/bot.html)'; + break; + } + } + + if (addresses.indexOf(details.url) > -1) { + return { + requestHeaders: details.requestHeaders, + url: 'http://www.haaretz.co.il/htz/js/botzzzz.js' + } + } + + return { + requestHeaders: details.requestHeaders + }; + }, + { + urls: [ + 'http://*.haaretz.co.il/*', + 'http://*.haaretz.com/*', + ] + }, + [ + 'blocking', + 'requestHeaders' + ] +); + + diff --git a/chrome/manifest.json b/chrome/manifest.json new file mode 100644 index 0000000..6af4816 --- /dev/null +++ b/chrome/manifest.json @@ -0,0 +1,22 @@ +{ + "name": "FreeHaaretz", + "version": "0.7.1", + "manifest_version": 2, + "description": "A nefarious extension that easily bypasses the Haaretz paywall", + "homepage_url": "http://yuvadm.github.io/free-haaretz", + "background": { + "scripts": ["free_haaretz.js"], + "persistent": true + }, + "content_scripts": [{ + "matches": ["*://*.haaretz.co.il/*"], + "css": ["free_haaretz.css"] + }], + "permissions": [ + "contentSettings", + "webRequest", + "webRequestBlocking", + "http://*.haaretz.co.il/", + "http://*.haaretz.com/" + ] +} |
