Archive for the ‘Greasemonkey’ Category

Twitter Lists Box User Script

Wednesday, September 19th, 2012

For some time now, I’ve been using Twitter on a daily basis. I’m far from being a hardcore twitterer (or whatever the term is), but I do spend a couple minutes every day reading new stuff that appears on my feed.

When I browse tweets on my desktop machine, I usually don’t use any apps — I just visit the Twitter website and don’t need anything more fancy than that. However, the list of people that I follow has grown over time, and I recently started missing one useful feature that the Twitter website used to have — easy access to lists. I have created a few private lists and put most of the followed people on them, and being able to quickly open a list to read just the tweets of people on that list was really convenient.

Back in the old days (that is, like a year ago), Twitter used to display lists in the sidebar, next to the timeline. But, then they were removed, and instead buried several clicks away in the interface. Probably because the vast majority of Twitter audience simply wasn’t using lists, Twitter had no interest in making that feature easily accessible. (Some people were speculating that lists will be completely removed at some point — but I hope that won’t happen.)

Luckily, user scripts have been invented to deal with situations like this. I found one existing script that kind of did what I wanted, but since it only supported public lists (mine are private), it didn’t meet my needs — so I ended up quickly putting together my own version. Welcome back, sidebar lists:

If you’d like to use the script, grab it from or from GitHub. Tested to work in Firefox and Chrome.

POD Functions Sort Greasemonkey Script

Friday, March 30th, 2012

Being a Perl programmer, I frequently visit CPAN or MetaCPAN to read Perl module documentation. I often go there to look up a specific function or method, and many modules are kind enough to list their functions/methods in the table of contents, so it’s usually easy to quickly find the one I’m looking for.

However, some of those kind modules list functions in non-alphabetical order, which is a bit less useful. Sure, that particular non-alphabetical order might make sense, for example when it groups functions by their purpose, but it still makes it harder to find a specific item on the list. Examples: DBI, DBIx::Class::Schema, DBIx::Class::Storage.

To cope with that, I wrote a small Greasemonkey script which allows you to sort those lists in alphabetical order. It tries to recognize lists of functions or methods using simple heuristicts (such as having a “_” in the list item text, or having no spaces) and puts an icon next to the list, which, upon clicked, sorts the list.

If you’re a Perl programmer with OCD, I’m sure you’ll love this script. Tested to work on Firefox and Chrome/Chromium.

Split Screen Greasemonkey Script

Sunday, August 14th, 2011

Yesterday I had another crazy idea that ended up implemented as a Greasemonkey script. I was browsing some source code in Firefox, and I thought that the browser is missing one feature that I commonly use in an IDE, and that is the ability to open the same source file in two views displayed side-by-side. This is useful when you need to look at two parts of the code that are related, but are many lines away — like, a function definition and the place where the function is called.

For those of you thinking “meh, couldn’t you just open a second window?” — sure, and I sometimes do that, but it’s not very convenient, as it requires me to do some dragging/resizing to get the desired layout. I wanted an easier solution.

I implemented this in a very simple manner, by replacing the current page with a new document containing two iframes, and loading the current URL in both of them. To make it more useful, I also added the ability to resize the iframes by dragging the splitter bar between them. Here’s a screenshot of the script being used to view a source file on GitHub:

Split Screen script used to view a source code file

The script is available on


Sunday, July 17th, 2011

Here’s a slightly late announcement — a few days back, I added a new project to the projects page. It’s called MonkeyConfig and it’s a configuration dialog builder for Greasemonkey scripts.

As with most of my projects, it was born out of necessity. I wanted to add a user-friendly configuration screen to another script of mine, View as Source. I knew about the de-facto standard configuration library GM_config, but I had trouble getting it to do what I wanted — I couldn’t find an easy way to create a form field combined of two drop-down lists, and the generated configuration screen looked ugly for whatever reason (like some styles were missing). I finally gave up on it and decided to develop my own solution.

The just-released version is still pretty immature, but it’s already functional enough to be useful, especially for simple scripts with just a few configuration parameters. Here’s an example of a configuration dialog generated by MonkeyConfig for the View as Source script:

View as Source configuration dialogIf you’re a Greasemonkey script author and would like to give it a try, you’ll find some basic usage instructions on the project page and in the documentation (it’s pretty minimal at this moment, I’ll be expanding it).

The script is also on and GitHub.

View as Source Greasemonkey Script

Saturday, April 23rd, 2011

Today I released the Greasemonkey script that I wrote while being sick on the snowboarding trip last week. It’s called “View as Source”, and it allows you to open any link in the page using the view-source URI scheme.

I developed it to resolve an annoying problem that I had every now and then with source code files linked on the Web. Although pretty much every source code file is plain text, and Firefox could display it as such, for certain MIME types it insists on opening the file in an external editor (or saving it). You know, like this:

Even if I just wanted to take a quick peek at a source file, and despite having a perfectly capable text file viewer in front of me, I had to launch another application.

I experimented a bit and found out that the view-source URI scheme can be an effective workaround for this. It’s utilized by Firefoxes “View → Page Source” option to produce a syntax-highlighted view of the HTML code of the currently open page. However, if used with a non-HTML file, it displays its contents as plain text — just what we need.

