User:Levonscott/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:Levonscott/monobook.css. |
importScript('User:VoA/monobook.js');
//[[Category:Wikipedians who use RC script]]
//<nowiki>
topaz.statuschanger = new Object();
topaz.statuschanger.version = 20061108;
/* configuration */
// change these to whatever you'd like to show up on your status page. you can add new lines in
// the same format provided there is a comma at the end of each line but the last one. you can
// also use wikimarkup here to, for example, display an image instead of text.
topaz.statuschanger.statuscode = {
online:'<font color="green">online</font>',
busy:'<font color="orange">busy</font>',
offline:'<font color="red">offline</font>'
};
// this will make wikimarkup work in your stauscodes but will disable auto-updating
topaz.statuschanger.enablewikimarkup = false;
// true to use the personal bar, false to create a panel in the left column
topaz.statuschanger.usepersonalbar = true;
// true if you'd like your status page on your watchlist
topaz.statuschanger.watchstatus = false;
/* end configuration */
topaz.statuschanger.buttonlist = {};
topaz.statuschanger.oldonload = window.onload;
window.onload = function() {
if (typeof topaz.statuschanger.oldonload == "function") {
setTimeout('topaz.statuschanger.oldonload()',50);
}
if (!topaz.statuschanger.usepersonalbar) {
topaz.wputil.addsidepanel("tz-statuschanger", "status changer");
}
var buttonlist = [];
for (status in topaz.statuschanger.statuscode) {
buttonlist.push(status);
topaz.statuschanger.buttonlist[status] =
topaz.wputil.addsidepanelbutton(
topaz.statuschanger.usepersonalbar ? "p-personal" : "tz-statuschanger",
status,
'javascript:topaz.statuschanger.setstatus("' + status + '")'
);
}
if (topaz.statuschanger.usepersonalbar) {
for(var i=0; i<buttonlist.length; i++) {
with (topaz.statuschanger.buttonlist[buttonlist[i]].style) {
if (i != buttonlist.length-1) {
borderRight = "1px solid #aaaaaa";
paddingRight = "2px";
}
if (i != 0) {
marginLeft = "0px";
paddingLeft = "2px";
}
}
}
}
var spanlist = document.getElementsByTagName("span");
for (var i=0; i<spanlist.length; i++) {
if (spanlist[i].className == "topaz.statuschanger.curstatus."+escape(topaz.wputil.username())) {
topaz.util.cookie.set("topaz.statuschanger.curstatus", spanlist[i].innerHTML);
}
}
topaz.statuschanger.update();
};
topaz.statuschanger.setstatus = function(statusname) {
topaz.wputil.setpagecontent(
"User:"+topaz.wputil.username()+"/Status",
(!topaz.statuschanger.enablewikimarkup ?
'<includeonly><span class="topaz.statuschanger.inlinestatus.'
+ escape(topaz.wputil.username())
+ '"></includeonly>'
: '') +
topaz.statuschanger.statuscode[statusname] +
(!topaz.statuschanger.enablewikimarkup ?
'<includeonly></span></includeonly>'
: '') +
'<span class="topaz.statuschanger.curstatus.'+escape(topaz.wputil.username()) +
'" style="display:none">'+statusname+'</span>',
statusname,
topaz.statuschanger.watchstatus);
topaz.util.cookie.set("topaz.statuschanger.curstatus", statusname);
topaz.statuschanger.update();
};
topaz.statuschanger.laststatus = null;
topaz.statuschanger.update = function() {
var curstatus = topaz.util.cookie.get("topaz.statuschanger.curstatus");
if (curstatus && curstatus != topaz.statuschanger.laststatus) {
for (status in topaz.statuschanger.buttonlist) {
with (topaz.statuschanger.buttonlist[status].style) {
if (status == curstatus) {
fontWeight = "bold";
} else {
fontWeight = "normal";
}
}
}
if (!topaz.statuschanger.enablewikimarkup) {
var spanlist = document.getElementsByTagName("span");
for (var i=0; i<spanlist.length; i++) {
if (spanlist[i].className == "topaz.statuschanger.inlinestatus."+escape(topaz.wputil.username())) {
spanlist[i].innerHTML = topaz.statuschanger.statuscode[curstatus];
}
}
}
}
topaz.statuschanger.laststatus = curstatus;
};
setInterval("topaz.statuschanger.update()", 5000);
//</nowiki>
importScript('User:Misza13/statusChanger.js');
if (mw.config.get('wgPageName') == 'Special:Watchlist') {
importScript('User:Misza13/watchlistSorter.js');
}
importScript('User:Misza13/viewSource.js');statusChangerConfig = {
statusList : [ 'in', 'busy', 'school', 'work', 'out' ],
};
/*
* Usage :Include a call to <code>addForceSummary()</code> in your page load function</s>
* Possible improvements :Make any form submission force a summary. Note that requiring an edit summary on preview or diff is not useful since "save" still needs to gain focus or be clicked before a commit can occur.
A heavily modified and expanded version of this code is now in use across the entire [[SourceWatch]] wiki. Here's a [http://www.sourcewatch.org/index.php?title=MediaWiki:Monobook.js#Edit_summary_stuff direct link to the code]. A particular enhancement in the SourceWatch code is that it provides a dropdown next to the edit summary textfield containing common edit summaries. Selecting one of these automatically inserts that summary into the textfield. The code also examines which subproject of SourceWatch the page belongs to, and adds an appropriate prefix to the edit summary.
<source lang=javascript> */
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:','[[User Talk:Flyingidiot|(fi)]]');
if(r == null) { return false; }
document.forms.editform.wpSummary.value = r;
}
return true;
}
$(addForceSummary);
/*split user warnings and deletions <nowiki>*/
function getUserName() {
switch (mw.config.get('wgCanonicalNamespace')) {
case 'User':
/*<![CDATA[*/
addButton('http://upload.wikimedia.org/wikipedia/commons/3/33/Button_exclamation.png','delete your own user page','{{','}}','subst:user:flyingidiot/2','mw-editbutton-media');
/*]]>*/;
break
case 'User_talk':
/*<![CDATA[*/
addButton('http://upload.wikimedia.org/wikipedia/commons/f/fc/Important-2.svg','autobio','{{subst:User:Flyingidiot/wb1|','}}','Article','mw-editbutton-media');
addButton('http://upload.wikimedia.org/wikipedia/commons/4/44/Warn1.png','First User Warning Vandal','{{subst:uw-vandalism1|','|--~~~~}}','Article','mw-editbutton-media');
addButton('http://upload.wikimedia.org/wikipedia/commons/e/e4/Warn2.png','Second User Warning Vandal','{{subst:uw-vandalism2|','|--~~~~}}','article','mw-editbutton-math');
addButton('http://upload.wikimedia.org/wikipedia/commons/8/84/Warn3.png','Third User Warning Vandal','{{subst:uw-vandalism3|','|--~~~~}}','Article','mw-editbutton-nowiki');
addButton('http://upload.wikimedia.org/wikipedia/commons/b/bd/Warn4.png','Final User Warning Vandal','{{subst:uw-vandalism4|','|--~~~~}}','article','mw-editbutton-nowiki');
addButton('http://upload.wikimedia.org/wikipedia/commons/7/76/Testwarn1.png','testpage userwarn 1','{{subst:Uw-test1|','|--~~~~}}','Article','mw-editbutton-signature');
addButton('http://upload.wikimedia.org/wikipedia/commons/0/03/Testwarn2.png','testpage userwarn 2','{{subst:uw-test2|','|--~~~~}}','Article','mw-editbutton-signature');
addButton('http://upload.wikimedia.org/wikipedia/commons/7/72/Testwarn3.png','testpage userwarn 3','{{subst:Uw-test3|','|--~~~~}}','Article','mw-editbutton-signature');
addButton('http://upload.wikimedia.org/wikipedia/commons/9/9d/Testwarn4.png','testpage userwarn 4','{{subst:uw-test4|','|--~~~~}}','Article','mw-editbutton-signature');
addButton('http://upload.wikimedia.org/wikipedia/commons/4/48/Deletewarn1.png','Userwarn delete 1','{{subst:uw-delete1|','|--~~~~}}','Article','mw-editbutton-table');
addButton('http://upload.wikimedia.org/wikipedia/commons/7/7d/Deletewarn2.png','Userwarn delete 2','{{subst:uw-delete2|','|--~~~~}}','Article','mw-editbutton-table');
addButton('http://upload.wikimedia.org/wikipedia/commons/0/07/Deletewarn3.png','Userwarn delete 3','{{subst:uw-delete3|','|--~~~~}}','Article','mw-editbutton-table');
addButton('http://upload.wikimedia.org/wikipedia/commons/f/f4/Deletewarn4.png','Userwarn delete 4','{{subst:uw-delete4|','|--~~~~}}','Article','mw-editbutton-table');
addButton('http://upload.wikimedia.org/wikipedia/commons/c/cd/Warncreate1.png','Userwarn create nonsense 1','{{subst:Uw-create1|','| --~~~~}}','Article','mw-editbutton-table');
addButton('http://upload.wikimedia.org/wikipedia/commons/0/01/Warncreate2.png','Userwarn create nonsense 2','{{subst:Uw-create2|','| --~~~~}}','Article','mw-editbutton-table');
addButton('http://upload.wikimedia.org/wikipedia/commons/0/09/Warncreate3.png','Userwarn create nonsense 3','{{subst:Uw-create3|','|--~~~~}}','Article','mw-editbutton-link');
addButton('http://upload.wikimedia.org/wikipedia/commons/0/00/Warncreate4.png','Userwarn create nonsense 4','{{subst:Uw-create4|','|--~~~~}}','Article','mw-editbutton-link');/*]]>*/;
addButton('http://upload.wikimedia.org/wikipedia/commons/a/a4/Spam1.png','spam userwarn 1','{{subst:Uw-spam1|','|--~~~~}}','Article','mw-editbutton-signature');
addButton('http://upload.wikimedia.org/wikipedia/commons/2/27/Spam2.png','spam userwarn 2','{{subst:Uw-spam2|','|--~~~~}}','Article','mw-editbutton-signature');
addButton('http://upload.wikimedia.org/wikipedia/commons/0/02/Spam3.png','spam userwarn 3','{{subst:Uw-spam3|','|--~~~~}}','Article','mw-editbutton-signature');
addButton('http://upload.wikimedia.org/wikipedia/commons/f/fb/Spam4.png','spam userwarn 4','{{subst:Uw-spam4|','|--~~~~}}','Article','mw-editbutton-signature');
break
default:
/*<![CDATA[*/
addButton('http://upload.wikimedia.org/wikipedia/commons/3/33/Button_exclamation.png','FIdeletion','{{user:Flyingidiot/del|','}}','|','mw-editbutton-media');
addButton('http://upload.wikimedia.org/wikipedia/commons/3/3d/ButtonSpam.png','Delete spam','{{','}}','Db-spam','mw-editbutton-bold');
addButton('http://upload.wikimedia.org/wikipedia/commons/c/ca/NonsenseDelete.png','Delete nonsense','{{','}}','Db-nonsense','mw-editbutton-italic');
addButton('http://upload.wikimedia.org/wikipedia/commons/2/28/Nonnotable.png','Delete unnotable','{{','}}','db-bio','mw-editbutton-link');
addButton('http://upload.wikimedia.org/wikipedia/commons/6/62/Button_stop.png','Delete for a special reason','{{db','}}','|','Reason','mw-editbutton-extlink');
addButton('http://upload.wikimedia.org/wikipedia/commons/e/e2/Button_contexto.png','Delete empty or no context','{{','}}','db-nocontext','mw-editbutton-headline');
addButton('http://upload.wikimedia.org/wikipedia/commons/3/3b/Button_crocs.png','Delete attack page','{{','}}','db-attack','mw-editbutton-image');
addButton('http://upload.wikimedia.org/wikipedia/commons/c/cc/Bouton_Vandale2.png','Delete blanked','{{','}}','db-blankcsd','mw-editbutton-image');
addButton('http://commons.wikimedia.org/wiki/Image:Wiki_test.GIF','Delete test','{{','}}','db-test','mw-editbutton-image');
addButton('http://upload.wikimedia.org/wikipedia/commons/6/62/Button_desambig.png','Disambiguate the page','{{disambig','}}','','mw-editbutton-hr');
/*]]>*/;
}
}
$(getUserName());
/* </source> */
if ( typeof $ != 'undefined' && typeof $.fn.wikiEditor != 'undefined' ) {
$(document).ready( function() {
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'advanced',
'group': 'format',
'tools': {
'strikethrough': {
label: 'Strike',
type: 'button',
icon: 'http://upload.wikimedia.org/wikipedia/commons/9/95/Toolbaricon_strike_s.png',
action: {
type: 'encapsulate',
options: {
pre: "<s>",
post: "</s>"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'advanced',
'group': 'format',
'tools': {
'hline': {
label: 'Horizontal line',
type: 'button',
icon: 'http://upload.wikimedia.org/wikipedia/commons/b/b4/Toolbaricon_rule.png',
action: {
type: 'encapsulate',
options: {
pre: "----",
ownline: true
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'advanced',
'group': 'format',
'tools': {
'comment': {
label: 'HTML comment',
type: 'button',
icon: 'http://upload.wikimedia.org/wikipedia/commons/e/e7/Toolbaricon_hidden.png',
action: {
type: 'encapsulate',
options: {
pre: "<!-- ",
post: " -->"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'advanced',
'group': 'format',
'tools': {
'math': {
label: 'Math',
type: 'button',
icon: 'http://upload.wikimedia.org/wikipedia/commons/1/1c/Toolbaricon_math.png',
action: {
type: 'encapsulate',
options: {
pre: "<math>",
post: "</math>"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'advanced',
'group': 'format',
'tools': {
'blockquote': {
label: 'Blockquote',
type: 'button',
icon: 'http://upload.wikimedia.org/wikipedia/commons/4/4e/Toolbaricon_quote.png',
action: {
type: 'encapsulate',
options: {
pre: "<blockquote>",
post: "</blockquote>"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'advanced',
'group': 'format',
'tools': {
'transclude': {
label: 'Transclude',
type: 'button',
icon: 'http://upload.wikimedia.org/wikipedia/commons/2/20/Toolbaricon_transclude.png',
action: {
type: 'encapsulate',
options: {
pre: "{{",
post: "}}"
}
}
}
}
} );
} );
}
if ( typeof $ != 'undefined' && typeof $.fn.wikiEditor != 'undefined' ) {
$( document ).ready( function() {
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'sections': {
'emoticons': {
'type': 'toolbar',
'label': 'Emoticons'
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'emoticons',
'groups': {
'emoticons': {
'label': 'Emoticons'
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'emoticons',
'group': 'emoticons',
'tools': {
'smile': {
label: 'Smile',
type: 'button',
icon: 'http://upload.wikimedia.org/wikipedia/commons/thumb/7/79/Face-smile.svg/25px-Face-smile.svg.png',
action: {
type: 'encapsulate',
options: {
pre: "[[File:Face-smile.svg|20px]]"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'emoticons',
'group': 'emoticons',
'tools': {
'frown': {
label: 'Frown',
type: 'button',
icon: 'http://upload.wikimedia.org/wikipedia/commons/thumb/0/06/Face-sad.svg/25px-Face-sad.svg.png',
action: {
type: 'encapsulate',
options: {
pre: "[[File:Face-sad.svg|20px]]"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'emoticons',
'group': 'emoticons',
'tools': {
'plain': {
label: 'Plain',
type: 'button',
icon: 'http://upload.wikimedia.org/wikipedia/commons/thumb/d/df/Face-plain.svg/25px-Face-plain.svg.png',
action: {
type: 'encapsulate',
options: {
pre: "[[File:Face-plain.svg|20px]]"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'emoticons',
'group': 'emoticons',
'tools': {
'wink': {
label: 'Wink',
type: 'button',
icon: 'http://upload.wikimedia.org/wikipedia/commons/thumb/5/57/Face-wink.svg/25px-Face-wink.svg.png',
action: {
type: 'encapsulate',
options: {
pre: "[[File:Face-wink.svg|20px]]"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'emoticons',
'group': 'emoticons',
'tools': {
'tongue': {
label: 'Tongue',
type: 'button',
icon: 'http://upload.wikimedia.org/wikipedia/commons/thumb/7/7e/Face-tongue.svg/25px-Face-tongue.svg.png',
action: {
type: 'encapsulate',
options: {
pre: "[[File:Face-tongue.svg|20px]]"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'emoticons',
'group': 'emoticons',
'tools': {
'surprised': {
label: 'Surprised',
type: 'button',
icon: 'http://upload.wikimedia.org/wikipedia/commons/thumb/7/79/Face-surprise.svg/25px-Face-surprise.svg.png',
action: {
type: 'encapsulate',
options: {
pre: "[[File:Face-surprise.svg|20px]]"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'emoticons',
'group': 'emoticons',
'tools': {
'confused': {
label: 'Confused',
type: 'button',
icon: 'http://upload.wikimedia.org/wikipedia/commons/thumb/1/1e/Face-confused.svg/25px-Face-confused.svg.png',
action: {
type: 'encapsulate',
options: {
pre: "[[File:Face-confused.svg|20px]]"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'emoticons',
'group': 'emoticons',
'tools': {
'grin': {
label: 'Grin',
type: 'button',
icon: 'http://upload.wikimedia.org/wikipedia/commons/thumb/b/bc/Face-grin.svg/25px-Face-grin.svg.png',
action: {
type: 'encapsulate',
options: {
pre: "[[File:Face-grin.svg|20px]]"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'emoticons',
'group': 'emoticons',
'tools': {
'braces': {
label: 'Braces grin',
type: 'button',
icon: 'http://upload.wikimedia.org/wikipedia/commons/thumb/6/6e/Face-grin-braces.svg/25px-Face-grin-braces.svg.png',
action: {
type: 'encapsulate',
options: {
pre: "[[File:Face-grin-braces.svg|20px]]"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'emoticons',
'group': 'emoticons',
'tools': {
'crying': {
label: 'Crying',
type: 'button',
icon: 'http://upload.wikimedia.org/wikipedia/commons/thumb/e/e9/Face-crying.svg/25px-Face-crying.svg.png',
action: {
type: 'encapsulate',
options: {
pre: "[[File:Face-crying.svg|20px]]"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'emoticons',
'group': 'emoticons',
'tools': {
'blush': {
label: 'Blush',
type: 'button',
icon: 'http://upload.wikimedia.org/wikipedia/commons/thumb/4/4d/Face-blush.svg/25px-Face-blush.svg.png',
action: {
type: 'encapsulate',
options: {
pre: "[[File:Face-blush.svg|20px]]"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'emoticons',
'group': 'emoticons',
'tools': {
'laughing': {
label: 'Laughing',
type: 'button',
icon: 'http://upload.wikimedia.org/wikipedia/commons/thumb/1/15/Face-smile-big.svg/25px-Face-smile-big.svg.png',
action: {
type: 'encapsulate',
options: {
pre: "[[File:Face-smile-big.svg|20px]]"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'emoticons',
'group': 'emoticons',
'tools': {
'kiss': {
label: 'Kiss',
type: 'button',
icon: 'http://upload.wikimedia.org/wikipedia/commons/thumb/a/a8/Face-kiss.svg/25px-Face-kiss.svg.png',
action: {
type: 'encapsulate',
options: {
pre: "[[File:Face-kiss.svg|20px]]"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'emoticons',
'group': 'emoticons',
'tools': {
'glasses': {
label: 'Glasses',
type: 'button',
icon: 'http://upload.wikimedia.org/wikipedia/commons/thumb/0/0f/Face-glasses.svg/25px-Face-glasses.svg.png',
action: {
type: 'encapsulate',
options: {
pre: "[[File:Face-glasses.svg|20px]]"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'emoticons',
'group': 'emoticons',
'tools': {
'nerd': {
label: 'Nerd',
type: 'button',
icon: 'http://upload.wikimedia.org/wikipedia/commons/thumb/0/03/Face-grin_expert.svg/25px-Face-grin_expert.svg.png',
action: {
type: 'encapsulate',
options: {
pre: "[[File:Face-grin_expert.svg|20px]]"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'emoticons',
'group': 'emoticons',
'tools': {
'angel': {
label: 'Angel',
type: 'button',
icon: 'http://upload.wikimedia.org/wikipedia/commons/thumb/d/d5/Face-angel.svg/25px-Face-angel.svg.png',
action: {
type: 'encapsulate',
options: {
pre: "[[File:Face-angel.svg|20px]]"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'emoticons',
'group': 'emoticons',
'tools': {
'devil': {
label: 'Devil',
type: 'button',
icon: 'http://upload.wikimedia.org/wikipedia/commons/thumb/7/70/Face-devil-grin.svg/25px-Face-devil-grin.svg.png',
action: {
type: 'encapsulate',
options: {
pre: "[[File:Face-devil-grin.svg|20px]]"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'emoticons',
'group': 'emoticons',
'tools': {
'monkey': {
label: 'Monkey',
type: 'button',
icon: 'http://upload.wikimedia.org/wikipedia/commons/thumb/b/bc/Face-monkey.svg/25px-Face-monkey.svg.png',
action: {
type: 'encapsulate',
options: {
pre: "[[File:Face-monkey.svg|20px]]"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'emoticons',
'group': 'emoticons',
'tools': {
'718': {
label: '718 Smiley',
type: 'button',
icon: 'http://upload.wikimedia.org/wikipedia/commons/thumb/f/fb/718smiley.svg/25px-718smiley.svg.png',
action: {
type: 'encapsulate',
options: {
pre: "[[File:718smiley.svg|20px]]"
}
}
}
}
} );
} );
}
// CHECK THAT I'VE REMEMBERED TO SIGN TALK PAGES AND IF SURE DO IT AUTOMATIC:
// *** aut. signing / (automatische Unterschrift) *** [[User:Olliminatore/signing.js]]
// created 23.04.2006 by [[User:Olliminatore]]
// updated 23.04.2006 by [[:en:User:Ilmari Karonen]]
// current version 1.56 13.03.2007
// Interwiki <noinclude>[[de:User:Olliminatore/signing.js]]</noinclude>
//<pre><nowiki>
String.prototype.trim = function(){return this.replace(/^\s*|\s*$/g,"")};
if (typeof usersignature == 'undefined') usersignature = ' --\~\~\~\~\n';
if (typeof regpages == 'undefined') { // list of all none talk pages
var regpages = [
':Village pump',
':Articles for deletion',
':Requests for ',
':Reference desk',
':Deletion review',
':Templates for deletion',
'.*noticeboard.*',
':checkuser',
':arbitration',
':feedback',
':page protection',
'mediation)',
':Bot requests',
':Help desk',
':Editor review',
':Adminship survey',
':Cleanup',
':Miscellany for deletion',
':New contributors\' help page',
':Media copyright questions'
];
}
// regarded pages type encoded
if (mw.config.get('wgCanonicalNamespace').match(/talk$/i)) var regpages = "";
for (p in regpages) if (mw.config.get('wgPageName').indexOf(regpages[p]) != -1){regpages=false; break}
if (!regpages)
$(function(){
if (!(window.editform = document.forms['editform'])) return;
// Add a new checkbox to the Wiki editOptions.
sigBox = document.createElement("input");
sigBox.setAttribute('type','checkbox');
sigBox.setAttribute('name','wpSigning');
sigBox.setAttribute('id','wpSigning');
sigBox.setAttribute('checked','checked');
sigBox.defaultChecked=true;
neuB = document.createElement("label");
neuB.appendChild(sigBox);
neuB.appendChild(document.createTextNode("Sign"));
neuB.setAttribute('for','wpSigning');
neuB.setAttribute('title','Sign this edit automatic.');
function setSigBox() { // switch enable box
if (editform.wpMinoredit.checked) sigBox.setAttribute('disabled','disabled');
else sigBox.removeAttribute('disabled');
};
var txtarea=editform.elements['wpTextbox1'];
var txtOld=txtarea.value.trim();
// txtOld_l=txtOld.length
var txtOldEnd=txtOld.slice(-24);
var sig = /~{3}/g;
if (!tNode){
//editform.insertBefore(neuB, editform.elements['wpWatchthis']); // maybe FIXME: raised an NS_DOM_ERR!
var tNode = editform.elements['wpMinoredit'].parentNode; // DOM workaround!?
tNode.divs = tNode.getElementsByTagName("DIV");
tNode.divs = tNode.divs.item(tNode.divs.length-1); // last div
tNode.insertBefore(neuB, tNode.divs);
setSigBox();
}
function doSign(event){
if(editform.onsubmit==''){ // only once!
removeEvent(editform.wpSave,"click",doSign);
removeEvent(editform.wpPreview,"click",doSign);
}
if(editform.onsubmit=='') removeEvent(editform.wpSave,"click",doSign); // only once!
if(editform.wpMinoredit.checked || !sigBox.checked) return;
txtarea.focus();
var cOld = txtOld.match(/<nowiki>.*?~{3}.*?<\/nowiki>/g); // exception for nowiki
if (cOld) cOld = cOld.length;
cNew = txtarea.value.match(sig); if (cNew) cNew = cNew.length;
if (cNew > cOld){ // if there are a sign, check for true
var cNew2 = txtarea.value.match(/\{\{subst\:unsig.*?~{3}\}\}/); // exception for Template:unsigned
cNew -= (cNew2)?cNew2.length:0;
}
if(cNew <= cOld){ // if nothing then search a set position
txt=txtarea.value.trim();
txtEnd=txt.slice(-24);
if(txtOldEnd!=txtEnd) return txtarea.value = txt + usersignature; // aut. underwrite
else { // post between
pos = getCaretPos(txtarea);
pos = txt.indexOf('\n', pos); // go to the post-end
txtEnds = txt.substr(pos,24).replace(/(^\s*)/,""); // after
txtpEnds = txt.slice(pos-18,pos); // before
oldp = txtOld.indexOf(txtEnds);
if(oldp!=-1 && oldp < pos - 3 && txtOld.indexOf(txtpEnds+RegExp.$1+txtEnds)==-1) // if some added
return txtarea.value = txt.slice(0,pos).trim() + usersignature + txt.slice(pos+1);
}
// FIXME: then the edit-end is not found!?
}
else if(!sig.test(txtOld) || cOld < cNew) return;
if (event) event=(window.Event)? event.target: event.srcElement;
if (event.name == 'wpPreview') return; // not for preview
return editform.onsubmit=new Function("editform.onsubmit='';"
+"return confirm('No signing was found. Continue anyway?')"); //warn if saving without signature
};
addEvent(editform.wpSave,"click", doSign);
addEvent(editform.wpPreview,"click", doSign);
addEvent(editform.wpMinoredit,"click", setSigBox);
});
function getCaretPos(txtObj){
if (txtObj.setSelectionRange) return txtObj.selectionStart; // NS like
else if(!document.selection) return 0; // not IE like
var c="\001", pos=0;
var range=document.selection.createRange();
var txt=range.text, dul=range.duplicate();
dul.moveToElementText(txtObj);
range.text=txt+c;
pos=(dul.text.indexOf(c));
range.moveStart('character',-1);
range.text="";
return pos;
};
/* add/removeEvent Original idea by John Resig
Tweaked by Scott Andrew LePera, Dean Edwards and Peter-Paul Koch
Fixed for IE by Tino Zijdel (crisp) @date 2005-10 */
function addEvent(obj,type,fn){if(obj.addEventListener){obj.addEventListener(type,fn,false)}else if(obj.attachEvent){var eProp=type+fn;obj["e"+eProp]=fn;obj[eProp]=function(){obj["e"+eProp](window.event)};obj.attachEvent("on"+type,obj[eProp])}else{obj['on'+type]=fn}};
function removeEvent(obj,type,fn){if(obj.removeEventListener){obj.removeEventListener(type,fn,false)}else if(obj.detachEvent){var eProp=type+fn;obj.detachEvent("on"+type,obj[eProp]);obj['e'+eProp]=null;obj[eProp]=null}else{obj['on'+type]=null}};
// *** end *** </nowiki></pre>
//////////STATUS CHANGER
// Creator: Misza13
// Credits: Voyagerfan5761 for some minor improvements
// Modified by Xenocidic to simply use /Status as a one word indicator,
// Modified by Kraftlos to include Sleep status
// compatible with {{Statustop}} for display
$(function (){
//Check if the config is defined
if (typeof(statusChangerConfig) == 'undefined') {
statusChangerConfig = {}
}
if (typeof(statusChangerConfig.statusList) == 'undefined') {
statusChangerConfig.statusList = [ 'online', 'busy', 'around', 'offline', 'sleep' ];
}
if (typeof(statusChangerConfig.statusPage) == 'undefined') {
statusChangerConfig.statusPage = 'User:' + mw.config.get('wgUserName') + '/Status';
}
//Add the links
for (var i=0; i<statusChangerConfig.statusList.length; i++) {
var stat = statusChangerConfig.statusList[i];
var message = (stat === "sleep") ? link = "asleep" : link = stat;
mw.util.addPortletLink(
"p-personal", //target tab - personal links
mw.config.get('wgServer') + mw.config.get('wgScript') + "?title=" + statusChangerConfig.statusPage + "&action=edit&newstatus=" + stat, //link URL
stat, //link text
"pt-status-" + stat, //id of new button
"I'm " + message + "!", //hover text
"", //???
document.getElementById("pt-logout")); //add before logout button
}
if (location.href.indexOf("&action=edit&newstatus=") == -1) return; //Are we here to auto-edit the status?
//Get new status
statusRegExp = /&action=edit&newstatus=(.*)/;
var status = statusRegExp.exec(location.href)[1];
//Modify the form
document.getElementById('wpTextbox1').value = status;
if (status == "sleep")
{ status = "sleeping"; }
document.getElementById('wpSummary').value = mw.config.get('wgUserName') + " is now " + status +".";
document.getElementById('wpMinoredit').checked = true;
//Submit it!
document.getElementById('editform').submit();
});
//[[Category:Wikipedia scripts|statusChanger]]