User:Gebruiker:Dedalus/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.
/* <nowiki> */ function replace(){ var s = prompt("Search regexp?"); if(s){ var r = prompt("Replace regexp?"); var txt = document.editform.wpTextbox1; txt.value = txt.value.replace(new RegExp(s, "g"), r); } } function addlilink(tabs, url, name, id){ var na = document.createElement('a'); na.href = url; na.id = id; na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); li.appendChild(na); tabs.appendChild(li); return li; } function addPurge(){ 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'); } function addEditSection0(){ ta['ca-edit-0'] = ['', 'Edit the zeroth section of this page']; if(!document.getElementById) return; var x = document.getElementById('ca-edit'); if(!x) return; var y = document.createElement('LI'); y.id = 'ca-edit-0'; if(x.className == 'selected'){ if(new RegExp("&action=edit§ion=0$").test(window.location.href)){ x.className = 'istalk'; y.className = 'selected'; } else { x.className = 'selected istalk'; } } else if(x.className == 'selected istalk'){ if(new RegExp("&action=edit§ion=0$").test(window.location.href)){ x.className = 'istalk'; y.className = 'selected istalk'; } else { y.className = 'istalk'; } } else { y.className = x.className; x.className = 'istalk'; } var z = document.createElement('A'); if(x.children){ z.href = x.children[0].href + '§ion=0'; z.appendChild(document.createTextNode('0')); y.appendChild(z); document.getElementById('p-cactions').children[1].insertBefore(y,x.nextSibling); }else{ z.href = x.childNodes[0].href + '§ion=0'; z.appendChild(document.createTextNode('0')); y.appendChild(z); document.getElementById('p-cactions').childNodes[3].insertBefore(y,x.nextSibling); } } function changeLinks(){ if(!document.getElementById) return; document.getElementById('pt-mytalk').firstChild.innerHTML = 'talk'; document.getElementById('pt-watchlist').firstChild.innerHTML = 'watchlist'; document.getElementById('pt-mycontris').firstChild.innerHTML = 'contributions'; } function addForceSummary(){ if(!new RegExp("&action=edit").test(window.location.href)) return; if(new RegExp("§ion=new").test(window.location.href)) return; if(!document.forms.editform) return; document.forms.editform.wpSave.onclick = forceSummary; } function forceSummary(){ if(!document.forms.editform.wpSummary.value.replace(new RegExp("^(?:/\\*.*\\*/)? *(.*) *$"),'$1')){ var r = prompt('Are you sure you want to submit without adding a summary?\nTo add a summary, type it in the box below:',document.forms.editform.wpSummary.value); if(r == null) return false; document.forms.editform.wpSummary.value = r; } return true; } function morelinks(){ var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; if(document.title.indexOf("Editing Wikipedia:Votes for deletion") == 0){ addlilink(tabs, 'javascript:closevfd("keep", "")', 'keep', ''); addlilink(tabs, 'javascript:closevfd("merge and redirect", " to [[" + prompt("Merge and redirect to?") + "]]")', 'merge', ''); addlilink(tabs, 'javascript:closevfd("redirect", " to [[" + prompt("Redirect to?") + "]]")', 'redir', ''); addlilink(tabs, 'javascript:closevfd("transwiki", " to " + prompt("Transwiki to?"))', 'trans', ''); addlilink(tabs, 'javascript:closevfd("transwiki", " to Wiktionary")', 'wikt', ''); addlilink(tabs, 'javascript:closevfd("speedy delete", "")', 'speedy', ''); addlilink(tabs, 'javascript:closevfd("delete", "")', 'del', ''); addlilink(tabs, 'javascript:closevfd(prompt("Result?"), "")', 'other', ''); addlilink(tabs, 'javascript:replace()', 'replace', ''); }else if(document.title.indexOf("Editing ") == 0){ addlilink(tabs, 'javascript:replace()', 'replace', ''); addlilink(tabs, 'javascript:vfdresult()', 'vfd result', ''); } } function addToolBoxLinks(){ var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0]; addlilink(tb, '/wiki/Special:Newpages', 'New pages', ''); addlilink(tb, '/wiki/Special:Shortpages', 'Short pages', ''); } function myLoadFuncs(){ addPurge(); addEditSection0(); changeLinks(); addForceSummary(); morelinks(); addToolBoxLinks(); } function NUPatrol() { if ( ( window.location.href.indexOf( 'Special%3ALog&type=newusers' ) == -1 ) && ( window.location.href.indexOf( 'Special:Log/newusers' ) == -1 ) ) return; // make more robust??? var items, item, i, links, user, name, talk, contribs, insertLoc, link; items = document.getElementById( 'bodyContent' ).getElementsByTagName( 'ul' )[ 0 ].getElementsByTagName( 'li' ); function NewLink( txt, url, plainlinks, linkColor ) { var a = document.createElement( 'a' ); a.appendChild( document.createTextNode( txt ) ); a.href = url; if ( plainlinks ) a.className = 'plainlinks'; if ( linkColor ) { if ( typeof linkColor == "string" ) a.style.color = linkColor; else a.style.color = '#FF0000'; // old default behavior } return a; } for ( i = 0; i < items.length; i++ ) { item = items[ i ]; links = item.getElementsByTagName( 'a' ); user = links[ 0 ]; name = user.firstChild.nodeValue; talk = links[ 2 ]; talk.firstChild.nodeValue = 'talk'; // lowercase 'Talk' for consistency contribs = links[ 3 ]; insertLoc = user.nextSibling; // ' newusers ' item.insertBefore( document.createTextNode( ' ( ' ), insertLoc ); item.insertBefore( talk, insertLoc ); item.insertBefore( document.createTextNode( ', ' ), insertLoc ); item.insertBefore( contribs, insertLoc ); item.insertBefore( document.createTextNode( ', ' ), insertLoc ); item.insertBefore( NewLink( 'actions', '/w/index.php?title=Special%3ALog&user=' + name, true, '#000088' ), insertLoc ); item.insertBefore( document.createTextNode( ', ' ), insertLoc ); item.insertBefore( NewLink( 'blocks', '/w/index.php?title=Special%3ALog&type=block&page=User%3A' + name, true, '#008800' ), insertLoc ); item.insertBefore( document.createTextNode( ', ' ), insertLoc ); item.insertBefore( NewLink( 'is blocked?', '/wiki/Special:Ipblocklist?action=search&ip=' + name, true, '#888800' ), insertLoc ); item.insertBefore( document.createTextNode( ', ' ), insertLoc ); item.insertBefore( NewLink( 'do block!', '/w/index.php?title=Special:Blockip&ip=' + name, true, '#880000' ), insertLoc ); item.insertBefore( document.createTextNode( ' )' ), insertLoc ); item.removeChild( insertLoc.nextSibling ); // should remove the span item.removeChild( insertLoc ); // should remove ' newusers ' text } } if ( window.addEventListener ) window.addEventListener( 'load', NUPatrol, false ); else if ( window.attachEvent ) window.attachEvent( 'onload', NUPatrol ); if (window.addEventListener) window.addEventListener("load",myLoadFuncs,false); else if (window.attachEvent) window.attachEvent("onload",myLoadFuncs); else{ window._old_ABCD_onload = window.onload; window.onload = function(){ window._old_ABCD_onload(); myLoadFuncs(); } } /* </nowiki> */

