Subscribe to EdwinNameless' Fake Blog        RSS Feed

My Latest GreaseMonkey Script for DIC

Icon Leave Comment
Despite all the amazing work the guys in DIC have done for the upgrade, the site is still a bit flaky. One of the most annoying snags is the fact that blog posts cannot be posted with year 2010, so they all end up down the list of posts. Another one is that code boxes are still tiny.

This GreaseMonkey script fixes these 2 issues. It is still work in progress, as I'll probably be adding extra stuff in there, but it might prove useful to other people out there:

// ==UserScript==
// @name          DreamInCodeBlogIssue
// @namespace
// @include*
// @author         EdwinNameless
// ==/UserScript==

(function() {
    var DreamInCode = {
        addCurrentYearToSelect: function() {
            var date = new Date();
            var option = document.createElement("option");
            option.setAttribute("value", date.getFullYear());
            option.setAttribute("selected", "selected");
            var select = document.evaluate(
            for (var i = 0; i < select.snapshotLength; i++) {
                var year = select.snapshotItem(i);
                year.insertBefore(option, year.firstChild);
        isBlogPage: function(link) {
            return link.match(/^http:\/\/www\.dreamincode\.net\/[^?]*\?app=blog/i);
	enlargeCodeBox: function() {
	    var codeBoxes = document.getElementsByClassName("prettyprint");
	    for each (codebox in codeBoxes) { = "auto";
    var currentUrl =  window.location.href;
    if (DreamInCode.isBlogPage(currentUrl)) {

To install it, you obviously have to have the GreaseMonkey add-on installed in Firefox. Copy-paste the script above into a file called "dreamincode.user.js", and open the file with Firefox (File > Open File...). Firefox will then ask you if you want to install the script. Accept, and you're sorted.

0 Comments On This Entry


Search My Blog

Recent Entries

Recent Comments

My Picture

0 user(s) viewing

0 Guests
0 member(s)
0 anonymous member(s)