User:Eleanorg/Thematic1.1/control opacity using jQuery plugin: Difference between revisions
(Created page with "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 opac...") |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
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. | ||
Line 10: | Line 10: | ||
===manifest.json=== | ===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: | Note that jQuery is stored locally as jquery.js, and this file points to the actual code which is stored in contentscript.js: | ||
<source lang= | <source lang=javascript> | ||
{ | { | ||
"name": "traceroute1", | "name": "traceroute1", |
Latest revision as of 18: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"
}
]
}