JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
addthis_faker chromium extension
authorJason Woofenden <jason@jasonwoof.com>
Thu, 6 Oct 2011 01:27:26 +0000 (21:27 -0400)
committerJason Woofenden <jason@jasonwoof.com>
Thu, 6 Oct 2011 01:27:26 +0000 (21:27 -0400)
addthis_faker/addthis_faker.js [new file with mode: 0644]
addthis_faker/manifest.json [new file with mode: 0644]

diff --git a/addthis_faker/addthis_faker.js b/addthis_faker/addthis_faker.js
new file mode 100644 (file)
index 0000000..b9dbd1a
--- /dev/null
@@ -0,0 +1,11 @@
+// whitehouse.gov won't load with addthis.com blocked. Fix that
+
+function add_fake_addthis_script() {
+       // document.write("<script type=\"text/javascript\"><\/script>");
+       var script_tag = document.createElement('script');
+       var script_source = 'addthis = {button: function(){}};';
+       var script_text_node = document.createTextNode(script_source);
+       script_tag.appendChild(script_text_node);
+       document.head.appendChild(script_tag);
+}
+document.addEventListener("DOMContentLoaded", add_fake_addthis_script, true);
diff --git a/addthis_faker/manifest.json b/addthis_faker/manifest.json
new file mode 100644 (file)
index 0000000..2af6440
--- /dev/null
@@ -0,0 +1,13 @@
+{
+   "content_scripts": [ {
+      "exclude_globs": [  ],
+      "include_globs": [ "https://wwws.whitehouse.gov/*" ],
+      "js": [ "addthis_faker.js" ],
+      "matches": [ "http://*/*", "https://*/*" ],
+      "run_at": "document_start"
+   } ],
+   "converted_from_user_script": false,
+   "description": "Make a fake addthis so broken sites like whitehouse.gov will work",
+   "name": "addthis_faker",
+   "version": "2.2"
+}