User:Antonrojo/monobook.js

/* */ //2. document.write stuff

// User:Lupin/popups.js - please include this line

mw.loader.load(            'https://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'             + '&action=raw&ctype=text/javascript&dontcountme=s');

// jncsp-start The section below (up to jncsp-end) is maintained by WikiProject_User_scripts/User-script_manager // jncsp-config

if (location.href == "http://en.wikipedia.org/wiki/Wikipedia:WikiProject_User_scripts/User-script_manager") document.write(' ');

// jncsp-end /* */

//5. Add WikEd. Cannot be within tags

// install User:Cacycle/wikEd in-browser text editor document.write('');

//6. Add 'test N' shortcut for user pages

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 testn(number) { var page = prompt("Vandalism to which article?") var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value += "" + page + " ~" + "~" + "~" + "~"; f.wpSummary.value = "Vandalism to " + page + " - warning " + number; }

function add_testn_tabs { var c1 = document.getElementById('column-one'); var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];

// Only add for pages with "Editing User talk:" somewhere in the title if (document.title.indexOf("Editing User talk:") != -1) { tabs.appendChild(tnaddlilink('javascript:testn(1)',"t1")); tabs.appendChild(tnaddlilink('javascript:testn(2)',"t2")); tabs.appendChild(tnaddlilink('javascript:testn(3)',"t3")); tabs.appendChild(tnaddlilink('javascript:testn(4)',"t4")); } }

addOnloadHook(add_testn_tabs);

//

//7. Adds Talk page tabs for contribs etc

// Please leave the following line // user:Where/usertabs

addOnloadHook(function { if (wgTitle.indexOf("/") != -1 || document.title.indexOf("- History -") != -1) //no subpages or history return; if (wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk") { var username = encodeURIComponent( wgTitle ); mw.util.addPortletLink("p-cactions", wgServer + "/wiki/Special:Contributions/" + username, "Contribs", "ca-contrib", "User contributions"); mw.util.addPortletLink("p-cactions", "http://tools.wikimedia.de/~interiot/cgi-bin/Tool1/wannabe_kate?username=" + username + "&site=en.wikipedia.org", "Edit count", "ca-editcount", "Edit count from Interiot's Tool1"); mw.util.addPortletLink("p-cactions", wgServer + "/w/index.php?title=Special:Log&type=move&user=" + username, "Page moves", "ca-pagemoves", "Page moves by this user"); mw.util.addPortletLink("p-cactions", wgServer + "/w/index.php?title=Special:Log&type=block&page=User:" + username, "Blocks received", "ca-blog", "Blocks received by this user"); mw.util.addPortletLink("p-cactions", wgServer + "/w/index.php?title=Special:Prefixindex&from=" + username + "&namespace=2", "Userspace", "", "List of pages in this user's userspace"); mw.util.addPortletLink("p-cactions", wgServer + "/w/index.php?title=Special:Log&type=block&user=" + username, "Blocks given", "", "Blocks by this user"); mw.util.addPortletLink("p-cactions", wgServer + "/w/index.php?title=Special:Log&type=protect&user=" + username, "Protections", "", "Protections by this user"); mw.util.addPortletLink("p-cactions", wgServer + "/w/index.php?title=Special:Log&type=delete&user=" + username, "Deletions", "", "Deletions by this user"); } });

//

//8. Watchlist for 'what links here?' // Script from User:Tra/whatlinksherewatchlist.js importScript('User:Tra/whatlinksherewatchlist.js'); //User:Tra/whatlinksherewatchlist.js

//Changes since last load link for watchlist

addOnloadHook(function { if (!wgCanonicalSpecialPageName || wgCanonicalSpecialPageName != "Watchlist") return; if (!document.forms[0] || !document.forms[0].namespace) return;

var link = document.createElement('a'); link.id = 'listSince'; link.href = '#listSince'; // must have a href to show as link!

var then = +(new Date); var fixLinkHref = function { var url = window.location.href.split('#')[0]; var days = ( +(new Date) - then )/(1000 * 3600 * 24); if (url.match(/[?&]days=/)) this.href = url.replace(/([?&]days=)[^&]*/, '$1'+days); else this.href = url + (url.indexOf('?') < 0 ? '?':'&') + 'days=' + days; return true; }; link.onclick = fixLinkHref; link.onmousedown = fixLinkHref; // react to middle clicks too

var frag = document.createDocumentFragment; frag.appendChild(document.createTextNode(' | ')); frag.appendChild(link); link.appendChild(document.createTextNode('Changes')); frag.appendChild(document.createTextNode(' since last load.'));

// just one little ID attribute would be _so_ nice... var nsSelectForm = document.getElementsByTagName('form')[0]; nsSelectForm.parentNode.insertBefore(frag, nsSelectForm); });

// //9. Unwatch links on watch list

addOnloadHook(function {

// Check if we're on the watchlist if (!wgCanonicalSpecialPageName || wgCanonicalSpecialPageName != "Watchlist") return; if (!document.forms[0] || !document.forms[0].namespace) return;

// Unwatch links go back to watchlist with "Removing requested items from watchlist..." message var query_prefix = "title="+encodeURIComponent(mw.config.get('wgPageName'))+"&action=submit&remove=1&id[]=";

// ...or... // Unwatch links go to "Removed from watchlist" page //var query_prefix = "action=unwatch&title=";

// get list of all links in content: var links = document.getElementById('content').getElementsByTagName('a');

// make a static copy of the nodelist and lose the original for speed // while we're at it, prune the uninteresting links from the list var linksCopy = new Array ; for (var i = 0; i < links.length; i++) { if (/[?&]action=history([&#]|$)/.test(links[i].href)) linksCopy.push(links[i]); } links = linksCopy;

for (var i = 0; i < links.length; i++) { // create unwatch link and append it after history link var unwatch = document.createElement('a'); unwatch.href = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + "/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);

// insert a delimiter between the two links var delim = links[i].previousSibling; delimText = (delim.nodeType == 3 ? delim.nodeValue : ""); // kluge to handle case where "diff" is unlinked delim = document.createTextNode(delimText.replace(/^.*diff/, "")); links[i].parentNode.insertBefore(delim, unwatch); } });

//10. User watchlist (watch contribs) // Script from User:Tra/userwatchlist.js importScript('User:Tra/userwatchlist.js'); //User:Tra/userwatchlist.js

// //11. Auto AFD

importScript('Wikipedia:WikiProject User scripts/Scripts/AutoAFD.js');