HOWTO
When you want to use homebrewed functions you need to create at least one HTML file. The genericTemplate.html will be used for every window. The only thing you have to do is to create the file and add your script into the <head> section.
JavaScript Tips and Code Snippets
Got a cool JavaScript tip or snippet? Post it!
Display only changed timestamps
This function allows you to hide elements by classnames which have the same value. This is the script which is used inside the Frugal Style.
function hideSameTimestamps() {
function getElementsByClassName( className, tagName, rootNode ) {
rootNode = rootNode || document;
tagName = tagName || '*';
var result = [];
var elements = rootNode.getElementsByTagName( tagName );
for( var x = 0; x < elements.length; x++ ) {
if ( !elements[x].className || elements[x].className != className ) { continue; }
result.push( elements[x] );
}
return result;
}
var elements = getElementsByClassName( 'envelope', 'div' );
var parentTimestamp = getElementsByClassName( 'timestamp', 'span', elements[ elements.length - 2 ] )[0];
var currentTimestamp = getElementsByClassName( 'timestamp', 'span', elements[ elements.length - 1 ] )[0];
elements[ elements.length - 1 ].scrollIntoView( true );
if ( parentTimestamp.innerHTML == currentTimestamp.innerHTML ) {
currentTimestamp.style.visibility = 'hidden';
}
}
Emoticon text / image flip
Some interesting image substitution code to make images flip between text and image. I believe Adium uses this for clickable emotions now.
