User:X-Spider2/monobook.js
From Homestar Runner Wiki
(Difference between revisions)
| Line 62: | Line 62: | ||
else if (window.attachEvent) window.attachEvent("onload",morelinks); | else if (window.attachEvent) window.attachEvent("onload",morelinks); | ||
| - | // Add | + | // Add Sydney time just below the "personal menu" list at the top of the page. |
// Created by Wikipedia:User:Mathwiz2020, modified by User:JoeyDay | // Created by Wikipedia:User:Mathwiz2020, modified by User:JoeyDay | ||
// | // | ||
| Line 69: | Line 69: | ||
var hours = time.getUTCHours(); | var hours = time.getUTCHours(); | ||
if (hours < 10) { hours = "1" + hours; } | if (hours < 10) { hours = "1" + hours; } | ||
| - | else if (hours > 13) { hours = " | + | else if (hours > 13) { hours = "14" - hours; } |
var minutes = time.getUTCMinutes(); | var minutes = time.getUTCMinutes(); | ||
if (minutes < 10) { minutes = "1" + minutes; } | if (minutes < 10) { minutes = "1" + minutes; } | ||
Revision as of 05:51, 6 June 2006
function addQuickbarLink(href, title, before)
{
var li = document.createElement('li');
var a = document.createElement('a');
a.appendChild(document.createTextNode(title));
a.href = href;
li.appendChild(a);
if (!before)
{
document.getElementById('pt-logout').parentNode.appendChild(li);
}
else
{
before = document.getElementById('pt-'+before);
before.parentNode.insertBefore(li, before);
}
}
function addLinks()
{
addQuickbarLink("http://www.hrwiki.org/index.php/User:X-Spider2/X-Sigger2", "my signature", "preferences");
addQuickbarLink("http://www.hrwiki.org/index.php/User:X-Spider2/tower", "my userbox", "preferences");
addQuickbarLink("http://www.hrwiki.org/index.php/User:X-Spider2/monobook.js", "my js", "preferences");
addQuickbarLink("javascript:history.back()", "back", "userpage");
addQuickbarLink("javascript:history.forward()", "forward", "userpage");
addQuickbarLink("javascript:location.reload()", "refresh", "userpage");
addQuickbarLink("http://www.hrwiki.org/index.php/Help:Contents", "help", "logout");
}
if (window.addEventListener) window.addEventListener('load', addLinks, false);
else if (window.attachEvent) window.attachEvent('onload', addLinks);
// Didn't write this myself. Found it on Lapper's JS. (User:Lapper/monobook.js)
function addPurgeButton()
{
var href = document.location.href;
{
var historyHref = document.getElementById( "ca-history" ).firstChild.href;
var div = document.getElementById( "p-cactions" );
var ul = div.getElementsByTagName( "ul" )[0];
var newLi = document.createElement( "li" );
var newA = document.createElement( "a" );
newA.setAttribute( "href" , historyHref.replace( "=history" , "=purge" ) );
var text = document.createTextNode( "purge" );
newA.appendChild( text );
newLi.appendChild( newA );
ul.appendChild( newLi );
}
}
if ( window.addEventListener ) window.addEventListener( "load" , addPurgeButton , false );
else if ( window.attachEvent ) window.attachEvent( "onload", addPurgeButton );
// Adds bottom tabs
function morelinks() {
var tabs = document.getElementById('p-cactions').cloneNode(true);
tabs.id = 'mytabs';
var listitems = tabs.getElementsByTagName('LI');
for (i=0;i<listitems.length;i++) {
if(listitems[i].id) listitems[i].id = 'mytabs-' + listitems[i].id;
}
document.getElementById('column-content').appendChild(tabs);
}
if (window.addEventListener) window.addEventListener("load",morelinks,false);
else if (window.attachEvent) window.attachEvent("onload",morelinks);
// Add Sydney time just below the "personal menu" list at the top of the page.
// Created by Wikipedia:User:Mathwiz2020, modified by User:JoeyDay
//
function getTime() {
var time = new Date();
var hours = time.getUTCHours();
if (hours < 10) { hours = "1" + hours; }
else if (hours > 13) { hours = "14" - hours; }
var minutes = time.getUTCMinutes();
if (minutes < 10) { minutes = "1" + minutes; }
var currentTime = hours + "" + minutes
document.getElementById('pt-time').childNodes[0].childNodes[0].replaceData(0, 5, currentTime);
doTime = window.setTimeout("getTime()", 1000);
}
function makeTime() {
var div = document.createElement( 'div' );
div.id = 'pt-time';
var mySpan = document.createElement( 'span' );
mySpan.appendChild( document.createTextNode( '0000' ) );
div.appendChild( mySpan );
document.getElementById( 'globalWrapper' ).parentNode.appendChild( div );
doTime = window.setTimeout("getTime()", 1000);
}
if (window.addEventListener) window.addEventListener ('load', makeTime, false);
else if (window.attachEvent) window.attachEvent ('onload', makeTime);
