Record of some of the computer tech I deal with so that it's documented at least somewhere.

Monday, 10 May 2010

Keep on Clucking with Chickenfoot

Websites with black backgrounds do my eyes in, so here's a Chickenfoot script to set the background and color for all elements on the current page to Plan9 like calm.

var s = document.getElementsByTagName("*")
for(a in s) {
s[a].style.background = "#FFD"
if(s[a].nodeName == "A") { // HREFs
s[a].style.color = "#00F"
s[a].style.textDecoration = "none"
} else {
s[a].style.color = "#111"
}
}


And here's a bit of helper code to inspect collections :
(in Chickenfoot the last evaluation is printed on the console)


function inspect(e) {
var b = ""
for(k in e) {
b += k + " = " + e[k] + "\n"
}
return b
}

// use it like this :

var c = ""
var s = document.getElementsByTagName("*")
for(a in s)
c += inspect(s[a])
c


This simple script sat on right click has made my day, and it's only midday!

No comments: