User:Eleanorg/Thematic1.1/control opacity using jQuery plugin: Difference between revisions

From XPUB & Lens-Based wiki
No edit summary
 
Line 1: Line 1:
This Chrome plugin changes the opacity of web pages with a single line of jQuery. Eventually the extension will be plugged into my python script, which will return a dynamic opacity value based on the number of hops in that webpage's traceroute.
This Chrome plugin changes the opacity of web pages with a single line of jQuery. Eventually the extension will be plugged into [[User:Eleanorg/Thematic1.1/Make hops into % | my python script]], which will return a dynamic opacity value based on the number of hops in that webpage's traceroute.


It follows the basic Chrome extension pattern of being made up of a manifest.json file (containing metadata) and a .js file containing the actual code. In this case, jQuery is also stored locally in jquery.js.
It follows the basic Chrome extension pattern of being made up of a manifest.json file (containing metadata) and a .js file containing the actual code. In this case, jQuery is also stored locally in jquery.js.

Latest revision as of 19:36, 10 December 2011

This Chrome plugin changes the opacity of web pages with a single line of jQuery. Eventually the extension will be plugged into my python script, which will return a dynamic opacity value based on the number of hops in that webpage's traceroute.

It follows the basic Chrome extension pattern of being made up of a manifest.json file (containing metadata) and a .js file containing the actual code. In this case, jQuery is also stored locally in jquery.js.

contentscript.js

 $("body").css({ opacity: 0.2 });

manifest.json

Note that jQuery is stored locally as jquery.js, and this file points to the actual code which is stored in contentscript.js:

{
  "name": "traceroute1",
  "version": "1.0",
  "description": "changes the opacity of web pages",
  "browser_action": {
    "default_icon": "icon.png"
  },
  "permissions": ["history"],
  "content_scripts": [
    {
      "matches": ["*://*/*"],
      "js": ["jquery.js", "contentscript.js"],
      "run_at": "document_end"
    }
  ]
}