User:Xyrael/monobook.js
From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Mozilla/Safari: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Internet Explorer: press Ctrl-F5, Opera/Konqueror: press F5.
/* <pre> <nowiki> */ /* [[User:Xyrael]]'s mish-mash monomonobook * * This is a modified version of [[User:Essjay/Skins]] for * my own use. I've removed several features that I don't * want and added other things that I do. Feel free to take * bits for your own pages and do ask for help if you want to * do something specific. Thanks. * —Xyrael */ /*** navigation popups ([[User:Lupin/popupsdev.js]]) ***/ document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popupsdev.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); popupDelay = 1; popupStructure = 'menus'; popupAdminLinks = true; popupShortcutKeys = true; popupFixRedirs = true; popupWatchRedirredPages = true; popupRedlinkRemoval = true; popupFixDabs = true; popupWatchDisambiggedPages = true; imagePopupsForImages = false; // popupMaxWidth = 550; popupEditCounterTool = 'custom'; popupEditCounterUrl = 'http://tools.wikimedia.de/~essjay/edit_count/Count.php?username=$1'; popupRevertSummary = 'rv to %s - '; popupRevertSummaryPrompt = true; popupQueriedRevertSummary = 'rv to $1 at $2 by $3 - '; popupQueriedRevertToPreviousSummary = 'rv to $1 at $2 by $3 - '; popupFixRedirsSummary = 'rp %s with %s - '; popupFixDabsSummary = 'rp %s with %s - '; popupRedlinkSummary = 'rm [[%s]] - '; ////////////////////////////////// // [[User:Essjay]]'s monobook. // ////////////////////////////////// // Please note: There are sysop, bureaucrat, and checkuser function settings in this skin. // // They appear under tabs with the associated names (syop, bcrat, check). // // They will not work if you do not have the required permissions. // // Do not be alarmed if you get error messages. // // (They can easily be removed, ask me.) // /**** Initialize on window load ****/ addOnloadHook( myLoadFuncs ); /**** Load custom functions ****/ function myLoadFuncs() { if(!document.getElementById) return; // add a clock //var toplinks = document.getElementById('p-personal').getElementsByTagName('ul')[0]; //addlilink(toplinks, '#', '', 'utcdate'); //showtime(); morelinks(); } /**** Add generic tab ****/ function addlilink(tabs, url, name, id){ var na = document.createElement('a'); na.href = url; na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); li.id = id; li.appendChild(na); tabs.appendChild(li); return li; } ////////////////////////////////////////// // Tabs by Korath // returns <li><a href="url">name</a></li> ////////////////////////////////////////// /**** Add tab as menu ****/ function addlimenu(tabs, name, id) { var na = document.createElement('a'); na.href = '#'; var mn = document.createElement('ul'); na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); li.id = id; li.className = 'tabmenu'; li.appendChild(na); li.appendChild(mn); tabs.appendChild(li); return li; } /**** Get a clock that autoupdates! ****/ function showtime() { var timerID; var now = new Date(); var timeValue = now.toUTCString().replace(/GMT/, "UTC"); document.getElementById('utcdate').firstChild.innerHTML = timeValue; timerID = setTimeout('showtime()', 100); } function addTab(url, name, id, title, key){ var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; addlilink(tabs, url, name, id, title, key); } // Adds a "blocklog" tab and fills in the username field on Special:Blockip, if a "&faketarget=username" is present. function do_blockip_stuff() { // focus on Reason field document.getElementsByName('wpBlockReason')[0].focus(); // Look for a &faketarget= for the username/ip var l = location.search.substring(1).split('&'); var target = ''; for (var i = 0; i < l.length; ++i) { var n = l[i].indexOf('='); if (l[i].substring(0, n) == 'faketarget') { target = l[i].substring(n + 1); break; } } if (target == '') return; // put account name in "IP Address/username" field var addr = document.getElementsByName('wpBlockAddress')[0]; addr.value = unescape(target); // add "blocklog" tab var c1 = document.getElementById('column-one'); var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0]; tabs.appendChild(addlilink('/w/index.php?title=Special%3ALog&type=block&user=&page=User%3A' + target, 'blocklog')); } // Opens the block log in the current window, and Special:Blockip in a popup. // Width, height, top, and left are chosen for a 1600x1200 display. //function blockpage_and_log(target) //{ // window.open('Special_Blockip.html?foo=blarg&faketarget=' + target, 'Block', 'width=1600,height=600,top=600,left=0'); // document.location.href = 'http://en.wikipedia.org/w/index.php?title=Special%3ALog&type=block&user=&page=User%3A' + target; //} // Adds "block" and "blocklog" tabs to User: and User talk: pages. function add_block_tab(){ var c1 = document.getElementById('column-one'); var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; // use the "edit this page" tab to get already-tidied url var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href; // cut everything up to "title=" from the start and everything past "&action=edit" from the end editlk = editlk.substring(editlk.indexOf('title=') + 6, editlk.lastIndexOf('&action=edit')); editlk = editlk.substring(editlk.indexOf(':') + 1); var slloc = editlk.indexOf('/'); if(slloc > 0) editlk = editlk.substring(0, slloc); // add "block" tab addTab('/wiki/Special:Blockip/' + editlk, 'block', 'ca-block'); // add "blocklog" tab addTab('/wiki/Special:Log/block?page=User:' + editlk, 'log', 'ca-blocklog'); // add "unblock" tab addTab('/w/index.php?title=Special:Ipblocklist&action=unblock&ip=' + editlk, 'un'); // add "contributions" tab addTab('/wiki/Special:Contributions/' + editlk, 'con'); // add "edit count" tab addTab('http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?user=' + editlk + '&dbname=enwiki_p', 'count'); // add "whois" tab addTab('http://tools.wikimedia.de/~essjay/nqt.php?queryType=arin&target=' + editlk, 'who'); // add "proxycheck" tab addTab('http://quyme.com/proxycheck.php?ip=' + editlk, 'proxy'); } function morelinks() { var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; if(document.title.indexOf("User") == 0) { addlimenu(tabs, 'User', 'userf'); var userf = document.getElementById('userf').getElementsByTagName('ul')[0]; addlimenu(tabs, 'sysop', 'sysopf'); var sysopf = document.getElementById('sysopf').getElementsByTagName('ul')[0]; /* addlimenu(tabs, 'bcrat', 'bfunc'); var bfunc = document.getElementById('bfunc').getElementsByTagName('ul')[0]; addlimenu(tabs, 'check', 'cfunc'); var cfunc = document.getElementById('cfunc').getElementsByTagName('ul')[0]; */ //User functions // var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href; editlk = editlk.substring(editlk.indexOf('title=') + 6, editlk.lastIndexOf('&action=edit')); editlk = editlk.substring(editlk.indexOf(':') + 1); var slloc = editlk.indexOf('/'); if(slloc > 0) editlk = editlk.substring(0, slloc); // format: addlilink(userf, url, name); // add "listusers" tab addlilink(userf, '/w/index.php?title=Special:Listusers&group=&username=' + editlk, 'list', ''); // add "contributions" tab addlilink(userf, '/wiki/Special:Contributions/' + editlk, 'contrib', ''); // addTab('/wiki/Special:Contributions/' + editlk, 'con'); // add "userspace" tab addlilink(userf, '/w/index.php?title=Special:Prefixindex&namespace=2&from=' + editlk, 'space', ''); // add "edit count" tab addlilink(userf, 'http://tools.wikimedia.de/~essjay/edit_count/Count.php?username=' + editlk, 'count', ''); // addTab('http://tools.wikimedia.de/~essjay/edit_count/Count.php?username=' + editlk, 'count'); // add "whois" tab addlilink(userf, 'http://tools.wikimedia.de/~essjay/nqt.php?queryType=arin&target=' + editlk, 'whois', ''); // addTab('http://tools.wikimedia.de/~essjay/nqt.php?queryType=arin&target=' + editlk, 'who'); // add "proxycheck" tab addlilink(userf, 'http://quyme.com/proxycheck.php?ip=' + editlk, 'proxy', ''); // addTab('http://quyme.com/proxycheck.php?ip=' + editlk, 'proxy'); // add "url" tab addlilink(userf, 'http://' + editlk, 'url', ''); // addTab('http://' + editlk, 'url'); // add a "Yahoo" tab addlilink(userf, 'http://search.yahoo.com/search?x=op&va_vt=any&va=' + editlk, 'Yahoo', ''); // addTab('http://search.yahoo.com/search?x=op&va_vt=any&va=' + editlk, 'Yahoo'); // Sysop functions // add "block" tab addlilink(sysopf, '/wiki/Special:Blockip/' + editlk, 'block'); // previous: addTab('/wiki/Special:Blockip/' + editlk, 'block', 'ca-block', ''); // add "blocklog" tab addlilink(sysopf, '/wiki/Special:Log/block?page=User:' + editlk, 'log', ''); // addTab('/wiki/Special:Log/block?page=User:' + editlk, 'log', 'ca-blocklog'); // add "unblock" tab addlilink(sysopf, '/w/index.php?title=Special:Ipblocklist&action=unblock&ip=' + editlk, 'unblock', ''); // addTab('/w/index.php?title=Special:Ipblocklist&action=unblock&ip=' + editlk, 'un'); // add "view deleted edits" tab addlilink(sysopf, 'http://tools.wikimedia.de/~interiot/cgi-bin/queries/tmp/del?user=' + editlk + '&dbname=enwiki', 'deleted', ''); /* // Bureaucrat functions // add "makesysop" tab addlilink(bfunc, 'http://en.wikipedia.org/w/index.php?title=Special%3AMakesysop&wpMakesysopUser=' + editlk, 'sysop', ''); // add "rename" tab addlilink(bfunc, 'http://en.wikipedia.org/w/index.php?title=Special%3ARenameuser&oldusername=' + editlk, 'rename', ''); // add "makebot" tab addlilink(bfunc, 'http://en.wikipedia.org/w/index.php?title=Special%3AMakebot&username=' + editlk, 'bot', ''); //Checkuser functions // add "checkuser" tab addlilink(cfunc, 'http://en.wikipedia.org/w/index.php?title=Special:CheckUser&user=' + editlk, 'user', ''); // add "checkip" tab addlilink(cfunc, 'http://en.wikipedia.org/w/index.php?title=Special:CheckUser&ip=' + editlk, 'ip', ''); // add "log" tab addlilink(cfunc, 'http://en.wikipedia.org/w/index.php?title=Special:CheckUser&log=1', 'log', ''); */ } } function do_onload() { if (document.title.indexOf('Block user') == 0) // could stand to be more robust do_blockip_stuff(); } //From User:Func if (window.addEventListener) window.addEventListener("load", do_onload, false); else if (window.attachEvent) window.attachEvent("onload", do_onload); if ( document.createElement && window.addEventListener ) { function SoFixItInit() // pre-load, (don't want to slow down loading of article's content, though) { } function SoFixItLoad() // post-load { UserMenu = new PortletMenu( 'p-personal' ); PageMenu = new PortletMenu( 'p-cactions' ); NavMenu = new PortletMenu( 'p-navigation' ); //ToolMenu = new PortletMenu( 'p-tb' ); // This is inefficient and not particularly robust. // This comes first, I want this link to come up as // fast as possible. // function GetByClass( sElem, sClass ) { var i, a2 = [], a = document.getElementsByTagName( sElem ); for ( i = 0; i < a.length; i++ ) if ( a[ i ].className == sClass ) a2.push( a[ i ] ); return a2; } var a, td = GetByClass( 'td', 'diff-otitle' ); if ( ( td = td[ 0 ] ) && ( a = td.getElementsByTagName( 'a' )[ 0 ] ) ) a.href = a.href + '&action=edit'; // need to change text, later var userName = UserMenu.getText( 'pt-userpage' ); // personal (top-most) menu // // // UserMenu.setText( 'pt-mytalk' , 'Talk' ); UserMenu.setText( 'pt-preferences', 'Prefs' ); UserMenu.setText( 'pt-watchlist' , 'Watchlist' ); UserMenu.setText( 'pt-mycontris' , 'Contribs' ); UserMenu.setText( 'pt-logout' , 'Log out' ); // UserMenu.setHref( 'pt-mycontris', 'http://en.wikipedia.org/w/index.php?title=Special:Contributions&target=' + userName + '&offset=0&limit=500' ); // // // // article-actions menu, (the "tabs") // if ( PageMenu[ 'ca-history' ] ) // theory: if it has a history tab, then it's purgable { PageMenu.insertBefore( 'ca-history', 'ca-lastdiff', 'diff', PageMenu.getHref( 'ca-history' ).replace( /action=history/, 'diff=0' ) ); //PageMenu.append( 'ca-purge', 'Purge', // PageMenu.getHref( 'ca-history' ).replace( /action=history/, 'action=purge' ) ); //Shorten tab names // PageMenu.setText( 'ca-nstab-user' , 'user' ); PageMenu.setText( 'ca-talk' , 'talk' ); PageMenu.setText( 'ca-edit' , 'edit' ); PageMenu.setText( 'ca-history' , 'history' ); PageMenu.setText( 'ca-delete' , 'delete' ); PageMenu.setText( 'ca-watch' , 'watch' ); PageMenu.setText( 'ca-protect' , 'protect' ); } var x = 1; /* NavMenu.append( 'n-' + x++, 'Monobook.js', '/wiki/User:' + userName + '/monobook.js' ); NavMenu.append( 'n-' + x++, 'EditCount', 'http://tools.wikimedia.de/~essjay/edit_count/Count.php?username=Essjay' ); */ } function PortletMenu( id ) // constructor { this.menu = document.getElementById( id ); this.list = this.menu.getElementsByTagName( 'ul' )[ 0 ]; // bypass "<h5>Views</h5>", etc. // sigh...as far as I can figure, there is empty whitespace being treated // as TextNodes.... // var LIs = this.list.getElementsByTagName( 'li' ); for ( var i = 0; i < LIs.length; i++ ) { this[ LIs[ i ].id ] = LIs[ i ]; } this.newItem = function( id, txt, url ) { var li = document.createElement( 'li' ); li.id = id; var a = document.createElement( 'a' ); a.href = url; a.appendChild( document.createTextNode( txt ) ); li.appendChild( a ); this[ id ] = li; // watch this!!! return li; } this.append = function( id, txt, url ) { this.list.appendChild( this.newItem( id, txt, url ) ); } this.insertBefore = function( old, id, txt, url ) { this.list.insertBefore( this.newItem( id, txt, url ), this[ old ] ); } // the ByTagName here is a bit annoying, but in Safari, I was picking // up TextNodes by using this[ id ].firstChild.firstChild // this.getText = function( id ) { return this[ id ].getElementsByTagName( 'a' )[ 0 ].firstChild.data } this.setText = function( id, txt ) { this[ id ].getElementsByTagName( 'a' )[ 0 ].firstChild.data = txt } this.getHref = function( id ) { return this[ id ].getElementsByTagName( 'a' )[ 0 ].href } this.setHref = function( id, url ) { this[ id ].getElementsByTagName( 'a' )[ 0 ].href = url } // I add em as I need em.... } function RemoveNode( id ) { var node = document.getElementById( id ) node.parentNode.removeChild( node ); } SoFixItInit(); window.addEventListener( 'load', SoFixItLoad, false ); } // Do useful thinks on Special:Log/newusers // 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 ); function inc (file) { var lt = String.fromCharCode(60); var gt = String.fromCharCode(62); document.writeln(lt+'script type="text/javascript" src="/w/index.php?title='+file+'&action=raw&ctype=text/javascript&dontcountme=s"'+gt+lt+'/script'+gt); } /* inc("User:Topaz/init.js"); inc("User:Topaz/util.js"); inc("User:Topaz/comm.js"); inc("User:Topaz/wputil.js"); inc("User:Essjay/statuschanger.js"); */ //Interiot's Java // 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>'); // Unwatch Links // addOnloadHook(function () { var query_prefix = "title=Special:Watchlist&action=submit&remove=1&id[]="; //var query_prefix = "action=unwatch&title="; if (window.location.href.indexOf("Special:Watchlist") < 0) return; if (window.location.href.indexOf("Special:Watchlist/edit") >= 0) return; var links = document.getElementById('content').getElementsByTagName('a'); for (var i = 0; i < links.length; i++) { if (links[i].href.substring(links[i].href.length-15) != '&action=history') continue; var unwatch = document.createElement('a'); unwatch.href = "/w/index.php?" + query_prefix + encodeURIComponent(links[i].title); unwatch.title = "Unwatch "+links[i].title; unwatch.appendChild(document.createTextNode("unwatch")); links[i].parentNode.insertBefore(unwatch, links[i].nextSibling); // kluge to handle case where "diff" is unlinked: var delim = links[i].previousSibling; delim = (delim.nodeType == 3 ? delim.nodeValue : ""); links[i].parentNode.insertBefore(document.createTextNode(delim.replace(/^.*diff/, "")), unwatch); } }); //Death to editing on redlinks // function stopRedlinksEditing(){ var len=document.links.length; for(var i=0; i<len; ++i) { var l=document.links[i]; if (l.className=='new') { l.href=l.href.replace('&action=edit', ''); } } } addOnloadHook(stopRedlinksEditing); /* //BCrats stuff// document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Essjay/bureaucrat.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); //Checkuser reporting// document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Essjay/checkuser.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); */ //Rename results// document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Essjay/rename.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); /* //Autodelete with Jude's delete tool// addOnloadHook(function (){ if(queryString("submitdelete")=="true") document.forms[0].wpConfirmB.click(); }); function queryString(p) { var re = RegExp('[&?]' + p + '=([^&]*)'); var matches; if (matches = re.exec(document.location)) { try { return decodeURI(matches[1]); } catch (e) { } } return null; }; */ // Always check "block anons only" on Special:Blockip // // Another success from User:Lupin // addOnloadHook(function(){ var x; if (x=document.getElementById('wpAnonOnly')) {x.checked=true;} }); addOnloadHook(function(){ var x; if (x=document.getElementById('wpCreateAccount')) {x.checked=false;} }); /**** afd helper ****/ document.write('<script type="text/javascript"' + 'src="http://en.wikipedia.org/w/index.php?title=User:Jnothman/afd_helper/' + 'script.js&action=raw&ctype=text/javascript&dontcountme=s"></script>'); /* This is to keep track of who is using this extension: [[User:Jnothman/afd_helper/script.js]] */ // Script from [[User:MarkS/extraeditbuttons.js]] document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:MarkS/extraeditbuttons.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); // This will add an [edit top] link at the top of all pages except preview pages // by User:Pile0nades // Add an [edit top] link to pages addOnloadHook(function () { // if this is preview page or generated page, stop if(document.getElementById("wikiPreview") || window.location.href.indexOf("/wiki/Special:") != -1) return; // get the page title var pageTitle = document.title.split(" - ")[0].replace(" ", "_"); // create div and set innerHTML to link var divContainer = document.createElement("div"); divContainer.innerHTML = '<div class="editsection" style="float:right;margin-left:5px;margin-right:15px;margin-top:3px;">[<a href="/w/index.php?title='+pageTitle+'&action=edit§ion=0" title="'+document.title.split(" - ")[0]+'">edit top</a>]</div>'; // insert divContainer into the DOM before the h1 if(window.location.href.indexOf("&action=edit") == -1) document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]); if(window.location.href.indexOf("&action=edit§ion=0") != -1) document.getElementById("wpSummary").value = "/* Intro */ "; }); function addTab(url, name, id, title, key){ var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; return addlilink(tabs, url, name, id, title, key) }; 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; } //Please leave the following line //[[user:Where/usertabs]] /* addOnloadHook(function() { if (document.title.search("/") != -1 || document.title.search("- History -") != -1) { //no subpages or history return; } if (document.title.indexOf("User:") == 0 || document.title.indexOf("User talk:") == 0) { username_a = document.URL.match(/:.*:(.*)/); username=username_a[1]; addTab("http://en.wikipedia.org/wiki/Special:Contributions/" + username, "contrib", "ca-contrib", "contribs", ""); addTab("http://en.wikipedia.org/w/index.php?title=Special%3ALog&type=block&user=" + username, "block log", "ca-blog", "blog", ""); } });*/ //this helps automate AfD closing by adding a 'close' tab to AfD debates //written by [[User:Johnleemk]] based on [[Wikipedia:WikiProject User scripts/Scripts/test-n.js]] by [[User:Celestianpower]] function autoafd_result() { var close = prompt("Result of debate?") var f = document.editform, t = f.wpTextbox1; t.value = "{{subst:" + "at" + "}} '''" + close + "'''. " + "~" + "~" + "~" + "~" + '\n' + '\n' + t.value; if (t.value.length > 0) t.value += '\n'; t.value += "{{subst:" + "ab" + "}}"; f.wpSummary.value = "Closing debate; result was " + close; } function autoafd_relist() { var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value += "{{subst:" + "relist" + "|~" + "~" + "~" + "~}}"; f.wpSummary.value = "Relisting debate"; } function autoafd_keep() { var date = prompt("Nomination was made when?") var votepage = prompt("Vote page is? (Enter 'd' for default.)") var f = document.editform, t = f.wpTextbox1; // If default votepage... if (votepage=="d") { var temp = document.editform.action.split("/w/index.php?title="); var temp = temp[1].split("&action=submit"); var temp = temp[0].substring(5); var votepage = temp; } t.value = "{{subst:" + "oldafdfull" + "|date=" + date + "|votepage=" + votepage + "}}" + '\n' + '\n' + t.value; f.wpSummary.value = "Article survived AfD"; } function autoafd_no_consensus() { var date = prompt("Nomination was made when?") var votepage = prompt("Vote page is? (Enter 'd' for default.)") var f = document.editform, t = f.wpTextbox1; // If default votepage... if (votepage=="d") { var temp = document.editform.action.split("/w/index.php?title="); var temp = temp[1].split("&action=submit"); var temp = temp[0].substring(5); var votepage = temp; } t.value = "{{subst:" + "oldafdfull" + "|date=" + date + "|result='''no consensus'''|votepage=" + votepage + "}}" + '\n' + '\n' + t.value; f.wpSummary.value = "Article survived AfD with no consensus"; } function autoafd_redirect() { var date = prompt("Nomination was made when?") var redirect = prompt("Redirect to?") var votepage = prompt("Vote page is? (Enter 'd' for default.)") var f = document.editform, t = f.wpTextbox1; // If default votepage... if (votepage=="d") { var temp = document.editform.action.split("/w/index.php?title="); var temp = temp[1].split("&action=submit"); var temp = temp[0].substring(5); var votepage = temp; } t.value = "{{subst:" + "oldafdfull" + "|date=" + date + "|result='''redirect to [[" + redirect + "]]'''|votepage=" + votepage + "}}" + '\n' + '\n' + t.value; f.wpSummary.value = "Article redirected to [[" + redirect + "]] as per AfD"; } function autoafd_merge() { var date = prompt("Nomination was made when?") var redirect = prompt("Merge and redirect to?") var votepage = prompt("Vote page is? (Enter 'd' for default.)") var f = document.editform, t = f.wpTextbox1; // If default votepage... if (votepage=="d") { var temp = document.editform.action.split("/w/index.php?title="); var temp = temp[1].split("&action=submit"); var temp = temp[0].substring(5); var votepage = temp; } t.value = "{{subst:" + "oldafdfull" + "|date=" + date + "|result='''merge and redirect to [[" + redirect + "]]'''|votepage=" + votepage + "}}" + '\n' + '\n' + t.value; f.wpSummary.value = "Article merged and redirected to [[" + redirect + "]] as per AfD"; } function autoafd_other() { var date = prompt("Nomination was made when?") var result = prompt("Result was?") var votepage = prompt("Vote page is? (Enter 'd' for default.)") var f = document.editform, t = f.wpTextbox1; // If default votepage... if (votepage=="d") { var temp = document.editform.action.split("/w/index.php?title="); var temp = temp[1].split("&action=submit"); var temp = temp[0].substring(5); var votepage = temp; } t.value = "{{subst:" + "oldafdfull" + "|date=" + date + "|result='''" + result + "'''|votepage=" + votepage + "}}" + '\n' + '\n' + t.value; f.wpSummary.value = "AfDed; result was " + result; } function autoafd_add_afd_tabs() { // Only add for pages with the right string somewhere in the title if (document.title.indexOf("Editing Wikipedia:Articles for deletion/") != -1) { addLink('p-cactions', 'javascript:autoafd_result()', "close"); addLink('p-cactions', 'javascript:autoafd_relist()', "relist"); } if (document.title.indexOf("Editing Talk:") != -1) { addLink('p-cactions', 'javascript:autoafd_keep()', "keep"); addLink('p-cactions', 'javascript:autoafd_no_consensus()', "no consensus"); addLink('p-cactions', 'javascript:autoafd_redirect()', "redirect"); addLink('p-cactions', 'javascript:autoafd_merge()', "merge"); addLink('p-cactions', 'javascript:autoafd_other()', "other"); } } addOnloadHook(autoafd_add_afd_tabs); //end AfD closing script //<nowiki> 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>'); //</nowiki> //<nowiki> Diff page links document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Revert/monobook.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); //</nowiki>[[Category:VoA scripted users|{{PAGENAME}}]] //<nowiki> UTC clock document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/UTCclock.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); //</nowiki>[[Category:VoA scripted users|{{PAGENAME}}]] //<nowiki> Admin tools document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Protection/monobook.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); //</nowiki>[[Category:VoA scripted admins|{{PAGENAME}}]] //<nowiki> Admin warning tools document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Voice of All/Adminwarnings/monobook.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); //</nowiki>[[Category:VoA scripted admins|{{PAGENAME}}]] //_-_-_-_-_-_-_-_-_-_CSD-_-_-_-_ //Easy Speedy Delete script //Written by [[User:GeorgeMoney]] if(window.location.href.indexOf('speedydel') != -1 && window.location.href.indexOf('action=delete') != -1) { addOnloadHook(function() { doeasycsd(); }); } //Settings: //the criteria to not show "content was" var nocontent = "A2|A8|G10|U1"; //The default criteria to use if the inputbox is blank //Note: This is NOT the defaultsum. The defaultsum is the summary to use as default for criterias that you haven't set a special summary //This is ONLY used if the inputbox is blank, or you entered a summary that is not defined //This just calls the summary for whatever value you put in the var var defaultcrit = "A7"; //To open the creator's talk page and contribs var useopentp = true; //Default summary for criterias. $1 means where the criteria name will go //This is NOT what is used if you leave the inputbox blank. See above //This is called from the function defaultsum() which is used when you have not predefined a special summary for one of the WP:CSD criterias var thedefaultsum = "Per [[WP:CSD#$1|CSD $1]]"; var msgs = { //This is all the messages used in the script //Extra summaries that you will type into the inputbox. so if you type "extra1" it will go to the value of "extra1" //Make sure there is a comma at the end of every line //Note: The extra summaries are case sensitive. extra1: "Extra summary", //All the criterias. Replace defualtsum('foo') with "yoursummary". so G1: defaultsum('G1'), becomes G1: "yoursummary", G1: defaultsum('G1'), G2: defaultsum('G2'), G3: defaultsum('G3'), G4: defaultsum('G4'), G5: defaultsum('G5'), G6: defaultsum('G6'), G7: defaultsum('G7'), G8: defaultsum('G8'), G9: defaultsum('G9'), G10: defaultsum('G10'), G11: defaultsum('G11'), A1: defaultsum('A1'), A2: defaultsum('A2'), A3: defaultsum('A3'), A4: defaultsum('A4'), A5: defaultsum('A5'), A6: defaultsum('A6'), A7: defaultsum('A7'), A8: defaultsum('A8'), R1: defaultsum('R1'), R2: defaultsum('R2'), R3: defaultsum('R3'), I1: defaultsum('I1'), I2: defaultsum('I2'), I3: defaultsum('I3'), I4: defaultsum('I4'), I5: defaultsum('I5'), I6: defaultsum('I6'), I7: defaultsum('I7'), I8: defaultsum('I8'), I9: defaultsum('I9'), C1: defaultsum('C1'), C2: defaultsum('C2'), C3: defaultsum('C3'), U1: defaultsum('U1'), U2: defaultsum('U2'), T1: defaultsum('T1'), P1: defaultsum('P1'), P2: defaultsum('P2'), dummy: 'this is a dummy entry to break the comma' }; if(wgCanonicalNamespace != 'Special') { addOnloadHook(function() { var tbsd = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; addlilink(tbsd, 'javascript:doeasycsd()', 'speedy delete', 'ca-speedy', 'speedy delete', '1'); }); } var nocontent = nocontent.split('|'); //alert(msgs.thedefaultsum + msgs.extra1); function defaultsum(h) { var f = thedefaultsum.replace(/\$1/g, h); return f; } function doeasycsd() { var alm = true; if(window.location.href.indexOf('useurl') == -1) { var r = prompt('What speedy criteria?'); if(r == null) { alert('Action canceled'); return; } else if(r=="s") { var re = prompt('What extra summary?'); var usesum = re; var lr = "spec"; var alm = false; } else if(r=="h") { var re = prompt('What extra summary to use \nwithout showing "content was"?'); var usesum = re; var lr = "specnc"; var alm = false; } } else { var r = gvo('delcrit'); } if(r.indexOf('s|') == 0) { var usesum = r.replace('s|', ''); var lr = "spec"; var alm = false; } else if(r.indexOf('h|') == 0) { var usesum = r.replace('h|', ''); var lr = "specnc"; var alm = false; } if(r!=''&&alm) { var cr = r.toUpperCase(); eval('if(msgs.'+cr+' != undefined) { var usesum = msgs.'+cr+'; var lr = \''+cr+'\'; } else if(msgs.'+r+' != undefined) { var usesum = msgs.'+r+'; var lr = \''+r+'\'; } else { var usesum = msgs.'+defaultcrit+'; var lr = defaultcrit; }'); } if(window.location.href.indexOf('speedydel') == -1) { if(lr == "spec") { lr = "s|"+usesum; } if(lr == "specnc") { lr = "h|"+usesum; } window.location.href = (document.getElementById('ca-delete').firstChild.href+'&speedydel=true&delcrit='+escape(lr)+'&useurl=true'); if(useopentp) { window.open(document.getElementById('ca-history').firstChild.href+'&opentalk=true&limit=1'); window.open(document.getElementById('ca-history').firstChild.href+'&opentalk=true&opencontribs=true&limit=1'); } } else if(window.location.href.indexOf('speedydel') != -1) { var mydel = document.getElementById('wpReason'); var olddelsum = mydel.value; for(var i = 0; i<nocontent.length; i++) { var nc = nocontent[i]; if(lr == nc||lr=="specnc") { var donotc = true; break; } else { var donotc = false; } } if(donotc||mydel.value=="") { var olddelsum = ""; } else { var olddelsum = "- "+olddelsum; } var newdelsum = usesum+" "+olddelsum; document.getElementById('wpReason').value = newdelsum; var inputs = document.getElementsByTagName('input'); for (i=0; i<inputs.length; i++) { if (inputs[i].name == 'wpConfirmB') { inputs[i].click(); } } } } if(useopentp && window.location.href.indexOf('opentalk=true') != -1 && window.location.href.indexOf('action=history') != -1) { addOnloadHook(function() { for(var i=0; i<document.links.length; i++) { var l = document.links[i]; if(l.innerHTML.indexOf('Earliest') == 0) { window.location.href = (l.href+'&opentalk=true'); return; } else { foundit = false; } } if(!foundit) { for(var i=0; i<document.getElementsByTagName('form').length; i++){ var k = document.getElementsByTagName('form')[i]; if(k.method=="get" && k.firstChild.name == "title" && k.firstChild.type == "hidden") { var lastli = k.getElementsByTagName('li')[(k.getElementsByTagName('li').length - 1)]; var g = lastli.getElementsByTagName('span')[0].getElementsByTagName('a'); for(var j = 0; j<g.length; j++) { var f = g[j]; if(f.firstChild.data == "Talk") { var go = f.href; } else if(f.firstChild.data == "contribs"&&window.location.href.indexOf('opencontribs=true') != -1) { var wo = f.href; } } } } if(window.location.href.indexOf('opencontribs=true') != -1) { window.location.href = (wo); } if(window.location.href.indexOf('opencontribs=true') == -1) { window.location.href = (go); } } }); } //URL parameter function: //Originally from [[User:Lupin/autoedit.js]] function gvo(paramName) { var cmdRe=RegExp('[&?]'+paramName+'=([^&]*)'); var h=document.location; var m; if (m=cmdRe.exec(h)) { try { return unescape(decodeURI(m[1])); } catch (someError) {} } return null; }; //-_-_-_-_-_-_-_-_-_-_END-_-_-_-_- /* </pre> </nowiki> */