User:Legoktm/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.
importScript('User:Dispenser/Link checker/toolbox.js'); importScript('User:TheJosh/Scripts/NewPagePatrol.js'); importScript('User:AWeenieMan/furme.js'); importScript('User:VoA/monobook.js'); //[[Category:Wikipedians who use RC script|Legoktm]] importScript('User:Lupin/recent2.js'); // [[User:Dschwen/highlightredirects.js]] - please include this line document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Dschwen/highlightredirects.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); importScript('Wikipedia:WikiProject User scripts/Scripts/Quick wikify.js'); importScript('Wikipedia:WikiProject User scripts/Scripts/Autolink'); if (wgNamespaceNumber >= 0) addOnloadHook(function(){ var pCactions = document.getElementById('p-cactions'); if (!pCactions) return; var caMain = pCactions.getElementsByTagName('li')[0]; var caTalk = document.getElementById('ca-talk'); var caEdit = document.getElementById('ca-edit'); if (!caEdit) caEdit = document.getElementById('ca-viewsource'); var caHistory = document.getElementById('ca-history'); if (!caMain || !caTalk || !caEdit || !caHistory) return; var el_move, el_create, id2; if (wgNamespaceNumber % 2) { //talk space el_move = caTalk; el_create = caMain; id2 = ''; } else { el_move = caMain; el_create = caTalk; id2 = 'discussion'; } caEdit.firstChild.innerHTML = 'edit'; caHistory.firstChild.innerHTML = 'hist'; el_move.parentNode.insertBefore(caHistory, el_move.nextSibling); el_move.parentNode.insertBefore(caEdit, el_move.nextSibling); var href = el_create.firstChild.getAttribute('href', 2); if (el_create.className.indexOf('new') < 0){ addPortletLink('p-cactions', href + '?action=history', 'hist', 'ca-history-'+id2, id2+' history', '', el_create.nextSibling); addPortletLink('p-cactions', href + '?action=edit', 'edit', 'ca-edit-'+id2, 'Edit '+id2, '', el_create.nextSibling); } caMain.style.marginRight = '0.3em'; caTalk.style.marginRight = '0.3em'; caTalk.style.marginLeft = '1.6em'; }) importScript('User:Legoktm/com2.js'); importScript('User:Legoktm/wel.js'); importScript('User:Legoktm/paf.js'); importScript('User:Legoktm/lastedit.js'); // Autolink [[wikilinks]] and {{templates}} (especially useful for monobook.js and similar pages) addOnloadHook(function () { // Get the HTML of just the main body of the page, not including textareas hopefully if (location.href.indexOf('&action=history') != -1) { return; //The history page crashes when this script is used } else if (document.title.indexOf("Editing ") != 0 && document.title.indexOf("Template:") != 0) { targetdiv = document.getElementById('bodyContent'); // bodyContent div for most pages } else if (document.getElementById('wikiPreview')) { targetdiv = document.getElementById('wikiPreview'); // wikiPreview if it's there } else if (document.getElementById('wikiDiff')) { targetdiv = document.getElementById('wikiDiff'); // wikiDiff if it's there } else { return; } content = targetdiv.innerHTML; content = content.replace(/([^\[])\[{2}([^\[\]\|\<\>\n]*)([^\[\]\<\>\n]*?)?\]{2}([^\]])/g, '$1<a class="autolink" href="/wiki/$2">[[$2$3]]</a>$4'); // Make wikilink code into links content = content.replace(/([^\{])\{{2}(subst\:|msg\:)?([^\{\}\|\<\>\n]*)([^\{\}\<\>\n]*?)?\}{2}([^\}])/g, '$1<a class="autolink" href="/wiki/Template:$3">{{$2$3$4}}</a>$5'); // Make template code into links targetdiv.innerHTML = content; // Write it back }); // End Autolink // Start Tabs at bottom addOnloadHook(function () { 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; } content = document.getElementById("content"); // Find the content div content.parentNode.insertBefore(tabs, content.nextSibling); // Place tab list right after content div }); // End tabs at bottom importScript('User:Henrik/js/automod.js');