change headers on info pages

Oct 30, 2005 22:25


function friends_to_stalkers() {
// create array
var changes = new Array();

// english headers
var user = "User:";
var name = "Name:";
var website = "Website:";
var location = "Location:";
var birthdate = "Birthdate:";
var aolim = "AOL IM:";
var icquin = "ICQ UIN:";
var yahooid = "Yahoo! ID:";
var msnusername = "MSN Username:";
var jabber = "Jabber:";
var bio = "Bio:";
var memories = "Memories:";
var pictures = "Pictures:";
var interests = "Interests";
var schools = "Schools";
var friends = "Friends";
var mutualfriends = "Mutual Friends:";
var alsofriendof = "Also Friend of:";
var memberof = "Member of:";
var accounttype = "Account type";

// change headers
changes[jabber] = "Jibber:";
changes[pictures] = "Piktures:";
changes[schools] = "Skoos";
changes[friends] = "Stalking";
changes[mutualfriends] = "Mutually Stalking:";
changes[alsofriendof] = "Stalked by:";
changes[memberof] = "Ganging with:";
changes[accounttype] = "Rank";

// grab all table rows in document
var trs = document.getElementsByTagName('tr');
// start at end and work backwards
for(var i = trs.length - 1; i > 0; i--) {
// get a row
var tr = trs[i];
// get the cells in that row
var tds = tr.getElementsByTagName('td');
// get the first cell
var td = tds[0];
// get the tags in that cell
var bs = td.getElementsByTagName('b');
// if there are tags, do stuff
if(bs.length > 0) {
// get the first tag
var b = bs[0];
// get the tags in that tag
var as = b.getElementsByTagName('a');
// if there are tags in the tag, do stuff
if(as.length > 0) {
// get the first tag
var a = as[0];
// if there's a change to make, do it
if(changes[a.innerHTML]) {
a.innerHTML = changes[a.innerHTML];
}
} else {
// else, there aren't any tags in the tag
// so, if we're changing the tag, do it
if(changes[b.innerHTML]) {
b.innerHTML = changes[b.innerHTML];
}
}
}
}
}

js

Previous post Next post
Up