User:Jkraai/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 can be added at User:Jkraai/monobook.css. |
/*
<pre> <nowiki>
Note: After saving, you have to bypass your browser's cache to see the changes.
To do this in Firefox/Mozilla/Safari: hold down Shift while clicking Reload,
or press Ctrl-Shift-R).
If you use Internet Explorer: press Ctrl-F5, Opera/Konqueror: press F5.
</nowiki> </pre>
==AzaToth's reversion tools ==
<pre> <nowiki> */
// importScript('User:AzaToth/twinkle.js');
/*
</nowiki> </pre>
==WikEd, replaces Firefox's text edit window ==
<pre> <nowiki> */
// install [[User:Cacycle/wikEd]] in-browser text editor
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
/*
</nowiki> </pre>
==Lupin's anti-vandal tools ==
<pre> <nowiki> */
// Script from [[User:Lupin/recent2.js]]
mw.loader.load(
'https://en.wikipedia.org/w/index.php?title=User:Lupin/recent2.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s');
/*
</nowiki> </pre>
==Popups==
<pre> <nowiki> */
/* [[User:Lupin/popups.js]] */
mw.loader.load(
'https://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s');
/*{{User:AndyZ/peerreviewer.js}}*/
/*
</nowiki> </pre>
== Watchlist sorter ==
<pre> <nowiki>
Sorts your watchlist by namespace, and also adds spaces for readability.
*/
$(function (){
if (location.href.indexOf('Special:Watchlist') == -1) return; //Are we on a watchlist?
//days = document.getElementById('bodyContent').getElementsByTagName('ul');
days = document.evaluate( //Hell knows how it works - found in "Dive into Greasemonkey"
"//ul[@class='special']",
document,
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);
for (d = 0; d < days.snapshotLength; d++) { //For each day
day = days.snapshotItem(d);
newday = document.createElement('ul'); //This will replace the old listing
while ((diffs = day.getElementsByTagName('li')).length > 0) { //Are there any diffs left?
//Try to extract the namespace
As = diffs[0].getElementsByTagName('a');
if (As[0].innerHTML == 'diff')
pagename = As[2].innerHTML;
else
pagename = As[1].innerHTML;
if (pagename.indexOf(':') == -1)
namespace = 'Main';
else
namespace = pagename.split(':')[0]; //This will fail for articles which contain ":" in name
hdrs = newday.getElementsByTagName('h5'); //Get the list of namespace headers
hdr = null;
for (j=0; j<hdrs.length; j++) //Find the header
if (hdrs[j].innerHTML==namespace) {
hdr = hdrs[j]; break;
}
if (hdr==null) { //Not found? Make a new one!
hdr = document.createElement('h5');
hdr.innerHTML = namespace;
newday.appendChild(hdr);
namespacesub = document.createElement('ul');
newday.appendChild(namespacesub);
}
hdr.nextSibling.appendChild(diffs[0]); //Move the diff
}
newday.appendChild(document.createElement('hr')); //For readablility
day.parentNode.replaceChild(newday,day);
}
});
mw.loader.load('//en.wikipedia.org/w/index.php?title=User%3AMarkS%2Fextraeditbuttons.js&action=raw&ctype=text/javascript'); // [[User:MarkS/extraeditbuttons.js]];
<div style="float:right; border:1px solid #0099CC; margin:1px;">
{| cellspacing="0" style="width:238px; background: #CCCC33;"
| style="width:45px; height:45px; background: #0099CC; text-align:center; font-size:14pt; color:black;" | [[Image:Vista-advancedsettings.png|45px]]
| style="font-size:8pt; padding:4pt; line-height:1.25em; color:black;" | This user is a member of the<br/>[[Wikipedia:WikiProject User scripts|User scripts WikiProject]].
|}</div>
== JavaScript ==
=== statusChanger ===
{{notice|It has been repeatedly reported that this script '''does not work''' under Internet Explorer 7 and/or Windows Vista. A workaround solution (other than installing [[Mozilla Firefox]] (or possibly [[Opera (web browser)|Opera]]), which is BTW '''highly recommended''') may or may not be developed.}}
This module will add 3 new links beside the "log out" link. These will be "in", "busy" and "out" for quickly changing your current Wikipedia status.
To enable this, first add the following line to [[Special:Mypage/monobook.js|your monobook file]]:
<source lang=javascript>
importScript('User:Misza13/statusChanger.js');
</source>
Additionally, you'll need two additional pages:
# [[Special:Mypage/Status]]
# [[Special:Mypage/StatusTemplate]]
The first one is the one modified by the script to hold '''<nowiki>{{User:Example/StatusTemplate|STATUS}}</nowiki>''', where "STATUS" will be one of "in", "busy", "out". Then it is up to the "Template" to render it the way you wish. An example is:
<source lang=javascript>
'''<div style="border: 1px solid black; background: white; float: right; position: relative; top: -30px; padding: 5px">
Example's status: {{ #switch: {{{1}}}
| in=<span style="color: green;">IN</span>
| busy=<span style="color: #FFAA00;">BUSY</span>
| out=<span style="color: red;">OUT</span>
}}
</div>'''
</source>
You can tweak it to look whatever you like.
Then all you need is to put '''<nowiki>{{User:Example/Status}}</nowiki>''' on whatever pages you want the status to be displayed.
You can also define your own range of statuses using this statement (put it right after the<tt>importScript</tt> statement):
<source lang=javascript>
statusChangerConfig = {
statusList : [ 'in', 'busy', 'school', 'work', 'out' ],
};
</source>
Make sure your template knows how to handle these new values.
[[Category:Wikipedia scripts]]
=== watchlistSorter ===
This tool that sorts your watchlist by [[WP:NS|namespace]] making it easier to browse for important edits - not recommended for people with thousands of pages watched. Not compatible with Internet Explorer. Not compatible with "Enhanced recent changes" option in Preferences.
To install it, add the following to [[Special:Mypage/monobook.js|your monobook]]:
<source lang=javascript>
if (mw.config.get('wgPageName') == 'Special:Watchlist') {
importScript('User:Misza13/watchlistSorter.js');
}
</source>
=== viewSource ===
This code will create a new button called '''[view source]''' to the left of the '''[edit this page]''' button (unless you're already editing a page or the page is protected). Technically, it takes you to editing the page, but removes the interface (edit summary box, minor edit and watch checkboxes, save/preview/show changes buttons) below the editing box. This will prevent you from accidentally saving the page if you were just playing with the content.
To install it, add the following to [[Special:Mypage/monobook.js|your monobook]]:
<source lang=javascript>
importScript('User:Misza13/viewSource.js');
</source>
== [[m:pywikipedia|pywikipedia]] scripts ==
*[[User:Misza13/ace_voter.py]] - ArbCom Election voting script
*[[User:Misza13/spoilerkill.py]] - interactive script to aid in the removal of redundant {{tl|spoiler}} (and related) tags from articles
*[[User:Misza13/browseCSD.py]]
== MediaWiki template stuff ==
Other random stuff I've created:
*[[User:Misza13/vote]] is the ultimate voting template! All in one, but since [[m:voting is evil|voting is evil]] and such templates have been pretty controversial in the past, '''use it at your own risk'''.
*[[User:Misza13/CURRENTMINUTEOFDAY]] is a template that translates '''<nowiki>{{CURRENTTIME}}</nowiki>''' (i.e. '''{{CURRENTTIME}}''') into a number of minutes passed since midnight: '''{{User:Misza13/CURRENTMINUTEOFDAY}}'''
*[[User:Misza13/Random]] is a Wiki-[[random number generator|RNG]]! See for yourself!;