User:MichaelBillington/monobook.js

// document.write('<'+'script type="text/javascript" src="' + 'http://en.wikiversity.org/w/index.php?title=User:MichaelBillington/ircform.js' + '&action=raw&ctype=text/javascript"><'+'/script>');

if(wgIsArticle) { addOnloadHook(function {		var tbs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];		addlilink(tbs, "javascript:fix_links", "highlight", 'ca-taglinks', 'Highlight all links on this page that will activate a script when clicked.');	}); }

if(location.href.indexOf('action=edit') != -1 && location.href.indexOf('autotag=proxy') != -1) { addOnloadHook(function {               document.forms[0].wpTextbox1.value = "{" + "{subst:User:MichaelBillington/proxyspam}}";                document.forms[0].wpSummary.value = "Marking IP as open proxy";                document.forms[0].wpMinoredit.checked = true;                document.forms[0].wpWatchthis.checked = true;                document.forms[0].submit;	}); }

if(location.href.indexOf('autotag=submit') != -1) { addOnloadHook(function {               document.forms[0].submit;	}); }

if(location.href.indexOf('&action=success') != -1) { addOnloadHook(function {               location.href="about:blank";	}); }

function fix_links { var links = document.getElementById('bodyContent').getElementsByTagName('a'); for(var i=0; i<links.length; i++) { var link = links[i]; var cha = (link.href.indexOf('?') != -1) ? '&' : '?';		if(link.href.indexOf('autotag=') != -1) { link.style.color = "green"; link.onmouseup = function { this.style.color = 'orange'; }; }

} }

//parse paramName out of query string //stolen from Lupin's popups function _GET(paramName) { var cmdRe=RegExp('[&?]'+paramName+'=([^&]*)'); var h=document.location; var m; if (m=cmdRe.exec(h)) { try { return unescape(m[1]); } catch (someError) {} } return null; }; //

//   --- ADD VARIOUS LINKS function addToolboxLink(url, name, id){ var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0]; addlilink(tb, url, name, id); } // function addTopLink(url, name, id){ var personal = document.getElementById('p-personal').getElementsByTagName('ul')[0]; addlilink(personal, url, name, id); } // function addNavLink(url, name, id){ var navigation = document.getElementById('p-navigation').getElementsByTagName('ul')[0]; addlilink(navigation, url, name, id); } //

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

//

//     -- MORE MAJOR LINKAGE - function addLink(where, url, name, id, title, key, after){ //* where is the id of the toolbar where the button should be added; //  i.e. one of "p-cactions", "p-personal", "p-navigation", or "p-tb". //   //* url is the URL which will be called when the button is clicked. //  javascript: urls can be used to do more complex things. //   //* name is what will appear as the name of the button. //   //* id is the id of the button; it's best to define one. //  Use a prefix to make sure its unique. Optional. //   //* title is the tooltip title that gives a longer description //  of the button; if you define a accesskey, mention it here. Optional. //   //* key is the char you want for the accesskey. Optional. //   //* after is the id of the button you want to follow this one. Optional. //   var na = document.createElement('a'); na.href = url; na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); if(id) li.id = id; li.appendChild(na); var tabs = document.getElementById(where).getElementsByTagName('ul')[0]; if(after) { tabs.insertBefore(li,document.getElementById(after)); } else { tabs.appendChild(li); }   if(id) { if(key && title) { ta[id] = [key, title]; } else if(key) { ta[id] = [key, '']; } else if(title) { ta[id] = ['', title];} }   // re-render the title and accesskeys from existing code in wikibits.js    akeytt; return li; } //

// - LINKAGE

function addlilink(tabs, url, name, id, title, key){ var na = document.createElement('a'); na.href = url; na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); if(id) li.id = id; li.appendChild(na); tabs.appendChild(li); if(id) {       if(key && title) {           ta[id] = [key, title]; }       else if(key) {           ta[id] = [key, '']; }       else if(title) {           ta[id] = ['', title]; }   }    // re-render the title and accesskeys from existing code in wikibits.js    akeytt; return li; }