SOS

Shane O’Sullivan’s technical blog… really ties the room together

Archive for the 'greasemonkey' Category


GreaseMonkey script to add Digg-like links to posts

Posted by Shane O'Sullivan on 22 May, 2007

I decided today that I wanted to put links at the bottom of each of my blog posts that would allow people to perform actions on the post, e.g:

My blog is on WordPress.com which doesn’t seem to have a plugin that will allow me to do this. So, I got off my ass and wrote a GreaseMonkey Firefox script that’ll do it for me. You can download this script by going to http://userscripts.org/scripts/show/9421 and clicking the “Install This Script” button.

The links that are inserted are at the bottom of this post. The script is open source (GPL license), so take it, play with it, whatever. If you find any bugs, please let me know by commenting on this post.
Share this post:digg it|kick it|Email it|bookmark it|reddit|liveIt

Posted in Ajax, Firefox, Javascript, greasemonkey | 8 Comments »

Greasemonkey script to turn on Firebug debugging for Dojo

Posted by Shane O'Sullivan on 12 January, 2007

Enabling debugging in Dojo is a relatively simple thing to achieve, you simply put

djConfig={isDebug:true};

into a script block before including the dojo.js file, and that’s it. If you want to use Firebug to display your debug statements, put the code:

dojo.require(”dojo.debug.console”)

somewhere on the page. However, this is not always as straightforward as it seems. For simple html or PHP pages, sure, it’s easy. But what if you want to debug multiple pages and you’re using static html? You’ll have to put this code on all of them, and remove it when you’re done. Or what, as is the case in my current position, you are working with a very large framework that doesn’t easily allow you to change the template of a page without a long rebuild step?

The solution is to use a Greasemonkey script to enable Dojo/Firebug debugging on any page you visit, or only for pages in a given list of domains (not that this only works for Firefox, poor old IE doesn’t have anything nearly as cool as Greasemonkey available). The steps to use this script are as follows:

  1. Install Greasemonkey from http://greasemonkey.mozdev.org/
  2. Install Firebug from http://www.getfirebug.com
  3. Go to http://userscripts.org/scripts/show/9424 and click the “Install this Script” button. Greasemonkey should prompt you to install it.

That should be all that’s necessary. Now, every page you visit will print it’s debug output to the Firebug console, regardless of whether the page has debugging switched on or not. Obviously you don’t always want this script to run, so to disable it, in Firefox to to “Tools/Greasemonkey/Manage User Scripts”, select the script and uncheck the “Enabled” checkbox whenever you don’t want to use it. Even simpler, if this is the only script you use with Greasemonkey, you can enable/disable Greasemonkey completely by clicking on the monkey icon at the bottom-left of the Firefox window.

Posted in Ajax, Dojo, Javascript, Technical, greasemonkey | 3 Comments »