User:Blu Aardvark/monobook.js

/* */ /* User Javascript functions           * * Taken from w:User:ABCD/monobook.js */

function addlilink(tabs, url, name, id, title, key){ var na = document.createElement('a'); na.href = url; na.appendChild(document.createTextNode(name)); na.accesskey = key; var pref = 'alt-'; var clientPC = navigator.userAgent.toLowerCase; if(((clientPC.indexOf('AppleWebKit')!=-1) && (clientPC.indexOf('spoofer')==-1)) || navigator.userAgent.toLowerCase.indexOf( 'mac' ) != -1 ) pref = 'control-'; if(clientPC.indexOf('opera')!=-1) pref = 'shift-esc-'; if(key && title) na.title = title + ' [' + pref + key + ']'; else if(title) na.title = title; else if(key) na.title = '[' + pref + key + ']'; var li = document.createElement('li'); if(id) li.id = id; li.appendChild(na); tabs.appendChild(li); return li; }

function addTab(url, name, id, title, key){ var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; addlilink(tabs, url, name, id, title, key); }

function addPurge{ var x = document.getElementById('ca-history'); if(!x) return; if(x.children) x = x.children[0].href; else x = x.childNodes[0].href; addTab(x.replace(/=history/, "=purge"), 'purge', 'ca-purge', 'Purge the internal cache for this page', 'g'); }

function addEditSection0{ if(!document.getElementById) return; var x = document.getElementById('ca-edit'); if(!x) return; var y = document.createElement('LI'); y.id = 'ca-edit-0'; if(x.className == 'selected'){ if(/&action=edit&section=0$/.test(window.location.href)){ x.className = 'istalk'; y.className = 'selected'; } else { x.className = 'selected istalk'; }   } else if(x.className == 'selected istalk'){ if(/&action=edit&section=0$/.test(window.location.href)){ x.className = 'istalk'; y.className = 'selected istalk'; } else { y.className = 'istalk'; }   } else { y.className = x.className; x.className = 'istalk'; }   var z = document.createElement('A'); if(x.children){ z.href = x.children[0].href + '&section=0'; z.appendChild(document.createTextNode('0')); y.appendChild(z); document.getElementById('p-cactions').children[1].insertBefore(y,x.nextSibling); }else{ z.href = x.childNodes[0].href + '&section=0'; z.appendChild(document.createTextNode('0')); y.appendChild(z); document.getElementById('p-cactions').childNodes[3].insertBefore(y,x.nextSibling); }   z.title = 'Edit the zeroth section of this page'; akeytt; }

function myLoadFuncs{ addPurge; addEditSection0; } if (window.addEventListener) window.addEventListener("load",myLoadFuncs,false); else if (window.attachEvent) window.attachEvent("onload",myLoadFuncs); else{ window._old_Pidgeot_onload = window.onload; window.onload = function{ window._old_Pidgeot_onload; myLoadFuncs; } }

/* */