User:Lincher/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.
// [[User:Lupin/popups.js]] document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); popupDelay=1.7; popupHideDelay=0.1; popupOnEditSelection=false; // Since I last changed // [[User:JesseW/monobook.js]] function addSinceTab() { var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; if (window.location.href.indexOf("&action=history&gotosince=true")!=-1) { do_since_I_last_edited() } else if (!/wiki\/Special:|w\/index.php?title=Special:/.test(window.location.href)) { var thetitle=document.title.slice(0, String(document.title).indexOf(" - ")); var l=addlilink(tabs, "/w/index.php?title="+thetitle+"&action=history&gotosince=true", 'since', ''); l.lastChild.title="Changes since I last edited"; } } function addSinceTab() { if (window.location.href.indexOf("&action=history&gotosince=true")!=-1) { do_since_I_last_edited() } else if (!/Special:/.test(window.location.href)) { var thetitle=document.title.slice(0, String(document.title).indexOf(" - ")); var l=addLink('p-cactions', "/w/index.php?title="+thetitle+"&action=history&gotosince=true", 'since', 'ca-since', 'Changes since I last edited', '', ''); } else { dump("Since error!"); } } function do_since_I_last_edited() { var csub=document.getElementById("contentSub"); var msg=document.createElement("p"); msg.appendChild(document.createTextNode ("Parsing history... please wait...")); msg.className="error"; csub.insertBefore(msg, csub.firstChild) var username=textContent(document.getElementById("pt-userpage")); var hists=document.getElementById("pagehistory").childNodes; for (n=0;n<hists.length;n++) { if (hists[n].getElementsByTagName && textContent(hists[n].getElementsByTagName("span")[0])==username) { document.location=hists[n].childNodes[1].href; return; } } msg.replaceChild(document.createTextNode ("You have not edited this page! (recently)"), msg.firstChild); } // Purge cache // [[User:Trilobite/Tools]] function addPurgeTab() { ta['ca-purge'] = ['g', 'Purge the internal cache for this page']; if(!document.getElementById) return; var x = document.getElementById('ca-history'); var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; if(!x) return; if(x.children) x = x.children[0]; else x = x.childNodes[0]; addlilink(tabs, x.href.replace(/=history/, "=purge"), 'purge', 'ca-purge'); } // Last diff // [[User:JesseW/monobook.js]] function addLastDiff() { z=document.getElementById("content").childNodes; for (var n=0;n<z.length;n++) { if (z[n].className=="firstHeading") { var pname=z[n].textContent; } } var l=addTab("http://en.wikipedia.org/w/index.php?title=" + pname + "&diff=cur&oldid=prev", 'last', ''); l.lastChild.title="Show most recent diff"; } if (window.addEventListener) window.addEventListener("load", addLastDiff, false); else if (window.attachEvent) window.attachEvent("onload", addLastDiff); // Tabs duplicate 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); // AutoCopyvio - Adds copyright violation notice to article and adds entry to Copyright Problems page // Created by Bmicomp from modified AutoVFD(by Korath) function add_link2(url, name) { var na = document.createElement('a'); na.setAttribute('href', url); na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); li.appendChild(na); var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; tabs.appendChild(li); } function strip_namespace(target) { var colon = target.indexOf(':'); if (colon != -1) { var spaces = new Array('User', 'Wikipedia', 'Image', 'MediaWiki', 'Template', 'Help', 'Category'); var ns = target.substring(0, colon); if (ns == '' || ns == 'Talk') return target.substring(colon + 1); else for (var i = 0; i < spaces.length; ++i) { if (ns == spaces[i] || ns == spaces[i] + '_talk') return target.substring(colon + 1); } } return target; } function copyvio() { document.editform.wpTextbox1.value = '{' + '{' + 'copyvio|url=}}'; document.editform.wpSummary.value = 'copyvio'; var target = document.editform.action; target = target.substring(target.indexOf('title=') + 6, target.lastIndexOf('&action=submit')); var months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); var date = new Date(); var datestring = date.getUTCFullYear() + '_' + months[date.getUTCMonth()] + '_' + date.getUTCDate(); var pagename = strip_namespace(target); window.open('/w/index.php?title=Wikipedia:Copyright_problems/' + datestring + '&action=edit&fakeaction=copyviolist&faketarget=' + pagename, 'status,toolbar,location,menubar,directories,resizeable,scrollbars'); } function autocopyvio() { if (document.title.indexOf('Editing ') == 0) { var action = ''; var target = ''; if (location.search) { var l = location.search.substring(1).split('&'); for (var i = 0; i < l.length; ++i) { var eq = l[i].indexOf('='); var name = l[i].substring(0, eq); if (name == 'fakeaction') action = l[i].substring(eq + 1); else if (name == 'faketarget') target = unescape(l[i].substring(eq + 1)).replace(/_/g, ' '); } } if (action == 'copyviolist') { document.editform.wpTextbox1.value += '*[[' + target + ']] <span class="plainlinks">([http://en.wikipedia.org/{{localurl:' + target + '|action=history}} history] · [http://en.wikipedia.org/{{localurl:' + target + '|diff=0}} last edit])</span>' + ' from [' + '] ~' + '~~' + '~'; document.editform.wpSummary.value = 'Copyvio ' + '[[' + target + ']]'; } else add_link2('javascript:copyvio()', 'copyvio'); } } if (window.addEventListener) window.addEventListener('load', autocopyvio, false); else if (window.attachEvent) window.attachEvent('onload', autocopyvio); //// Optimizes the Sidebar menu function OptimizedNavig() { var a = document.getElementById("p-navigation"); if (a) { b = a.getElementsByTagName("ul"); if(b.length > 0) { var startUrl = '/w/index.php?title=' var endUrl = '&action=purge' // liste des URLs var urls = new Array() urls[0] = 'Main Page' urls[1] = 'Wikipedia:Community Portal' urls[2] = 'Wikipedia:Featured content' urls[3] = 'Wikipedia:Good_articles' urls[4] = 'Portal:Current events' urls[5] = 'Special:Recentchanges' urls[6] = 'Special:Random' urls[7] = 'Special:Newpages' urls[8] = 'Special:Statistics' urls[9] = 'Wikipedia:Release_Version' urls[10] = 'Wikipedia:Version 1.0 Editorial Team/Index' urls[11] = 'Wikipedia:WikiProject_Missing_encyclopedic_articles' var labels = new Array() labels[0] = 'Main Page' labels[1] = 'Community portal' labels[2] = 'Feature' labels[3] = 'Good articles' labels[4] = 'Current events' labels[5] = 'Recent changes' labels[6] = 'Random' labels[7] = 'New pages' labels[8] = 'Statistics' labels[9] = 'Release version' labels[10] = 'Assessments' labels[11] = 'Missing pages' b[0].innerHTML = '' for (var i=0;i<urls.length;i+=1) { tableHTML = '<table valign="top" cellspacing="0" cellpadding="0">' tableHTML += '<tr>' tableHTML += '<li><td><a href="' + startUrl + urls[i] + endUrl + '">' + labels[i] + ' </a></td></li>' tableHTML += '</tr>' tableHTML += '</table>' b[0].innerHTML = b[0].innerHTML + tableHTML } } } } addOnloadHook(OptimizedNavig); function OptimizedInteract() { var a = document.getElementById("p-interaction"); if (a) { b = a.getElementsByTagName("ul"); b[0].innerHTML = ' ' } } addOnloadHook(OptimizedInteract); // Print version modifier addOnloadHook(function(){ /*by [[Invitatious]] released under GPL*/ // if(location.search.indexOf("printable=yes")>=0){ ce = document.getElementById("content"); ce.MozColumnCount=2; ce.MozColumnGap="2cm"; // } });