User:Duncan/monobook.js
Appearance
(Redirected from User:ESanchez013/monobook.js)
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 can be added at User:Duncan/monobook.css. |
importScript('User:Xenocidic/statusChanger2.js');
// install [[User:Cacycle/wikEd]] in-browser text editor
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'
+ '&action=raw&ctype=text/javascript');
// [[User:Krimpet/CH2.js]]
importScript('User:Krimpet/CH2.js');
/* How to use:
*
* Add the following to [[Special:Mypage/monobook.js]] as a
* logged-in user using the monobook skin:
* importScript('User:Gracenotes/rollback.js');
*
* On diff pages, history pages and user contribution pages,
* a "sum" link will appear next to "rollback".
* When you click on "sum", you will be prompted to enter a
* summary. Press "Cancel" to cancel, and leave a blank summary
* to use the default. In the summary, the text "$user" will
* automatically be replaced with the user name you're reverting.
* e.g., "rv edits by $user; not true"
*
* To disable the link from appearing on any one of the pages,
* add a line containing a list after the "importScript" statement.
* The options are 'diff', 'history', and 'user'. For example, to
* disable the link on history pages and user contribution pages:
* rollbackLinksDisable = [ 'history', 'user' ]
*
* Please contact if there are any problems :)
*/
function addSumLink() {
var rbnode = [], diffnode, index = {}, gebcn = document.getElementsByClassName
? function(a, b, c) { return a.getElementsByClassName(c) }
: getElementsByClassName;
if (typeof rollbackLinksDisable == 'object' && rollbackLinksDisable instanceof Array)
for (var i = 0; i < rollbackLinksDisable.length; i++)
index[rollbackLinksDisable[i]] = 1;
if (!('user' in index) && wgCanonicalSpecialPageName == "Contributions")
rbnode = gebcn(document.getElementById("bodyContent"), "span", "mw-rollback-link");
else if (!('history' in index) && wgAction == "history")
rbnode = gebcn(document.getElementById("pagehistory"), "span", "mw-rollback-link");
else if (!('diff' in index) && (diffnode = document.getElementById("mw-diff-ntitle2")))
rbnode = gebcn(diffnode, "span", "mw-rollback-link");
for (var i = 0, len = rbnode.length; i < len; i++) {
addRollbackSummaryLink(rbnode[i])
}
}
function confirmRollback() {
var url = this.href;
var user = url.match(/[?&]from=([^&]*)/);
if (!user) return;
user = decodeURIComponent(user[1].replace(/\+/g, " "));
var summary = prompt("Enter a summary to use for rollback.\n\nLeave blank to use the default. $user will be replaced with \"" + user + "\".", "")
if (summary == undefined)
return false;
else if (summary == "")
return true;
this.href += "&summary=" + encodeURIComponent(summary.replace(/\$user/g, user));
return true;
};
function addRollbackSummaryLink(rbnode) {
var rblink = rbnode.getElementsByTagName("a")[0]
var alink = rblink.cloneNode(true);
alink.className = ""; //don't confuse other scripts
alink.firstChild.nodeValue = "sum";
alink.onclick = confirmRollback;
rbnode.insertBefore(alink, rblink.nextSibling);
rbnode.insertBefore(document.createTextNode(" | "), alink);
}
if (typeof rollbackLinksDisable == 'undefined')
rollbackLinksDisable = [];
$(addSumLink);
// [[User:Henrik/afc-helper]]
importScript('User:Henrik/js/afc-helper.js');
/* Watchlist notifier ([[User:Ais523/watchlistnotifier.js]]); displays a message every time a watched page changes. */
//<pre><nowiki>
var wmwpajax;
// From [[WP:US]] mainpage (wpajax renamed to wmwpajax)
wmwpajax={
download:function(bundle) {
// mandatory: bundle.url
// optional: bundle.onSuccess (xmlhttprequest, bundle)
// optional: bundle.onFailure (xmlhttprequest, bundle)
// optional: bundle.otherStuff OK too, passed to onSuccess and onFailure
var x = window.XMLHttpRequest ? new XMLHttpRequest()
: window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP")
: false;
if (x) {
x.onreadystatechange=function() {
x.readyState==4 && wmwpajax.downloadComplete(x,bundle);
};
x.open("GET",bundle.url,true);
x.send(null);
}
return x;
},
downloadComplete:function(x,bundle) {
x.status==200 && ( bundle.onSuccess && bundle.onSuccess(x,bundle) || true )
|| ( bundle.onFailure && bundle.onFailure(x,bundle) || alert(x.statusText+': '+bundle.url));
}
};
// Example:
// function dlComplete(xmlreq, data) {
// alert(data.message + xmlreq.responseText);
// }
// wmwpajax.download({url:'http://en.wikipedia.org/w/index.php?title=Thresher&action=raw',
// onSuccess: dlComplete, message: "Here's what we got:\n\n" });
// End of [[WP:US]] quote
$(function() {
/* Find the top item in the watchlist, and its edit summary. We only need one item, so
set the limit to 1 to ease the load on the server. */
wmwpajax.download({url:'http://en.wikipedia.org/w/api.php?action=query&list=watchlist&wllimit=1&'+
'wldir=older&format=xml&wlprop=comment|ids|title', onSuccess: wmWatchEditFound});
});
// </nowiki></pre>
// [[Category:Wikipedia scripts]]
importScript('User:TheJosh/Scripts/RecentChangesPatrol.js');
importScript('User:TheJosh/Scripts/NewPagePatrol.js');
// [[User:Dschwen/highlightredirects.js]] - please include this line
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Dschwen/highlightredirects.js'
+ '&action=raw&ctype=text/javascript');
importScript('User:Ais523/topcontrib.js'); // [[User:Ais523/topcontrib.js]]
importScript('User:JeremyMcCracken/contribstab.js');
importScript('User:Ale_jrb/Scripts/csdhelper.js'); //[[User:Ale_jrb/Scripts]]
//Mass rollback function
//Written by John254
//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)
function rollbackEverythingButton() {
var hasRollback = getElementsByClassName(document, "span", "mw-rollback-link");
if (hasRollback[0] && (document.title.indexOf("User contributions") != -1) ) {
mw.util.addPortletLink('p-cactions', 'javascript:rollbackEverything()', "rollback all", "ca-rollbackeverything", "rollback all edits displayed here");
}
}
$(rollbackEverythingButton);
function rollbackEverything() {
for (var i in document.links) {
if (document.links[i].href.indexOf('action=rollback') != -1) {
window.open(document.links[i].href);
}
}
}