User:Yume no Kishi/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:Yume no Kishi/monobook.css. |
importScript('User:AzaToth/twinkle.js');
TwinkleConfig = {
revertMaxRevisions : 50,
userTalkPageMode : 'window',
showSharedIPNotice : true,
openTalkPage : [ 'agf', 'norm', 'vand' ],
openTalkPageOnAutoRevert : false,
openAOLAnonTalkPage : false,
summaryAd : " [[WP:TWINKLE|TWINKLE]]",
deletionSummaryAd : " [[WP:TWINKLE|TWINKLE]]",
protectionSummaryAd : " [[WP:TWINKLE|TWINKLE]]",
watchSpeedyPages : [ ],
watchProdPages : false,
openUserTalkPageOnSpeedyDelete : [ 'g1', 'g2', 'g10', 'g11', 'g12', 'a1', 'a7' ],
watchRevertedPages : [ 'agf', 'norm', 'vand', 'torev' ],
markRevertedPagesAsMinor : [ 'agf', 'norm', 'vand', 'torev' ],
deleteTalkPageOnDelete : false,
markWarningsAsMinor : false,
markAIVReportAsMinor : false,
markSpeedyPagesAsMinor : false,
markProdPagesAsMinor : false,
confirmUsernameToAIV : true,
toolboxButtons : [ ]
};
// [[User:Lupin/popups.js]]
importScript('User:Lupin/popups.js');
popupRedlinkRemoval=true;
popupFixRedirs=true;
popupFixDabs=true;
// 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
addOnloadHook(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 = 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]);
}
});
addOnloadHook(function () {
if (location.href.indexOf('viewsource=1') != -1) {
sl = document.getElementById('wpSummaryLabel'); sl.parentNode.removeChild(sl);
ed = document.getElementById('wpSummary').parentNode; ed.parentNode.removeChild(ed);
return;
}
editbutton = document.getElementById('ca-edit');
if (editbutton && location.href.indexOf('action=edit')==-1) {
editlink = editbutton.getElementsByTagName('a')[0].href + '&viewsource=1';
tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
na = document.createElement('a');
na.href = editlink; na.appendChild(document.createTextNode('view source'));
li = document.createElement('li'); li.id = 'ca-viewsource'; li.appendChild(na);
tabs.insertBefore(li,editbutton);
}
});
/* Allows you to watch/unwatch a page without leaving it. */
function getXmlHttpObject() {
var xmlHttp;
try {
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e) {
// Internet Explorer
try {
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
try {
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e) {
xmlHttp = false;
}
}
}
return xmlHttp;
}
function changeTab() {
if (watchAction == 'watch') {
watchLink.innerHTML = 'unwatch';
watchAction = 'unwatch';
} else if (watchAction == 'unwatch') {
watchLink.innerHTML = 'watch';
watchAction = 'watch';
}
}
function setWatch(action) {
xmlHttp = getXmlHttpObject();
if (xmlHttp == false) return;
xmlHttp.onreadystatechange = changeTab();
xmlHttp.open('GET', 'http://en.wikipedia.org/w/index.php?title=' + pageName + '&action=' + action, true);
xmlHttp.send(null);
}
function setWatchTab() {
if (document.getElementById('ca-watch') || document.getElementById('ca-unwatch')) {
if (document.getElementById('ca-watch')) {
watchLink = document.getElementById('ca-watch').getElementsByTagName('a')[0];
watchAction = 'watch';
} else if (document.getElementById('ca-unwatch')) {
watchLink = document.getElementById('ca-unwatch').getElementsByTagName('a')[0];
watchAction = 'unwatch';
}
watchUrl = watchLink.href
pageName = watchUrl.substring(watchUrl.indexOf('title=')+6,watchUrl.indexOf('&action'));
watchLink.href = 'javascript:setWatch(watchAction);';
}
}
addOnloadHook(setWatchTab);
/* 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 wmWatchEditFound(xmlreq, data) {
var watchrev, watchsum, watchrevold, watchpage, junk;
watchrev=xmlreq.responseText.split('timestamp="')[1].split('"')[0];
if(wgPageName == "Special:Watchlist")
document.cookie="ais523wmwatchrev="+watchrev+".; path=/";
else
{
watchsum=xmlreq.responseText.split('comment="')[1].split('"')[0];
watchpage=xmlreq.responseText.split('title="')[1].split('"')[0];
try
{
watchrevold=document.cookie.split('ais523wmwatchrev=')[1].split('.')[0];
}
catch(junk) {watchrevold=0;}
watchsum=watchsum.split('<').join('<').split('>').join('>');
watchpage=watchpage.split('<').join('<').split('>').join('>');
if(watchrev!=watchrevold)
document.getElementById('contentSub').innerHTML+=
"<div class='watchlistnotify'>\""+watchpage+'" changed: "'+watchsum+'".</div>';
}
}
addOnloadHook(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. */
//if(location.href.indexOf("/wiki/")!=-1)
wmwpajax.download({url:'http://en.wikipedia.org/w/api.php?action=query&list=watchlist&wllimit=1&'+
'wldir=older&format=xml&wlprop=comment|timestamp|title', onSuccess: wmWatchEditFound});
});
// </nowiki></pre>
// [[Category:Wikipedia scripts]]