Prototyping 12 November 2012: Difference between revisions

From XPUB & Lens-Based wiki
No edit summary
No edit summary
Line 3: Line 3:
Javascript is typically in a script tag in your own pages, but you can also use javascript in other contexts.
Javascript is typically in a script tag in your own pages, but you can also use javascript in other contexts.
[[Greasemonkey]] allows you to write scripts that can be installed in your browser and used to '''filter''' your browsing, by dynamically altering pages to change it appearance, content, or behaviour.
[[Greasemonkey]] allows you to write scripts that can be installed in your browser and used to '''filter''' your browsing, by dynamically altering pages to change it appearance, content, or behaviour.
[http://pzwart3.wdka.hro.nl/~tklok/hotseat.html]


Creating new content on the page...
Creating new content on the page...
Line 13: Line 15:
   var delme = document.getElementById("ads");
   var delme = document.getElementById("ads");
   delme.parentNode.removeChild(delme);
   delme.parentNode.removeChild(delme);


Continued on... http://commons.oreilly.com/wiki/index.php/Greasemonkey_Hacks/Getting_Started#Add_or_Remove_Content_on_a_Page
Continued on... http://commons.oreilly.com/wiki/index.php/Greasemonkey_Hacks/Getting_Started#Add_or_Remove_Content_on_a_Page

Revision as of 09:50, 12 November 2012

Take back the browser!

Javascript is typically in a script tag in your own pages, but you can also use javascript in other contexts. Greasemonkey allows you to write scripts that can be installed in your browser and used to filter your browsing, by dynamically altering pages to change it appearance, content, or behaviour.

[1]

Creating new content on the page...

 var newdiv = document.createElement('div');
 document.body.appendChild(newdiv)

Removing stuff is slightly indirect as you have to ask the element's "parent" to remove it's "child":

 var delme = document.getElementById("ads");
 delme.parentNode.removeChild(delme);

Continued on... http://commons.oreilly.com/wiki/index.php/Greasemonkey_Hacks/Getting_Started#Add_or_Remove_Content_on_a_Page