User:Bibliomaniac15/monobook.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
The accompanying .css page for this skin is at User:Bibliomaniac15/monobook.css. |
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Froth/refdeskmodv2.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
// This will add an [edit] link at the top of all pages except preview pages and the main page
// by User:Pile0nades
// Add an [edit] link to pages
$(function () {
// if this is preview page or generated page, stop
if(
document.getElementById("wikiPreview") ||
document.getElementById("histlegend") ||
document.getElementById("difference") ||
document.getElementById("watchdetails") ||
document.getElementById("ca-viewsource") ||
window.location.href.indexOf("/wiki/Special:") != -1
) {
if(window.location.href.indexOf("&action=edit§ion=0") != -1) {
document.getElementById("wpSummary").value = "/* Intro */ ";
}
return;
};
// get the page title
var pageTitle = mw.config.get('wgPageName');
// create div and set innerHTML to link
var divContainer = document.createElement("div");
divContainer.innerHTML = '<div class="editsection">[<a href="/w/index.php?title='+pageTitle+'&action=edit§ion=0" title="Edit section: '+pageTitle+'">edit intro</a>]</div>';
// insert divContainer into the DOM below the h1
if(window.location.href.indexOf("&action=edit") == -1) {
document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);
}
});
// [[User:Steel359/protection.js]]
importScript('User:Steel359/protection.js');
importScript('User:AndyZ/peerreviewer.js'); //[[User:AndyZ/peerreviewer.js]]
//<pre><nowiki>
importScript('User:Voice of All/Addtabs/monobook.js');
var WindowObjectReference;
function openTab(url) {
WindowObjectReference = window.open(url, "_blank", "");
}
function addcountedit() {
var subpagename = mw.config.get('wgTitle').split( '/' )[1];
if( (mw.config.get('wgNamespaceNumber') == '2' || mw.config.get('wgNamespaceNumber') == '3' || ( mw.config.get('wgNamespaceNumber') == '-1' && mw.config.get('wgTitle') == 'Contributions' )) && !subpagename ) {
var countuser = mw.config.get('wgTitle').split( '/' )[0];
if( mw.config.get('wgNamespaceNumber') == '-1' && mw.config.get('wgTitle') == 'Contributions') {
if(!document.getElementById( 'contentSub' )) return;
countuser = document.getElementById( 'contentSub' ).getElementsByTagName( 'a' )[0].getAttribute('title').split(':')[1];
}
addToolboxLink('javascript:openTab("http://en.wikipedia.org/w/query.php?what=contribcounter&titles=User:' + countuser.replace(/ /g, '+') + '&format=yamlfm")', "Edit count", '', '', ''); }
}
$(addcountedit);
//</nowiki></pre>
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 += "{{subst:" + number + "-n|" + page + "}} ~" + "~" + "~" + "~";
f.wpSummary.value = "Vandalism to [[" + page + "]] - warning " + number;
f.submit();
}
function wA() {
var f = document.editform, t = f.wpTextbox1;
if (t.value.length > 0)
t.value += '\n';
t.value += "{{subst:" + "welcome-anon-from|Where" + "}} ~" + "~" + "~" + "~";
f.wpSummary.value = "Welcome to Wikipedia!";
f.submit();
}
function wap() {
var f = document.editform, t = f.wpTextbox1;
if (t.value.length > 0)
t.value += '\n';
t.value += "{{subst:" + "User:Where/pwelcome" + "}} ~" + "~" + "~" + "~";
f.wpSummary.value = "Use preview; also, welcome!";
f.submit();
}
function es() {
var f = document.editform, t = f.wpTextbox1;
if (t.value.length > 0)
t.value += '\n';
t.value += "==Edit summaries==\n{{subst:" + "Edit summary" + "}} ~" + "~" + "~" + "~";
f.wpSummary.value = "Please use edit summaries";
f.submit();
}
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:es()', "ES"));
tabs.appendChild(tnaddlilink('javascript:testn("test1")',"t1"));
tabs.appendChild(tnaddlilink('javascript:testn("test1a")',"t1a"));
tabs.appendChild(tnaddlilink('javascript:testn("test2")',"t2"));
tabs.appendChild(tnaddlilink('javascript:testn("test2a")',"t2a"));
tabs.appendChild(tnaddlilink('javascript:testn("test3")',"t3"));
tabs.appendChild(tnaddlilink('javascript:testn("test4")',"t4"));
tabs.appendChild(tnaddlilink('javascript:testn("bv")',"bv"));
tabs.appendChild(tnaddlilink('javascript:testn("obscene")',"o"));
tabs.appendChild(tnaddlilink('javascript:testn("joke")',"j"));
tabs.appendChild(tnaddlilink('javascript:testn("welcomenpov")',"w-N"));
tabs.appendChild(tnaddlilink('javascript:wA()',"w-A"));
tabs.appendChild(tnaddlilink('javascript:wap()',"w-A-p"));
}}
$(add_testn_tabs);
importScript("User:Animum/easyblock.js"); //[[User:Animum/easyblock.js]]
importScript('User:Writ Keeper/Scripts/orangeBar.js'); //Linkback: [[User:Writ Keeper/Scripts/orangeBar.js]]
//<nowiki>
/* Cat-a-lot - changes category of multiple files */
mw.loader.using(['jquery.ui', 'mediawiki.util'], function(){
mw.loader.load('//commons.wikimedia.org/w/load.php?modules=ext.gadget.Cat-a-lot');
});
////////// Cat-a-lot user preferences //////////
window.catALotPrefs = {"watchlist":"preferences","minor":true,"editpages":true,"docleanup":false,"subcatcount":10};
////////////////////////////////////catALotEnd//
//</nowiki>
//Mass rollback function
//Written by John254 and modified/rewritten by Writ Keeper with modifications by TheDJ; original is at https://en.wikipedia.org/wiki/User:John254/mass_rollback.js
//Adapted from User:Mr.Z-man/rollbackSummary.js
//Instructions: Selecting the "rollback all" tab when viewing a user's contributions history
//will open all rollback links displayed there. (Use with caution)
if(typeof wkContribsCheckboxInit === "undefined")
{
wkContribsCheckboxInit = false;
}
function rollbackEverythingWKMR(editSummary)
{
if(editSummary === null)
{
return false;
}
mw.loader.using( 'mediawiki.api' ).done( function()
{
var rbMetadata = {};
rbMetadata.api = new mw.Api();
rbMetadata.userName = mw.config.get("wgRelevantUserName");
rbMetadata.ipRange = (rbMetadata.userName === null);
rbMetadata.titleRegex = /title=([^&]+)/;
rbMetadata.editSummary = editSummary;
$("a[href*='action=rollback']").each(function(ind, el)
{
rollbackOneThingWKMR(el, rbMetadata);
} );
} );
return false;
}
function rollbackSomeThingsWKMR(editSummary)
{
if(editSummary === null)
{
return false;
}
mw.loader.using( 'mediawiki.api' ).done( function()
{
var rbMetadata = {};
rbMetadata.api = new mw.Api();
rbMetadata.userName = mw.config.get("wgRelevantUserName");
rbMetadata.titleRegex = /title=([^&]+)/;
rbMetadata.editSummary = editSummary;
var rollbackList = $("input.revdelIds:checked").parents("li.mw-contributions-current").find("a[href*='action=rollback']");
if(rollbackList.length <= 0)
{
mw.notify("You didn't select any edits that could be rolled back!");
return;
}
$("input.revdelIds:checked").parents("li.mw-contributions-current").find("a[href*='action=rollback']").each(function(ind, el)
{
rollbackOneThingWKMR(el, rbMetadata);
} );
} );
}
function rollbackOneThingWKMR(edit, rbMetadata)
{
var userName;
//if we're in an anonymous IP range, we have to figure out each username on its own, since they might be different for each edit.
if(rbMetadata.userName === null)
{
//the not clause is probably not necessary, but I'm including it just to be sure.
userName = $(edit).parents("li:first").children("a.mw-anonuserlink").not(".mw-contributions-title").text();
}
else
{
userName = rbMetadata.userName;
}
var params = {};
if( rbMetadata.editSummary != '' )
{
params.summary = rbMetadata.editSummary;
}
rbMetadata.api.rollback( decodeURIComponent(rbMetadata.titleRegex.exec(edit.href)[1]), userName, params).done( function()
{
$(edit).after("reverted");
$(edit).remove();
} );
}
$(document).ready(function()
{
if(mw.config.get("wgCanonicalSpecialPageName") == "Contributions" && $("span.mw-rollback-link").length > 0)
{
mw.loader.using("mediawiki.util").done( function ()
{
mw.util.addPortletLink('p-cactions', '#', "rollback all", "ca-rollbackeverything", "rollback all edits displayed here");
if(!wkContribsCheckboxInit)
{
if($("ul.mw-contributions-list .mw-revdelundel-link").length > 0)
{
$("ul.mw-contributions-list .mw-revdelundel-link").each(function(ind,el){
if($(this).children("a").length > 0)
{
var revId = /ids=(\d+)/.exec($(this).children("a").attr("href"))[1];
var pageTitle = /target=([^&]+)/.exec($(this).children("a").attr("href"))[1];
$(el).prepend("<input type='checkbox' name='"+decodeURIComponent(pageTitle)+"' class='revdelIds' value='"+revId+"'> ");
$(el).children(".revdelIds").data("index", ind);
}
});
}
else
{
$("ul.mw-contributions-list a.mw-changeslist-date").each(function(ind,el){
$(el).before("<input type='checkbox' class='revdelIds'> ");
});
}
wkContribsCheckboxInit = true;
}
mw.util.addPortletLink('p-cactions', '#', "rollback selected", "ca-rollbacksome", "rollback selected edits");
$("#ca-rollbackeverything").click( function(event)
{
event.preventDefault();
mw.loader.load( 'mediawiki.api' ); //start loading, while the user is in the prompt
return rollbackEverythingWKMR(prompt("Rollback all edits: Enter an edit summary, or leave blank to use the default (or hit Cancel to cancel the rollback entirely)"));
});
$("#ca-rollbacksome").click( function(event)
{
event.preventDefault();
mw.loader.load( 'mediawiki.api' ); //start loading, while the user is in the prompt
return rollbackSomeThingsWKMR(prompt("Rollback selected edits: Enter an edit summary, or leave blank to use the default (or hit Cancel to cancel the rollback entirely)"));
});
$("#ca-rollbacksome").data("lastSelectedIndex", -1);
$("input.revdelIds").off("click").click(
function(ev)
{
var lastSelectedRevdel = $("#ca-rollbacksome").data("lastSelectedIndex");
var newIndex = $(this).data("index")
if(ev.shiftKey && lastSelectedRevdel >= 0)
{
var checkboxArray = $("input.revdelIds");
var start = lastSelectedRevdel;
var stop = newIndex;
if(start < stop)
{
for(var i = start; i < stop; i++)
{
$(checkboxArray[i]).prop("checked", true);
}
}
else
{
for(var i = start; i > stop; i--)
{
$(checkboxArray[i]).prop("checked", true);
}
}
}
$("#ca-rollbacksome").data("lastSelectedIndex", newIndex);
});
});
}
});