DescentBB
http://www.descentbb.net/

I'm proud to announce my first chrome extension!
http://www.descentbb.net/viewtopic.php?f=7&t=21578
Page 1 of 1

Author:  Isaac [ Thu Sep 25, 2014 5:19 pm ]
Post subject:  I'm proud to announce my first chrome extension!

What's it do? Temporarily disable javascript on a page you're going enter, by right clicking and selecting an option to open the link without javascript allowed on that page. If you realize you want javascript, close the tab and open the link again and javascript will return!

https://chrome.google.com/webstore/deta ... iccfohbnmh

Here's all the source code that runs it:

manifest.json
Code:
{ "manifest_version": 2, "name": "Right-click no actions", "description": "Right click any URL to open it without javascript. Close the tab and reopen to undo effect", "version": "1.5.1", "permissions": [ "contextMenus", "tabs", "contentSettings" ], "background": { "scripts": ["noaction.js"] } }



Javascript:
Code:

   var link=""
   var pattern=""

function linkOnClick(info, tab) {
   r = /:\/\/(.[^/]+)/;
   link=info.linkUrl
   pattern="http://"+link.match(r)[1]+"/*"

   chrome.contentSettings.javascript.set(
      {'primaryPattern':pattern,
      'setting': "block",
      'scope':'regular'},
      function(){
         window.open(link)
         chrome.contentSettings.javascript.set({
         'primaryPattern':pattern,
         'setting': "allow",
         'scope':'regular'
         })
      });
   }

   chrome.contextMenus.create({title: "Load with no Javascript", contexts:["link"], onclick: linkOnClick});


Works like a charm!

Page 1 of 1 All times are UTC-06:00
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/