Greasemonkey

From No LJ Ads Wiki

Jump to: navigation, search
Expand: (No specific notes.)


Greasemonkey is a Mozilla Firefox extension that allows users to install their own Javascripts to websites.

You can find user scripts on userscripts.org, and LiveJournal oriented scripts as well.

People interested in writing their own Greasemonkey scripts are encouraged to read Dive Into Greasemonkey.

There are Greasemonkey like extensions or capabilities for other browsers, including Creammonkey for Safari, User Javascript for Opera, and GreasemonkIE, Trixie, and Turnabout for Internet Explorer.


Sample Greasemonkey Script:

// Begin Userscript Comments
// ==UserScript==
// @name          Script Name
// @namespace     http://www.example.com/    // URL of Script Author
// @description   Description of Script
// @include       http://www.google.com/*    // URLs to include
// @exclude       http://images.google.com/* // URLs to exclude
// ==/UserScript==
// End Userscript Comments

// Begin Userscript Functions
(function()
{

  // Begin Helper Functions
  function my_decodeURI(uri) {
    return decodeURI(decodeURI(uri));
  }
  // End Helper Functions
	
  // Begin Main Script
  var as = document.getElementsByTagName('a');
  for(var i = 0; i < as.length; i++) {
    var a = as[i];
    a.href = my_decodeURI(a.href);
  }
  // End Main Script

})();
// End Userscript Functions