User:ChaoticReality/monobook.js
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
// [[User:Pyrospirit/scriptpackage.js]]
/*
This is a collection of JavaScript assembled by [[User:Pyrospirit]]. I haven't written
any of this myself, but I use all of it and find it very useful.
These scripts are designed for use in Firefox and will all work in Firefox. Most of the
scripts won't work in Internet Explorer, and I have no idea what will happen with other
browsers. Solution: get Firefox.
I'm somewhat of a newbie with JavaScript, so please report any problems with these
scripts to whomever wrote the script or ask at [[Wikipedia:Village pump (technical)]].
To decrease loading time, I've set many scripts only to run on certain types of pages.
So, if a script isn't showing up, it might be because you'd almost never use it on the
page you're on anyway.
*/
/*
== Scripts in this area are enabled in all browsers ==
*/
// [[User:Lupin/popups.js]] - navigation popups
//if(wgAction!='edit' && wgAction!='submit')
//importScript('User:Lupin/popups.js');
// [[User:Jsimlo/shortcuts.js]] - customized sidebar links
importScript('User:Jsimlo/shortcuts.js');
function shortcutsInit ()
{
shortcutsAddLink ( 'Monobook.js', 'Special:Mypage/monobook.js' );
shortcutsAddLink ( 'Monobook.css', 'Special:Mypage/monobook.css' );
shortcutsAddLink ( 'Scripts', 'Wikipedia:WikiProject User scripts/Scripts' );
shortcutsAddLink ( 'wikEd', 'User:Cacycle/wikEd' );
shortcutsAddLink ( 'Twinkle', 'Wikipedia:WikiProject User scripts/Scripts/Twinkle' );
shortcutsAddLink ( 'Friendly', 'Wikipedia:WikiProject User scripts/Scripts/Friendly' );
shortcutsAddLink ( 'New pages', 'Special:Newpages' );
shortcutsAddLink ( 'AIV', 'Wikipedia:Administrator intervention against vandalism' );
shortcutsAddLink ( 'Help desk', 'Wikipedia:Help desk' );
}
// User watchlist from [[User:Tra/userwatchlist.js]]
importScript('User:Tra/userwatchlist.js');
// Logs link in toolbox
if (wgCanonicalNamespace!='User' && wgCanonicalNamespace!='User talk')
importScript('Wikipedia:WikiProject User scripts/Scripts/Logs link');
// Reformats compare button in history as a link
if (wgAction=='history')
importScript('MediaWiki:WikiProject User scripts/Scripts/Compare link.js');
// Performs basic formatting changes from a tab while editing
if (wgAction=='edit' || wgAction=='submit')
importScript('Wikipedia:WikiProject User scripts/Scripts/Formatter');
// Quick previewing button in editing toolbar
if (wgAction=='edit' || wgAction=='submit')
importScript('User:Alex Smotrov/qpreview.js');
// Gives assessment data for an article
if (wgCanonicalNamespace=='')
importScript('User:Outriggr/metadata.js');
// Adds extra edit/hist tabs for both discussion page and article page
importScript('Wikipedia:WikiProject User scripts/Scripts/Six tabs');
// Improves formatting of history pages
if (wgAction=='history')
importScript('User:Alex_Smotrov/histcomb.js');
// Edit top link by [[User:Alex Smotrov]]
importScript('User:Alex_Smotrov/edittop.js');
if (wgAction=='edit' && document.URL.indexOf('§ion=0') != -1)
addOnloadHook(function(){
document.getElementById('wpSummary').value = "/* Intro */ ";
})
// Unwatch links next to page names in watchlist from [[User:Alex Smotrov/wlunwatch.js]]
if (wgCanonicalSpecialPageName && wgCanonicalSpecialPageName=='Watchlist' && wgAction=='view')
addOnloadHook(function () {
var frm = document.getElementsByTagName('form')[0];
frm.parentNode.insertBefore(document.createTextNode(' | '), frm);
var lnk = document.createElement('a');
lnk.appendChild(document.createTextNode('Unwatch…'));
lnk.href = 'javascript:importScript("User:Alex_Smotrov/wlunwatch.js")';
frm.parentNode.insertBefore(lnk, frm);
})
importScript('Wikipedia:WikiProject User scripts/Scripts/Add LI menu');
importStylesheet('Wikipedia:WikiProject User scripts/Scripts/Add LI menu/css');
importScript('User:S/tags.js');
autosubmit=false;
minoredit=true;
show_cwli=true;
// Box with newest pages in sidebar
//importScript('User:TheJosh/Scripts/NewPagePatrol.js');
//npp_enabled = false;
//npp_num_pages = 10;
//npp_refresh = 5;
// Box with recent changes in sidebar
//importScript('User:TheJosh/Scripts/RecentChangesPatrol.js');
//rcp_enabled = false;
//rcp_num_pages = 10;
//rcp_refresh = 5;
// Nice formatting for [[Special:Log]]
if (wgCanonicalSpecialPageName && wgCanonicalSpecialPageName=='Log')
importScript('User:Alex_Smotrov/logpage.js')
/*
== Scripts in this area are disabled in Internet Explorer due to compatibility issues ==
*/
var detect = navigator.userAgent.toLowerCase();
var IE;
var place = detect.indexOf('msie') + 1;
if (place) IE=true;
if (!IE) {
// Twinkle script (reverting, warning, reporting, csd, xfd, prod, rpp)
importScript('User:AzaToth/twinkle.js');
TwinkleConfig = {
revertMaxRevisions : 50,
userTalkPageMode : 'tab',
showSharedIPNotice : true,
openTalkPage : [ 'agf', 'norm', 'vand' ],
openTalkPageOnAutoRevert : true,
openAOLAnonTalkPage : false,
summaryAd : "",
deletionSummaryAd : "",
protectionSummaryAd : "",
watchSpeedyPages : [ ],
watchProdPages : true,
openUserTalkPageOnSpeedyDelete : [ 'g1', 'g2', 'g10', 'g11', 'g12', 'a1', 'a7', 'i3', 'i4', 'i5', 'i6', 'i7', 'u3', 't1' ],
watchRevertedPages : [ ],
markRevertedPagesAsMinor : [ 'agf', 'norm', 'vand', 'torev' ],
deleteTalkPageOnDelete : false,
watchWarnings : false,
markAIVReportAsMinor : false,
markSpeedyPagesAsMinor : false,
offerReasonOnNormalRevert : true
};
// [[User:Cacycle/wikEd]] in-browser text editor
//if (wgAction=='edit' || wgAction=='submit' || wgAction=='diff')
//importScript('User:Cacycle/wikEd.js');
// [[WP:FRIENDLY]] script similar to Twinkle (tagging, welcoming)
importScript('User:Ioeth/friendly.js');
FriendlyConfig = {
summaryAd : "",
watchWelcomes : false,
markWelcomesAsMinor : false,
watchTaggedPages : false,
markTaggedPagesAsMinor : true,
insertHeadings : true,
welcomeHeading : "== Welcome ==",
insertUsername : true,
insertSignature : true
};
// [[User:Voice of All]]'s helper JavaScript
importScript('User:Voice of All/Addtabs/monobook.js');
// UTC time clock with double-click purge function
importScript('User:Voice of All/UTCclock.js');
// Some history-related script from VoA
importScript('User:Voice of All/History/monobook.js');
// [[User:Lupin/recent2.js]] anti-vandalism script
importScript('User:Lupin/recent2.js');
}
function addForceSummary()
{
if(!/&action=edit/.test(window.location.href) && !/&action=submit/.test(window.location.href)) return;
if(/§ion=new/.test(window.location.href)) return;
if(!document.forms.editform) return;
document.forms.editform.wpSave.onclick = forceSummary;
// The second invocation of this will cause extra annoyance if there is no edit summary present. If there *is* an edit summary, the dialog box will not appear.
document.forms.editform.wpSave.onfocus = forceSummary;
}
function forceSummary()
{
if(!document.forms.editform.wpSummary.value.replace(/^(?:\/\\*.*\\*\/)? *(.*) *$/,'$1'))
{
var r = prompt('Are you sure you want to submit without adding a summary?\nTo add a summary, type it in the box below:',document.forms.editform.wpSummary.value);
if(r == null) { return false; }
document.forms.editform.wpSummary.value = r;
}
return true;
}
addOnloadHook(addForceSummary);
/* 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;
if(xmlreq.responseText.indexOf('revid=')==-1)
{
document.getElementById('contentSub').innerHTML+=
"<div class='watchlistnotify'>(<i>watchlistnotifier can't determine whether a "+
"watched page has changed<i>)</div>";
return;
}
watchrev=xmlreq.responseText.split('revid="')[1].split('"')[0];
try
{
watchrevold=document.cookie.split('ais523wmwatchrev=')[1].split('.')[0];
}
catch(junk) {watchrevold=0;}
if(wgPageName == "Special:Watchlist")
{
document.cookie="ais523wmwatchrev="+watchrev+".; path=/";
var aas=document.getElementById('bodyContent').getElementsByTagName('a');
var i=aas.length;
while(i--)
{
if(aas[i].href.indexOf('diff=')!=-1&&watchrevold)
if(+(aas[i].href.split('diff=')[1].split('&')[0])>watchrevold)
aas[i].parentNode.style.fontWeight='bold';
}
}
else
{
watchsum=xmlreq.responseText.split('comment="')[1].split('"')[0];
watchpage=xmlreq.responseText.split('title="')[1].split('"')[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+
'". (<a href="/wiki/Special:Watchlist">watchlist</a>)</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. */
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]]