User:Matthewmayer/monobook.js
From Wikipedia, the free encyclopedia
If a message on your talk page led you here, please be wary of who left it. Code that you insert on this page 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 code you are adding to this page 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.
// <pre><nowiki> // *** The useful code *** function highlightMyLanguages() { //p-lang } function addUnwatch() { //adds 'unwatch' links in watchlist if (window.location.href.indexOf("Special:Watchlist")!=-1) { //correct page, so retrieve watchlist items var items=document.getElementById('bodyContent').getElementsByTagName('li'); for (var i=0;i<items.length;i++) { //what is the title of this page? pagename=items[i].getElementsByTagName('a')[0].title; //create 'unwatch' element unwatchelt=document.createElement('a'); unwatchelt.setAttribute('href','/w/index.php?title='+pagename+'&action=unwatch'); unwatchelt.setAttribute('title','Unwatch '+pagename); unwatchelt.appendChild(document.createTextNode('(unwatch)')); //add the 'unwatch' element items[i].appendChild(unwatchelt); } } } // Utility functions function addToolboxLink(url, name, id){ var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0]; addlilink(tb, url, name, id); } 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; } function getElementsByClass(searchClass,node,tag) { /* This script and many more are available free online at The JavaScript Source :: http://javascript.internet.com Created by: Dustin Diaz :: http://www.dustindiaz.com/ */ var classElements = new Array(); if (node == null) node = document; if (tag == null) tag = '*'; var els = node.getElementsByTagName(tag); var elsLen = els.length; var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)"); for (i = 0, j = 0; i < elsLen; i++) { if (pattern.test(els[i].className) ) { classElements[j] = els[i]; j++; } } return classElements; } // ***add listeners for Unwatch add-on *** if (window.addEventListener) window.addEventListener("load", addUnwatch, false); else if (window.attachEvent) window.attachEvent("onload", addUnwatch); //</nowiki></pre> // install [[User:Cacycle/wikEd]] in-browser text editor document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js' + '&action=raw&ctype=text/javascript"></' + 'script>'); var wikEdLoadRegExTypoFix = true;