// ==UserScript==
// @name SFC Page Titles
// @namespace http://sneezingtiger.com
// @description Set meaningful Starfleet Commander page titles
// @version 1.0
// @include http://*playstarfleet*.com/*
// ==/UserScript==
var newTitle = document.title;
var areaTitle = '';
var divs=document.getElementsByTagName('DIV');
// Get name of selected colony
var selectedPlanet = document.evaluate("//div[@class='colony selected' or @class='home_planet selected']//div[@class='planet_name']//a",
document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,
null).singleNodeValue.innerHTML;
// Universe name
var uniAbbr='';
if (/^http:\/\/uni2\.playstarfleetextreme/.test(window.location))
uniAbbr='Ex-2';
else if (/^http:\/\/uni2\.playstarfleet/.test(window.location))
uniAbbr='Uni 2';
else if (/^http:\/\/playstarfleetextreme/.test(window.location))
uniAbbr='Extreme';
else if (/^http:\/\/playstarfleet/.test(window.location))
uniAbbr='Orig';
// Home page - 1 planet
if (/\.com\/\?current_planet/.test(window.location) ||
/\.com\/\?activate_planet/.test(window.location)) {
areaTitle='Home';
}
// Home page - all planets
else if (/\.com\/profile\/overview/.test(window.location)) {
areaTitle='Home: All Planets';
}
// Missions page
else if (/\.com\/missions/.test(window.location)) {
areaTitle='Missions';
}
// Fleets page
else if (/\.com\/fleet/.test(window.location)) {
areaTitle='Fleets';
}
// Tech page
else if (/\.com\/technology/.test(window.location)) {
areaTitle='Tech Tree';
}
// Galaxy # on galaxy page
else if (/\.com\/galaxy\/show/.test(window.location)) {
var mySystem = document.getElementById("solar_system").value;
var myGalaxy = document.getElementById("galaxy").value;
areaTitle='Solar System ' + myGalaxy + ':' + mySystem;
}
// Leaders page
else if (/\.com\/leaderboard/.test(window.location)) {
areaTitle='Leaderboard';
}
// Messages page
else if (/\.com\/messages\?/.test(window.location)) {
areaTitle='Messages';
}
// New message (compose) page
else if (/\.com\/messages\/new/.test(window.location)) {
areaTitle='Compose message';
}
// New message (compose) page to specific person
else if (/\.com\/messages\/new.*&recipients=/.test(window.location)) {
var toPerson = document.evaluate("//div[@id='to']",
document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,
null).singleNodeValue.innerHTML;
areaTitle='Compose message' + toPerson;
}
// Alliance message topic
else if (/\.com\/topics\/show/.test(window.location)) {
for (i=0; i<divs.length; i++) {
if (divs[i].getAttribute('class')=='title') {
areaTitle = divs[i+1].innerHTML;
}
}
}
// Alliance post
else if (/\.com\/topics\/new/.test(window.location)) {
areaTitle='New Alliance Post';
}
// Buddy list
else if (/\.com\/buddy_list/.test(window.location)) {
areaTitle='Buddy List';
}
// Buildings page
else if (/\.com\/buildings\/home/.test(window.location)) {
areaTitle = 'Buildings';
}
// Research page
else if (/\.com\/buildings\/research_lab/.test(window.location)) {
areaTitle = 'Research Lab';
}
// Shipyard page
else if (/\.com\/buildings\/shipyard/.test(window.location)) {
areaTitle = 'Shipyard';
}
// Defense page
else if (/\.com\/buildings\/fortifications/.test(window.location)) {
areaTitle = 'Defense';
}
// Factory page
else if (/\.com\/buildings\/factory/.test(window.location)) {
areaTitle = 'Factory';
}
// Workers page
else if (/\.com\/workers/.test(window.location)) {
areaTitle = 'Workers';
}
// Moving heph page
else if (/\.com\/roaming_planet_move/.test(window.location)) {
areaTitle = 'Moving Heph';
}
if (areaTitle != '') {
document.title = areaTitle + ' - ' + selectedPlanet + ' - ' + uniAbbr;
}
Mozilla add on,User script,Grease Monkey Script, greasemonkey userscripts, updater userscripts mafia wars userscripts mafia wars autoplayer userscripts mafia wars wall userscripts scripts userscripts travian greasemonkey greasemonkey download greasemonkey facebook greasemonkey tutorial greasemonkey youtube greasemonkey travian greasemonkey chrome greasemonkey mafia wars greasemonkey mafia wars autoplayer
Saturday, January 22, 2011
Set meaningful Starfleet Commander page titles
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment