summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firefox/README.md28
-rw-r--r--firefox/data/free_haaretz.css6
-rw-r--r--firefox/doc/main.md0
-rw-r--r--firefox/free-haaretz.xpibin0 -> 7298 bytes
-rw-r--r--firefox/lib/main.js33
-rw-r--r--firefox/package.json13
-rw-r--r--firefox/test/test-main.js12
7 files changed, 92 insertions, 0 deletions
diff --git a/firefox/README.md b/firefox/README.md
new file mode 100644
index 0000000..f8953d2
--- /dev/null
+++ b/firefox/README.md
@@ -0,0 +1,28 @@
+# Free Haaretz (Firefox Edition)
+
+A nefarious Firefox add-on that easily bypasses the Haaretz paywall.
+
+If things aren't working as expected, make sure to reinstall (update) the add-on from time to time, to make sure you have the latest code.
+
+(Looking for the [Chrome version](https://github.com/yuvadm/free-haaretz)?)
+
+## Install
+
+ 1. Download the [add-on XPI file](https://github.com/yuvadm/free-haaretz-ff/raw/master/free-haaretz.xpi)
+
+ 2. Go to the `Tools > Add-ons` menu
+
+ 3. Click the ⚙ button on the top
+
+ 4. Choose `Install Add-on From File`
+
+ 5. Select the XPI file you downloaded
+
+ 6. Click `Install Now`
+
+
+## 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/firefox/data/free_haaretz.css b/firefox/data/free_haaretz.css
new file mode 100644
index 0000000..a2ffe9d
--- /dev/null
+++ b/firefox/data/free_haaretz.css
@@ -0,0 +1,6 @@
+section#header-reading-list {
+ display: none;
+}
+section#header-user-menu {
+ display: none;
+}
diff --git a/firefox/doc/main.md b/firefox/doc/main.md
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/firefox/doc/main.md
diff --git a/firefox/free-haaretz.xpi b/firefox/free-haaretz.xpi
new file mode 100644
index 0000000..cf67f4b
--- /dev/null
+++ b/firefox/free-haaretz.xpi
Binary files differ
diff --git a/firefox/lib/main.js b/firefox/lib/main.js
new file mode 100644
index 0000000..cd47a05
--- /dev/null
+++ b/firefox/lib/main.js
@@ -0,0 +1,33 @@
+var {Cc, Ci, Cr} = require('chrome');
+var data = require("sdk/self").data;
+var pageMod = require("sdk/page-mod");
+
+pageMod.PageMod({
+ include: "*.haaretz.co.il",
+ contentStyleFile: data.url('free_haaretz.css')
+});
+
+
+var observer = {
+ observe: function(subject, topic, data) {
+ if (topic == 'http-on-modify-request') {
+ var channel = subject.QueryInterface(Ci.nsIHttpChannel);
+ if (/haaretz\.co(m|\.il)/.test(channel.originalURI.host)) {
+ channel.setRequestHeader('User-Agent', 'Googlebot/2.1 (+http://www.googlebot.com/bot.html)', false);
+ channel.originalURI.path = channel.originalURI.path.split('?')[0];
+ }
+ if (/\/htz\/js\/bots\.js/.test(channel.originalURI.path)) {
+ subject.cancel(Cr.NS_BINDING_ABORTED);
+ }
+ if (/\/htz\/js\/resp\/header_scripts\/internal\/util\/z_adblockutil\.js/.test(channel.originalURI.path)) {
+ subject.cancel(Cr.NS_BINDING_ABORTED);
+ }
+ if (/\/htz\/js\/resp\/body_scripts\/internal\/plugins\/adblock\.js/.test(channel.originalURI.path)) {
+ subject.cancel(Cr.NS_BINDING_ABORTED);
+ }
+ }
+ }
+};
+
+var observerService = Cc['@mozilla.org/observer-service;1'].getService(Ci.nsIObserverService);
+observerService.addObserver(observer, 'http-on-modify-request', false);
diff --git a/firefox/package.json b/firefox/package.json
new file mode 100644
index 0000000..dc773f9
--- /dev/null
+++ b/firefox/package.json
@@ -0,0 +1,13 @@
+{
+ "name": "free-haaretz",
+ "title": "Free Haaretz",
+ "description": "A nefarious extension that easily bypasses the Haaretz paywall",
+ "author": "Yuval Adam",
+ "license": "Public Domain",
+ "version": "0.7.1",
+ "main": "lib/main",
+ "engines": {
+ "firefox": ">=38.0a1",
+ "fennec": ">=38.0a1"
+ }
+}
diff --git a/firefox/test/test-main.js b/firefox/test/test-main.js
new file mode 100644
index 0000000..147f98a
--- /dev/null
+++ b/firefox/test/test-main.js
@@ -0,0 +1,12 @@
+var main = require("./main");
+
+exports["test main"] = function(assert) {
+ assert.pass("Unit test running!");
+};
+
+exports["test main async"] = function(assert, done) {
+ assert.pass("async Unit test running!");
+ done();
+};
+
+require("sdk/test").run(exports);