So, what the script does is it prepends the "view-source:" scheme prefix to links right before they are activated. It only does this on demand, as you certainly wouldn’t want to do this to every link on every page that you visit. You enable it with a keyboard shortcut (Shift + Alt + U), and then the script waits five seconds for you to click a link — anything you click within that time period is opened with view-source.

If you want to try it, the script is available at As usual, I’m looking forward to your feedback.

Weekend Project(s): Cardboard Cat Chaise / Greasemonkey Unit Conversion Script

Saturday, January 3rd, 2009

Every once in a while I like doing some DIY stuff just for the fun of it — I suppose it’s my deeply buried need to create something that is physical and not source code, for a change. Some time ago, I came across building instructions for a cardboard cat chaise, and I thought it might be fun to make. Besides, I had no doubts my cats would like it, as they’ve always demonstrated an evident fetish for cardboard boxes.

So, the day came yesterday — I got a big cardboard box, prepared the tools, arranged a workspace on the floor, and began reading the instructions. To my disappointment, all the dimensions in the text turned out to have been given in inches, which seemed perverted for a normal, healthy, metric-oriented person that I am.

Of course, it wouldn’t be a big deal if I just took a calculator, did a few multiplications, and got the respective values in centimetres. Or I could use the mighty unit conversion capabilities of Google search. But then I thought to myself — hey, isn’t this the 21st century, Web 2.0, and stuff? I shouldn’t be forced to do such a tedious task of entering numbers and doing the calculations, this bloody machine/Web/whatever should do it for me. With this in mind, I turned to to see if there was a Greasemonkey script that could parse those awful inches and convert them to lovely centimetres right there on the webpage. But, bummer — it seemed there was no such script.

This is where my need to create something physical had to retreat for a while, as the more powerful need to immediately transform the idea for a conversion script into an implementation was taking over. I quickly coded a basic script that converted inches, feet, yards, and miles into centimetres, metres, and kilometres, and displayed the result in a tooltip when the mouse cursor was placed over the value in question, like this:

US to Metric

To make the script a bit more useful, I also added conversion rules for units of mass (ounces and pounds to grams and kilograms) and temperature (Fahrenheit degrees to Celsius). If you want to give it a try, you can grab it from

And the chaise? It turned out quite well, and the cats started using it instantly. Here’s one satisfied customer:

Happy cat on a chaise

If you compare my result with the original one from the article, you’ll notice I went with a more primitive IKEA-ish design, but my cats are just simple unpretencious DSHs and they don’t like fancy furniture.

BrightenUp Greasemonkey Script

Thursday, November 6th, 2008

In my last post, I got somewhat excited about the idea of making a Greasemonkey script that would allow you to adjust the brightness of images on websites. One afternoon a few days ago, having nothing better to do, I wrote the script — and it sort of works. More precisely, it works only on some websites.

The script, like the imgFx plugin, makes use of the canvas HTML element. Among other things, canvas lets us retrieve the image’s pixel data as RGB values. To make an image brighter, we need to read all the pixels, increase their RGB values, and use the new pixel data to redraw the image. Sounds rather simple, but there is one fundamental problem. Due to security restrictions, Firefox will let us read the pixel data only if the image originates at the exact same domain as the website itself. Even if it’s just the sub-domain that is different, it won’t be allowed. So, if you have a website at, but your images come from, the script won’t work with it.

Anyway, in case you’d like to try out the script, here it is: brightenup.user.js

I’ve checked the most popular image hosting websites, and it seems only ImageShack meets the requirement of images originating at the exact same domain as the page on which they appear. Thus, the script is set to execute on * Here’s a sample image that you can test it on (no goatse, and safe for work, I promise):

Move the mouse cursor over the image, and two buttons will pop up in the top left corner. Press “+” and “-” to make the image more or less bright.

Update (Nov 8):
I’ve uploaded the script to for the world to see — there it is.

  • Archives

  • Categories

  • Meta

  • Latest Tweets

    Warning: Illegal string offset 'last_access' in /usr/local/www/ on line 334

    Warning: Illegal string offset 'time_limit' in /usr/local/www/ on line 334

    Warning: Illegal string offset 'last_access' in /usr/local/www/ on line 336

    Warning: Illegal string offset 'twitter_api' in /usr/local/www/ on line 234

    Warning: Illegal string offset 'user_token' in /usr/local/www/ on line 262

    Warning: Illegal string offset 'user_secret' in /usr/local/www/ on line 263

    Warning: Illegal string offset 'consumer_key' in /usr/local/www/ on line 264

    Warning: Illegal string offset 'consumer_secret' in /usr/local/www/ on line 265

    Warning: Illegal string offset 'twitter_username' in /usr/local/www/ on line 270

    Warning: Illegal string offset 'show_retweets' in /usr/local/www/ on line 272

    Warning: Illegal string offset 'exclude_replies' in /usr/local/www/ on line 275

    Warning: Illegal string offset 'twitter_data' in /usr/local/www/ on line 282

    Warning: Illegal string offset 'twitter_data' in /usr/local/www/ on line 350

    Warning: Illegal string offset 'twitter_data' in /usr/local/www/ on line 351
    Twitter outputted an error:
    Warning: Illegal string offset 'time_format' in /usr/local/www/ on line 484
  • Follow odyniec on Twitter