User:Redwolf24/monobook.js

From Wikipedia, the free encyclopedia

If a message on your talk page led you here, please be wary of who left it. The code below could contain malicious content capable of compromising your account; if your account appears to be compromised, it will be blocked. If you are unsure whether the code is safe, you can ask at the appropriate village pump.
Note: After saving, you have to bypass your browser's cache to see the changes. In Internet Explorer and Firefox, hold down the Ctrl key and click the Refresh or Reload button. Opera users have to clear their caches through Tools→Preferences, see the instructions for Opera. Konqueror and Safari users can just click the Reload button.
// -----------------------------------------------------------------------------
// Ăśbergodmode Monobook skin
// (c) 2005 Sam Hocevar <sam@zoy.org>
// $Id: ubergodmode.js 886 2005-05-14 23:56:48Z sam $
// -----------------------------------------------------------------------------
 
// -----------------------------------------------------------------------------
// Language support
// -----------------------------------------------------------------------------
var blocklink = 'Block this user';
switch (document.getElementsByTagName('html')[0].lang) {
  case 'fr':
    blocklink = 'Bloquer cet utilisateur';
    break;
}
 
// -----------------------------------------------------------------------------
// Our nice Block functions
// -----------------------------------------------------------------------------
function PerformBlock() {
  var l, target = '';
  // Look for '&faketarget=XXX' in URL
  url = location.pathname;
  l = location.search.substring(1).split('&');
  for (i = 0; i < l.length; i++) {
    var n = l[i].indexOf('=');
    if (l[i].substring(0, n) == 'faketarget') {
      target = l[i].substring(n + 1);
    }
  }
  if (!target)
    return;
  form = document.getElementById('blockip');
  if (!form)
    return;
  input = form.getElementsByTagName('input')[0];
  input.value = target;
}
 
// -----------------------------------------------------------------------------
// Add block buttons to the page
// -----------------------------------------------------------------------------
function AddBlockButtons() {
  var l, article = '', vandal;
  // Add 'block' links to a diff page
  l = document.getElementById('t-contributions');
  if (l) {
    clone = l.cloneNode(true);
    l.id = 't-blockuser';
    a = clone.getElementsByTagName('a')[0];
    a.href = a.href.replace(/Special:Contributions\//, 'Special:Blockip/');
    a.href = a.href.replace(/target=/, 'faketarget=');
    a.innerHTML = blocklink;
    l.parentNode.insertBefore(clone, l.nextSibling);
  }
}
 
 
// -----------------------------------------------------------------------------
// Arin functions (it's a bit bulky I was in a hurry and tired :) )
// -----------------------------------------------------------------------------
function addlilink(tabs, url, name){
    var na = document.createElement('a');
    na.href = url;
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    li.appendChild(na);
    tabs.appendChild(li);
    return li;
}
 
 
function addlilink(url, name)
{
  var na = document.createElement('a');
  na.setAttribute('href', url);
 
  var txt = document.createTextNode(name);
  na.appendChild(txt);
 
  var li = document.createElement('li');
  li.appendChild(na);
  return li;
}
 
 
function add_tabs()
{
  var c1 = document.getElementById('column-one');
  var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];
 
}
 
if (window.addEventListener)
  window.addEventListener("load", add_tabs, false);
else if (window.attachEvent)
  window.attachEvent("onload", add_tabs);
 
 
// Returns <li><a href="url">name</a></li>
function addlilink(url, name)
{
  var na = document.createElement('a');
  na.setAttribute('href', url);
 
  var txt = document.createTextNode(name);
  na.appendChild(txt);
 
  var li = document.createElement('li');
  li.appendChild(na);
  return li;
}
 
 
function arin_look(target)
{
  window.open('http://ws.arin.net/whois/?queryinput=' + target, 'Arin', 'width=600,height=400,top=400,left=0');
}
 
 
// Adds tabs to User: and User talk: pages.
function add_arin_tab()
{
  var c1 = document.getElementById('column-one');
  var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];
 
  // use the "edit this page" tab to get already-tidied url
  var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;
  // cut everything up to "title=" from the start and everything past "&action=edit" from the end
  editlk = editlk.substring(editlk.indexOf('title=') + 6, editlk.lastIndexOf('&action=edit'));
  editlk = editlk.substring(editlk.indexOf(':') + 1);
  var slloc = editlk.indexOf('/');
  if (slloc > 0)
    editlk = editlk.substring(0, slloc);
 
  // add "arin" tab
  tabs.appendChild(addlilink('javascript:arin_look("' + editlk + '")', 'Arin'));
 
}
 
function do_onload()
{
  if (document.title.indexOf('User:') == 0
      || document.title.indexOf('User talk:') == 0)
    add_arin_tab();
}
 
// -----------------------------------------------------------------------------
// Modify the page once it is loaded
// -----------------------------------------------------------------------------
if (window.addEventListener) {
  window.addEventListener("load", PerformBlock, false);
  window.addEventListener("load", AddBlockButtons, false);
  window.addEventListener("load", do_onload, false);
} else if (window.attachEvent) {
  window.attachEvent("onload", PerformBlock);
  window.attachEvent("onload", AddBlockButtons);
  window.attachEvent("onload", do_onload);
}
 
// [[User:Lupin/popups.js]] - please include this line 
 
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>')
 
// Topaz's automatic status changer //
 
inc("User:Topaz/init.js");
inc("User:Topaz/util.js");
inc("User:Topaz/comm.js");
inc("User:Topaz/wputil.js");
inc("User:Redwolf24/statuschanger.js");