User:Thebainer/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.
// IMPORTED SCRIPTS // importScript('MediaWiki:HighlightEditSections.js'); // MY FUNCTIONS // adds an edit count link to the personal portlet function addEditCount() { tabs = document.getElementById('p-personal').getElementsByTagName('ul')[0]; l = addlilink(tabs, "http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?user=Thebainer&dbname=enwiki", 'my editcount', 'pt-editcount'); } if (window.addEventListener) window.addEventListener("load", addEditCount, false); else if (window.attachEvent) window.attachEvent("onload", addEditCount); // adds a 'logs for this page' link to the navigation bar // if the page is a user's page, talk page or subpage, the link will go to logs for the user instead function addLogsLink() { // get page title var pagetitleRe=/[^:]*:\/\/en\.wikipedia\.org\/(wiki\/|w\/index\.php\?title=)([^&?]*)/; ptitle = pagetitleRe.exec(decodeURI(location.href))[2].split('_').join(' '); // if this is a user, show the logs for the user rather than the page if( (window.location.href.indexOf("User:") != -1) || (window.location.href.indexOf("User_talk:") != -1) ) { regDropSubpages = /[User|User_talk]:([^&?\/]*)[\/]?.*/; user = regDropSubpages.exec(ptitle)[1]; tabs = document.getElementById('p-tb').getElementsByTagName('ul')[0]; l = addlilink(tabs, "http://en.wikipedia.org/w/index.php?title=Special%3ALog&user=" + user, "Logs", "pt-logs"); l = addlilink(tabs, "http://en.wikipedia.org/w/index.php?title=Special%3ALog&type=block&page=User:" + user, "Block log", "pt-blocklog"); } else { url = "http://en.wikipedia.org/w/index.php?title=Special%3ALog&page=" + ptitle; tabs = document.getElementById('p-tb').getElementsByTagName('ul')[0]; l = addlilink(tabs, url, "Logs", "pt-logs"); } } if (window.addEventListener) window.addEventListener("load", addLogsLink, false); else if (window.attachEvent) window.attachEvent("onload", addLogsLink); // adds some handy links function addConvenienceLinks() { // create a new portlet class div var convlinks = document.createElement("div"); convlinks.className = "portlet"; // insert the links var heading = document.createElement("h5"); heading.appendChild(document.createTextNode("handy links")); convlinks.appendChild(heading); var portlet = document.createElement("div"); portlet.className = "pBody"; portlet.style.backgroundColor = "#ffeedd"; var list = document.createElement("ul"); var acwiki = document.createElement("li"); acwiki.id = "cl-acwiki"; var a = document.createElement("a"); a.href = "https://secure.wikimedia.org/wikipedia/arbcom-en/wiki/Special:Recentchanges"; a.appendChild(document.createTextNode("ArbCom wiki")); acwiki.appendChild(a); list.appendChild(acwiki); var mainwatch = document.createElement("li"); mainwatch.id = "cl-mainwatch"; var a = document.createElement("a"); a.href = "http://en.wikipedia.org/w/index.php?title=Special:Watchlist&namespace=0"; a.appendChild(document.createTextNode("Watchlist, mainspace")); mainwatch.appendChild(a); list.appendChild(mainwatch); portlet.appendChild(list); convlinks.appendChild(portlet); // append the new div below the toolbox var columnone = document.getElementById("column-one"); columnone.appendChild(convlinks); } if (window.addEventListener) window.addEventListener("load", addConvenienceLinks, false); else if (window.attachEvent) window.attachEvent("onload", addConvenienceLinks); // FUNCTIONS FROM ELSEWHERE // [[:de:Benutzer:ASM/quickedit.js]] /* document.write('<script src="http://de.wikipedia.org/w/index.php?title=Benutzer:ASM/quickedit.js&action=raw&ctype=text/javascript"></script>'); var qeEnabled = true; // Activate Script? var qeEnableSection0 = true; // Enable QuickEdit link for section 0 (introduction)? var qeEnableAccessKeys = false; // Activate access keys? var qeTextboxHeight = 20; // Height of the textbox */ /*function morelinks() { var tabs = document.getElementById('p-cactions').cloneNode(true); tabs.id = 'mytabs'; var listitems = tabs.getElementsByTagName('LI'); for (i=0;i<listitems.length;i++) { if(listitems[i].id) listitems[i].id = 'mytabs-' + listitems[i].id; } document.getElementById('column-content').appendChild(tabs); } if (window.addEventListener) window.addEventListener("load",morelinks,false); else if (window.attachEvent) window.attachEvent("onload",morelinks);*/ //Interiot's Tool2 document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Interiot/Tool2/code.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); // HELPER FUNCTIONS 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 tnaddlilink(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 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", or "p-navigation". //* 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; } // VOA's History and Edit Summary Use Analysis // Helper tools document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Addtabs/monobook.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); // History tools document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/History/monobook.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');