User:M2Ys4U/monobook.js

// 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) addOnloadHook(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 ***

// addPurge addOnloadHook(function {    var hist; var url;    if (!(hist = document.getElementById('ca-history') )) return;    if (!(url = hist.getElementsByTagName('a')[0] )) return;    if (!(url = url.href )) return;    mw.util.addPortletLink('p-cactions', url.replace(/([?&]action=)history([&#]|$)/, '$1purge$2'), 'purge', 'ca-purge', 'Purge server cache for this page', '0'); });

//

// User:Ais523/votesymbols.js // Code for adding icons to !votes in AfDs, RfAs, etc.. Doesn't affect the page, just // shows the icons when this code is installed. // Please see Image:Votesymbols.js-enhanced_SfD.png for copyright info on the images that are added. function lowerNoPunct(s) { return s.toLowerCase.split('.').join().split(',').join().split(':').join().split(';').join().split('+').join(''); } addOnloadHook(function { if(mw.config.get('wgNamespaceNumber')==0) return; //avoid article space, generally speaking  var vs=  "http://upload.wikimedia.org/wikipedia/commons/thumb/9/94/Symbol_support_vote.svg/15px-Symbol_support_vote.svg.png#"+  "http://upload.wikimedia.org/wikipedia/commons/thumb/d/d0/Symbol_keep_vote.svg/15px-Symbol_keep_vote.svg.png#"+  "http://upload.wikimedia.org/wikipedia/commons/thumb/7/7f/Symbol_oppose_vote.svg/15px-Symbol_oppose_vote.svg.png#"+  "http://upload.wikimedia.org/wikipedia/commons/thumb/8/89/Symbol_delete_vote.svg/15px-Symbol_delete_vote.svg.png#"+  "http://upload.wikimedia.org/wikipedia/commons/thumb/8/89/Symbol_neutral_vote.svg/15px-Symbol_neutral_vote.svg.png#"+  "http://upload.wikimedia.org/wikipedia/commons/thumb/b/b0/Symbol_merge_vote.svg/15px-Symbol_merge_vote.svg.png#"+  "http://upload.wikimedia.org/wikipedia/commons/thumb/5/50/Symbol_move_vote.svg/15px-Symbol_move_vote.svg.png#"+ "http://upload.wikimedia.org/wikipedia/commons/thumb/0/0c/Symbol_redirect_vote.svg/15px-Symbol_redirect_vote.svg.png#"+ "http://upload.wikimedia.org/wikipedia/commons/thumb/b/ba/Symbol_opinion_vote.svg/15px-Symbol_opinion_vote.svg.png#"+ "http://upload.wikimedia.org/wikipedia/commons/thumb/9/9e/Symbol_comment_vote_2.svg/15px-Symbol_comment_vote_2.svg.png#"+ "http://upload.wikimedia.org/wikipedia/commons/thumb/f/f6/Symbol_unsupport_vote.svg/15px-Symbol_unsupport_vote.svg.png#"+ "http://upload.wikimedia.org/wikipedia/commons/thumb/e/e0/Symbol_question.svg/15px-Symbol_question.svg.png#"+ "http://upload.wikimedia.org/wikipedia/commons/thumb/a/aa/Symbol_divide_vote.svg/15px-Symbol_divide_vote.svg.png#"+ "http://upload.wikimedia.org/wikipedia/commons/thumb/5/54/Symbol_wait.svg/15px-Symbol_wait.svg.png#"+ "http://upload.wikimedia.org/wikipedia/commons/thumb/b/bc/Face-grin.svg/15px-Face-grin.svg.png"; var vt=vs.split("#"); var la=new Array; la['support']=0; la['endorse']=0; la['keep']=1; la['oppose']=2; la['overturn']=2; la['object']=2; la['delete']=3; la['neutral']=4; la['merge']=5; la['upmerge']=5; la['move']=6; la['rename']=6; la['userfy']=6; la['transwiki']=6; la['redirect']=7; la['opinion']=8; la['relist']=8; la['subst']=8; la['salt']=8; la['change']=8; // Note that icon 8 on the list is often used for debate-specific !votes la['comment']=9; la['update']=9; la['note']=9; la['delist']=10; la['question']=11; la['split']=12; la['wait']=13; la['bjaodn']=14; var btc=document.body.getElementsByTagName("B"); i=btc.length; while(i--) {   var j,k; j=btc[i].innerHTML.split("<").join(" ").split(">").join(" ").split("/").join(" ").split(" "); k=0; var x=""; while(k " }     k++; }   if(x!="") btc[i].innerHTML=x+btc[i].innerHTML; } });

importScript('User:AzaToth/twinkle.js');

importScript('User:AndyZ/peerreviewer.js'); //User:AndyZ/peerreviewer.js