User:X-Spider2/monobook.js

From Homestar Runner Wiki

< User:X-Spider2
Revision as of 07:08, 9 June 2006 by Y2K (Talk | contribs)
Jump to: navigation, search

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Mozilla / Firefox: hold down Shift while clicking Reload, or press Ctrl-Shift-R (Cmd-Shift-R on Apple Mac)
  • Safari: press Cmd-Option-E
  • IE: hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Konqueror: simply click the Reload button, or press F5
  • Opera users may need to completely clear their cache in Tools→Preferences.
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);

// 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 < 14) { hours = 10 + hours; }
  else if (hours > 13) { hours = hours - 14; }
  var minutes = time.getUTCMinutes();
  if (minutes < 10) { minutes = "0" + minutes; }
  var seconds = time.getUTCSeconds();
  if (seconds < 10) { seconds = "0" + seconds; }
  var currentTime = hours + ":" + minutes + " and " + seconds + " seconds";
  document.getElementById('pt-time').childNodes[0].childNodes[0].replaceData(0, 20, 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( 'loading time...' ) );
  // The text node above will appear for a second before the actual time is received, so I made its value "loading time...".
  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);

 // Found this on Phlip's JS. Fiddled with it a bit.
 // include utility functions
 document.write('<script type="text/javascript" src="/index.php?title=User:Phlip/utilities.js&amp;action=raw&amp;ctype=text/javascript&amp;dontcountme=s"></script>');

function dostuff()
{
  with (utilities)
  {
    addMonobookTab(escape(getArticleURL()) + "?action=purge", "purge", true)
    addMonobookTab("http://validator.w3.org/check?uri=" + escape(getArticleURL()), "Validate", true)
    addMonobookBottomTabs()
    if (getArticleNamespace() == 2 || getArticleNamespace() == 3)
    {
      var username = getArticleTitle();
      var i = username.indexOf('/')
      if (i >= 0)
        username = username.substr(0, i);
      addMonobookNavboxLink(localurl("Contributions/" + username, -1), "Contribs", "tb");
      addMonobookNavboxLink(localurl("Log/newuser", -1, "user=" + username), "Show Logs (new users)", "tb");
      addMonobookNavboxLink(localurl("Log", -1, "page=User:" + username), "Show Logs (target)", "tb");
    }
  }
}
if (window.addEventListener) window.addEventListener("load",dostuff,false);
else if (window.attachEvent) window.attachEvent("onload",dostuff);

function killfakeusermessage()
{
  var a = document.getElementsByTagName('DIV');
  for (var i = 0; i < a.length; i++)
  {
    if (a[i].className == "usermessage")
    {
      b = getChildType(a[i], "A", 1);
      if (b && b.href != "/index.php/User_talk:Phlip"
            && b.href != "http://hrwiki.org/index.php/User_talk:Phlip"
            && b.href != "http://www.hrwiki.org/index.php/User_talk:Phlip")
        a[i].style.background = "inherit";
    }
  }
}

if (window.addEventListener) window.addEventListener("load",killfakeusermessage,false);
else if (window.attachEvent) window.attachEvent("onload",killfakeusermessage);