Jump to content

User:Topaz/enhanceduserpage.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
topaz.enhanceduserpage = new Object();
topaz.enhanceduserpage.version = 20061107;

var vieweduser = location.href;
var userloc = vieweduser.indexOf("User:");
if (userloc != -1) {
  vieweduser = vieweduser.substring(userloc+5);

  var slashloc = vieweduser.indexOf("/");
  if (slashloc != -1) {
    vieweduser = vieweduser.substr(0, slashloc);
  }

  var lt = String.fromCharCode(60);
  var gt = String.fromCharCode(62);
  document.writeln(lt+'link rel="alternate stylesheet" type="text/css" href="/w/index.php?title=User:'+vieweduser+'/userpage.css&action=raw&ctype=text/css" title="Topaz\'s enhanced userpage mod" id="tz-enhanceduserpage"/'+gt);

  topaz.enhanceduserpage.oldonload = window.onload;
  window.onload = function() {
    if (typeof topaz.enhanceduserpage.oldonload == "function") topaz.enhanceduserpage.oldonload();
    with(topaz.util.getobj("tz-enhanceduserpage")) {
      disabled = true; //ie hack -_-
      disabled = false;
    }
  }
}