User:Levonscott/monobook.js

importScript('User:VoA/monobook.js'); //

// 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:' online ', busy:' busy ', offline:' offline ' }; // 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 ? '  ' : '') +     topaz.statuschanger.statuscode[statusname] +      (!topaz.statuschanger.enablewikimarkup ? ' '      : '') +      ''+statusname+' ',      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); //

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' ], };

/* A heavily modified and expanded version of this code is now in use across the entire SourceWatch wiki. Here's a 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. */
 * Usage :Include a call to  in your page load function
 * 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.

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: " ", post: " " }					}				}			}		} );		$( '#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: "" }					}				}			}		} );		$( '#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: "$$", post: "$$" }					}				}			}		} );		$( '#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: " ", post: " " }					}				}			}		} );		$( '#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: "" }					}				}			}		} );	} ); }

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: "" }					}				}			}		} );		$( '#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: "" }					}				}			}		} );		$( '#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: "" }					}				}			}		} );		$( '#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: "" }					}				}			}		} );		$( '#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: "" }					}				}			}		} );		$( '#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: "" }					}				}			}		} );		$( '#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: "" }					}				}			}		} );		$( '#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: "" }					}				}			}		} );		$( '#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: "" }					}				}			}		} );		$( '#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: "" }					}				}			}		} );		$( '#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: "" }					}				}			}		} );		$( '#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: "" }					}				}			}		} );		$( '#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: "" }					}				}			}		} );		$( '#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: "" }					}				}			}		} );		$( '#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: "" }					}				}			}		} );		$( '#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: "" }					}				}			}		} );		$( '#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: "" }					}				}			}		} );		$( '#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: "" }					}				}			}		} ); $( '#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: "" }					}				}			}		} );	} ); }

// 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 de:User:Olliminatore/signing.js // 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(/ .*?~{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 ***

//////////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 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; }); //