User:Caknuck/monobook.js

// Twinkle

importScript('User:AzaToth/twinkle.js');

// Troy 07's IP range-tracker

importScript('MediaWiki:Gadget-contribsrange.js');// MediaWiki:Gadget-contribsrange.js

// From code by raylu // // // This script adds a "Baseball Deletion" tab to the top of article pages // when in edit mode. It is disabled for the User namespace.

function dodeletion { document.editform.wpTextbox1.value = document.editform.wpTextbox1.value + '\n{' + '{' + 'subst' + ':' + 'delsort' + '|' + 'Baseball' + '}' + '}' + ' ' + '--' + ' ' + '~' + '~' + '~' + '~'; document.editform.wpSummary.value = 'Tagged as a Baseball-related deletion.'; document.editform.wpMinoredit.checked = true; document.editform.submit; }

function adddeletion { addTab("javascript:dodeletion", "Baseball deletion", "ca-Baseballdeletion", "Baseball Deletion", ""); akeytt; }

addOnloadHook(function { if (document.title.indexOf("User:") != -1 || document.title.indexOf("User talk:") != -1) {     return;  }  if (document.title.indexOf("Editing ") != -1) {  addOnloadHook(adddeletion);  } });

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; }

importScript("User:GregU/randomlink.js"); addOnloadHook( function { // WhatLinksHere is probably a better way to find all articles in a WikiProject  bblist = "Special:WhatLinksHere/Template:WikiProject_Baseball?namespace=1&hidelinks=1&limit=250";  mw.util.addPortletLink('p-navigation', 'javascript:randomlink_paged=1;randomlink_maxfrom=24000000;randomLink(bblist)', 'Baseball article', 'n-randombb', 'Random article in WikiProject Baseball'); });

mw.loader.load('https://ru.wikipedia.org/w/index.php?title=MediaWiki:Gadget-markblocked.js&action=raw&ctype=text/javascript');

///Tim's Mass Edit Tool /// Adapted from User:Animum/massdelete.js function doMassEdit { document.getElementById("wpMassEditSubmit").disabled = true; var articles = document.getElementById("wpMassEditPages").value.split("\n"); if(articles.length == 0) return; var newtext = document.getElementById("wpMassEditText").value; var wpMassEditType = document.getElementById("wpMassEditType").value, wpMassEditSummary = document.getElementById("wpMassEditSummary").value, edited = 0, failed = new Array, error = new Array; var wpMassEditMinor = document.getElementById("wpMassEditMinor").checked; for(i=0;i 0) { var req = sajax_init_object; req.open("GET", mw.config.get('wgScriptPath') + "/api.php?format=json&action=query&prop=info&intoken=edit&titles=" + encodeURIComponent(article), false); req.send(null); var response = eval("(" + req.responseText + ")").query.pages; for(var index in response) { var info = response[index]; var edittoken = info.edittoken; var postdata = "format=json" + "&action=edit&watchlist=nochange" + "&title=" + encodeURIComponent(article) + "&summary=" + encodeURIComponent(wpMassEditSummary) + "&token=" + encodeURIComponent(edittoken); if(wpMassEditMinor) postdata += "&minor=1"; else postdata += "&notminor=1"; if(wpMassEditType == "prepend"){ postdata += "&prependtext=" + encodeURIComponent(newtext + "\n"); }		else if(wpMassEditType == "append"){ postdata += "&appendtext=" + encodeURIComponent("\n" + newtext); }		else if(wpMassEditType == "replace"){ postdata += "&text=" + encodeURIComponent(newtext); }		else { // delete var pagetext = gettext(article); while(pagetext != pagetext.replace(newtext, '')) pagetext = pagetext.replace(newtext, ''); postdata += "&text=" + encodeURIComponent(pagetext); }               var req = sajax_init_object; req.open("POST", mw.config.get('wgScriptPath') + "/api.php", false); req.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); req.setRequestHeader("Content-length", postdata.length); req.send(postdata); if(eval("(" + req.responseText + ")").edit ) { //If edited, update the count and the button. edited++; document.getElementById("wpMassEditSubmit").value = "(" + edited + ")"; } else { //If not edited, add the title to the "failed" array and a description of the error to the "error" array. failed.push(article); error.push(eval("(" + req.responseText + ")").error.info); }           }        }        if(!articles[i+1]) { document.getElementById("wpMassEditSubmit").value = "Done (" + edited + ")"; if(failed.length > 0) { var linkedList = ""; for(x=0; x" + failed[x] + ": " + error[x] + ""; //Links the titles in the "failed" array }               document.getElementById("wpMassEditFailedContainer").innerHTML += ' Failed edits:' + linkedList + ''; }       }    } } function gettext(title){ var req = sajax_init_object; req.open("GET", mw.config.get('wgScriptPath') + "/api.php?action=query&prop=revisions&rvprop=content&format=json&indexpageids=1&titles="+encodeURIComponent(title), false); req.send(null); var response = eval('(' + req.responseText + ')'); pageid = response['query']['pageids'][0]; if (pageid == "-1") { delete req; return ''; }	var pagetext = response['query']['pages'][pageid]['revisions'][0]['*']; return pagetext; } function masseditform { var bodyContent = (skin == "cologneblue" ? "article" : "bodyContent"); document.getElementsByTagName("h1")[0].textContent = "Tim's mass edit tool"; document.title = "Tim's mass-editing tool - Wikipedia, the free encyclopedia"; document.getElementById(bodyContent).innerHTML = 'From Wikipedia, the free encyclopedia

'       + '' + 'If you abuse this tool, it\'s your fault, not mine.' + ' '       + '

'           + 'Pages to edit (one on each line, please): '               + ' ' + 'Text to change in the page (see below): '               + ' ' + '

'               + '  Edit type: ' + ' ' + ' Prepend new text ' + ' Append new text ' + ' Delete text from page ' + ' Replace page with new text ' + ' '            + '  Edit summary: ' + '  ' + ' Mark edit as minor: ' + '  ' + '  ' + ' '; } var massedit_whitelist = ["Shirik"]; if(mw.config.get('wgNamespaceNumber') == -1 && (mw.config.get('wgPageName') == "Special:Massedit" || mw.config.get('wgPageName') == "Special:MassEdit") && (/sysop/.test(mw.config.get('wgUserGroups')) || massedit_whitelist.indexOf(mw.config.get('wgUsername')) != -1 )) addOnloadHook(masseditform);