summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuval Adam <yuval@y3xz.com>2016-04-03 23:47:48 +0300
committerYuval Adam <yuval@y3xz.com>2016-04-03 23:47:48 +0300
commitf312e9ad94b4b53aa032c90e3f54cbbd9aa777e5 (patch)
tree82530eb019189c82e08e43ba6734805993e8372a
parentb1ed0c1556621ff459a9edf96af91c467b2c6ea8 (diff)
parent918474c60bac639209f3de4497200580f482f71c (diff)
Merge chrome into chrome/
-rw-r--r--chrome/README.md33
-rw-r--r--chrome/free_haaretz.css6
-rw-r--r--chrome/free_haaretz.js61
-rw-r--r--chrome/manifest.json22
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.
+
+![Public Domain](https://i.creativecommons.org/p/mark/1.0/88x31.png)
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/"
+ ]
+}