User:Poccil/monobook.js

function getPname { z=document.getElementById("content").childNodes; for (var n=0;n<z.length;n++) { if (z[n].className=="firstHeading") { var text = z[n].textContent ? z[n].textContent : z[n].innerText; return text; } } }

function addLink(where, url, name, id, title, key, after){ //* where is the id of the toolbar where the button should be added; //  i.e. one of "p-cactions", "p-personal", "p-navigation", or "p-tb". //   //* url is the URL which will be called when the button is clicked. //  javascript: urls can be used to do more complex things. //   //* name is what will appear as the name of the button. //   //* id is the id of the button; it's best to define one. //  Use a prefix to make sure its unique. Optional. //   //* title is the tooltip title that gives a longer description //  of the button; if you define a accesskey, mention it here. Optional. //   //* key is the char you want for the accesskey. Optional. //   //* after is the id of the button you want to follow this one. Optional. //   var na = document.createElement('a'); na.href = url; na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); if(id) li.id = id; li.appendChild(na); var tabs = document.getElementById(where) tabs=tabs.getElementsByTagName('ul')[0]; if(after) { tabs.insertBefore(li,document.getElementById(after)); } else { tabs.appendChild(li); }   if(id) { if(key && title) { ta[id] = [key, title]; } else if(key) { ta[id] = [key, '']; } else if(title) { ta[id] = ['', title];} }   // re-render the title and accesskeys from existing code in wikibits.js    akeytt; return li; }

function getElementsByClassName(oElm, strTagName, strClassName){ var arrElements=(strTagName=="*"&&oElm.all)?oElm.all: oElm.getElementsByTagName(strTagName); var arrReturnElements = new Array; strClassName = strClassName.replace(/\-/g, "\\-"); var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)"); var oElement; for(var i=0; i<arrElements.length; i++){ oElement = arrElements[i]; if(oRegExp.test(oElement.className)){ arrReturnElements.push(oElement); } } return (arrReturnElements) }

function getelbyclass(cls){ var e=getElementsByClassName(document,"*",cls) return e?e[0]:null }

function getspclpagelist(cls){ var e=document.getElementById("bodyContent") e=e.getElementsByTagName("ul") return e?e[0]:null }

function sortfunc(a,b){ return a[2]-b[2] }

function sortlist{ var a=[] var listel=getelbyclass('special') var list=listel.childNodes for(var i=0;i<list.length;i++){ var itxt=list[i].innerText itm=itxt.match(/\[([\d,]+)\s+bytes/i) if(itm&&itm[1]){ itm=parseInt(itm[1].replace(/[\.,]/g,"")) a[i]=[i,list[i],itm] } else { a[i]=[i,list[i],0] } } a=a.sort(sortfunc) for(var i=0;i<a.length;i++){ listel.appendChild(a[i][1]) } }

function removeimagereverts{ var a=[] var listel=getspclpagelist var list=listel.childNodes for(var i=0;i<list.length;i++){ var itxt=list[i].innerText if(/reverted\s+to\s+earlier/i.exec(itxt)){ a[a.length]=list[i] } } for(var i=0;i<a.length;i++){ listel.removeChild(a[i]) } }

$(function{ addLink("p-navigation",'javascript:sortlist',"Sort items","poccil-sort") addLink("p-navigation",'javascript:removeimagereverts', "Remove image reverts","poccil-noimgrev") }) //Following from User:Marudubshinki/cologneblue.js

function importPage(site){ var s=site.replace(/ /g,"_") s=escape(s) s=s.replace(/(\[\[|\]\])/g,"") s=s.replace(/([\/\[\]])/g, function(a,b){ return "%"+b.charCodeAt(0).toString(16).toUpperCase }) var x='' // alert(x) document.write(x); } //Import two prerequisites for some scripts. importPage('Wikipedia:WikiProject User scripts/Scripts/addLink'); importPage('Wikipedia:WikiProject User scripts/Scripts/addTab');

//add in cacyle's editor // include comfortable javascript editor by cacycle // levels of undo (each level holds the whole text) undoBufferMax = 20; // style for preview box stylePreviewBox = 'background-color: #f9f9f9;'; // style for custom edit buttons styleButtons = 'font-size: smaller; padding-left: 0.1em; padding-right: 0.1em'; // presets for input field dropdown options findHistoryLength = 10; // preset for combo box select options presetOptions = []; presetOptions['summary'] = [ 'Copyedit', 'Linkfix', 'Reverting vandalism', 'Formatting source text' ]; // expiration time span for history cookies in seconds cookieExpireSec = (365 * 24 * 60 * 60); // enable cursor horizontal position memory cursorMemory = true; // show at least this number of lines ahead of cursor movement scrollMargin = 1; // show at least this number of lines ahead of cursor movement for findMargin = 2; // find ahead checkbox selected by default findAheadSelected = true; // css for change indicators styleDelete = 'font-weight: normal; text-decoration: none; color: #ffffff; background-color: #990033;'; styleInsert = 'font-weight: normal; text-decoration: none; color: #ffffff; background-color: #009933;'; styleMoved = 'font-weight: bold; vertical-align: text-bottom; font-size: xx-small; padding: 0; border: solid 1px;'; styleBlock = [ 'background-color: #ffff44;', 'background-color: #b0ff90;', 'background-color: #ffcc99;', 'background-color: #99ffff;', 'background-color: #99ccff;', 'background-color: #cc99ff;', 'background-color: #ff99cc;', 'background-color: #ffd040;', 'background-color: #d0d0d0;' ]; // html for change indicators, {number} is replaced by the block number, {block} is replaced by the block style htmlMovedRight = '" style="' + styleMoved + ' {block}">'; htmlMovedLeft  = ''; htmlBlockStart = ''; htmlBlockEnd   = ' '; htmlDeleteStart = ''; htmlDeleteEnd  = ' '; htmlInsertStart = ''; htmlInsertEnd  = ' '; // minimal number of real words for a moved block (0 for always displaying block move indicators) blockMinLength = 3; // exclude identical sequence starts and endings from change marking wordDiff = true; // enable recursive diff to resolve problematic sequences recursiveDiff = true; // enable block move display showBlockMoves = true; importPage('User:Cacycle/diff.js') importPage('User:Pilaf/livepreview.js') importPage('User:Cacycle/editor.js')

if(0){

function getAnchors { var s=[''], anchs=document.getElementsByTagName('A'); for (var i=0; i<anchs.length; ++i) if (anchs[i].name && anchs[i].name!='top') s.push(anchs[i].name); return s; } window.handleKeys=function(evt){ if (window.handleKeys.disabled) { return true; } var k = window.event ? window.event.keyCode : ( evt.keyCode ? evt.keyCode : evt.which); if (!k) return; var letter=String.fromCharCode(k); switch (letter) { case 'j': changeAnchor(1);      return false; case 'J': changeAnchor('last'); return false; case 'k': changeAnchor(-1);     return false; case 'K': changeAnchor('first'); return false; default: return true; } } window.handleKeys.disabled=false; window.handleKeys.disableFlags=[]; function setupFocusHandlers(elType, startAt) { var inputs=document.getElementsByTagName(elType); var j=startAt || 0; for (var i=0; i<inputs.length; ++i) { if (elType=='input' && inputs[i].type.toLowerCase!='text') { continue; } window.handleKeys.disableFlags[j]=false; inputs[i].onfocus=function{ window.handleKeys.disableFlags[j]=true; updateDisabledFlag; } inputs[i].onblur=function{ window.handleKeys.disableFlags[j]=false; updateDisabledFlag; } ++j; } //alert(j + ' handlers installed'); return j; } function updateDisabledFlag { for (var i=0; i 0) { var target=loc.slice(1).join('#'); for (var i=0; i=anchs.length) pos=anchs.length-1; } }     else pos = 0; } /* switch */ var newloc=loc[0] + '#' + anchs[pos]; if(document.location!=newloc) document.location=newloc; } var sectionKeysPage=( ! /^(Editing|Search -|Confirm|Move page|Logs|E-mail user|All pages|Block user)/.test(document.title)  &&  ! /([?&]=|wiki\/)[Ss]pecial:/.test(document.location) ); if (sectionKeysPage) { addOnloadHook(function{     var j=setupFocusHandlers('input');      setupFocusHandlers('textarea', j);      document.onkeypress=window.handleKeys;    }); } // CHECK THAT I'VE REMEMBERED TO SIGN TALK PAGES AND IF SURE DO IT AUTOMATIC: // *** aut. signing / (automatische Unterschrift) *** 23. Apr. 2006 by User:Olliminatore // updated by en:User:Ilmari Karonen v1.43 // // helper-function String.prototype.trim = function{return this.replace(/^\s*|\s*$/g,"")}; $(function {  if(!document.editform) return;  title = document.title; // Object to String  // regarded pages  regpages=new Array('talk:', 'Talk:', ':Village pump', ':Articles for deletion', ':Requests for adminship', ':Current surveys');  for (p in regpages)    if(title.indexOf(regpages[p])!=-1){      regpages=false;      break    }  if(regpages) return;  var txtObj=document.editform.wpTextbox1;  var txtOld=txtObj.value.trim;  txtOld_l=txtOld.length  var txtOldEnd=txtOld.slice(-24);

function doSign{ if(document.editform.onsubmit==''){ // only once! removeEvent(document.editform.wpSave,"click",doSign); removeEvent(document.editform.wpPreview,"click",doSign); }   if(document.editform.wpMinoredit.checked) return true; signing = ' --\ ~\~\~ ~\~\~\~\~\n'; if(!txtObj.value.match(/~{3}/)){ txt=txtObj.value.trim; txtEnd=txt.slice(-24); if(txtOldEnd!=txtEnd) return txtObj.value = txt + signing; // aut. underwrite else { // post between pos = getCaretPos(txtObj); 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 olldp = txtOld.indexOf(txtEnds); if(olldp!=-1 && olldp < pos - 3 && txtOld.search(txtpEnds+txtEnds)==-1) // if some added return txtObj.value = txt.slice(0,pos).trim + signing + txt.slice(pos+1); }    // FIXME: the edit-end is not found }   else if(txtOld.search(/~{3}/)==-1 || !txtOld.match(/ .*?~{3}.*?<\/nowiki>/i)) return 1; else if(txtOld.match(/~{3}/g).length < txtObj.value.match(/~{3}/g).length) return 1; return document.editform.onsubmit=new Function("document.editform.onsubmit='';return confirm('No signing was found. Save anyway?')"); }; addEvent(document.editform.wpSave,"click", doSign) addEvent(document.editform.wpPreview,"click", doSign) }); function getCaretPos(txtObj) { if(txtObj.setSelectionRange) return txtObj.selectionStart; // NS like  else if(!document.selection) return 0;  // not IE like  txtObj.focus;  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; }; 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 *** // // Interwiki de:Benutzer:Olliminatore/Signatur.js

//User:Lupin/popups.js importPage('User:Lupin/popups.js') popupShortcutKeys=true; // optional: enable keyboard shortcuts popupAdminLinks=false;  // optional: enable admin links popupDelay=.7; popupFixRedits=true; popupInitialWidth=200; popupFixRedirs=true; popupFixDabs=true; popupLastModified=true; popupMaxPreviewSentences=1; popupImages=false; popupSubpopups=true; popupWatchRedirredPages=false; popupRedirAutoClick='wpSave'; popupRedlinkRemoval=true; popupLastModified=true; popupDiffDates=true; popupOnlyArticleLinks=true; imagePopupsForImages=false; popupStructure='fancy2';

importPage('Wikipedia:WikiProject_User_scripts/Scripts/Fix_diff_width'); //Formats the article by removing excess whitespace and simplifying links. importPage('Wikipedia:WikiProject User scripts/Scripts/Formatter');

/* Syntax highlighter */ if(document.title.indexOf(".js") == -1)    //   Ignore pages that end in .js addOnloadHook(function  {  /* CSS syntax highlighting */    multicommentRE = new RegExp('(/\\*[\\s\\S]*?\\*/)', 'g');    ruleRE = new RegExp('([^\\{]+)\\{([^\\}]+)\\}', 'g');    idselectorRE = new RegExp('(#[a-zA-Z0-9\-\_]+)\\b', 'g');    classselectorRE = new RegExp('(\\.[a-zA-Z0-9\-\_]+)\\b', 'g');    pairRE = new RegExp('([a-zA-Z-]+):([^;]+);', 'g');    css = document.getElementsByTagName('pre');    for (i = 0; i < css.length; i++) {      c = css[i];      content = c.innerHTML;      content=content.replace(multicommentRE, ' $1 ');      content = content.replace(ruleRE, function(text, selector, body) { selector = selector.replace(idselectorRE, ' $1 '); selector = selector.replace(classselectorRE, ' $1 '); body = body.replace(pairRE, ' $1 : $2 ;'); return selector + '{' + body + '}'; });     c.innerHTML = content;    } });

importPage('User:Zocky/SearchBox.js'); importPage("User:Lupin/recent2.js");

/* */ /* This function is used to include scripts from other Wikipedia pages in mine. I got it from User:Quarl/monobook.js. */

function winc(s) { s = s.replace(/^\[\[/, ).replace(/\]\]$/, ); document.write(''); }

/* Included functions */

winc('User:Omegatron/monobook.js/addlink.js'); // Adds links to lists on the page, such as the personal tools section winc('User:Omegatron/monobook.js/fixdiffwidth.js'); winc('User:Omegatron/monobook.js/edittop.js'); winc('User:Omegatron/monobook.js/namedredirect.js'); winc('User:Omegatron/monobook.js/autolinker.js');

/* Add some extra tabs with different functionalities. */

winc('User:Omegatron/monobook.js/replacetab.js');              // Regex replacements in the text (from User:Trilobite/Tools) winc('User:Omegatron/monobook.js/unverified.js');              // Tag unverified images (from User:Trilobite/Tools) // winc('User:Omegatron/monobook.js/addsincetab.js');          // Shows difference between my last edit and current version (WikiProject User scripts/Scripts/Changes since I last edited) winc('User:Omegatron/monobook.js/dashfixer.js');               // Converts -- into — and so on (User:Omegatron) winc('User:Omegatron/monobook.js/unitformatter.js');           // Formats units according to SI (User:Omegatron) winc('User:Omegatron/monobook.js/mathcharacterfixer.js');      // Fixes up some math characters (not TeX) (User:Omegatron) winc('User:Omegatron/monobook.js/headingformattingfixer.js');  // Adds and removes whitespace to make formatting consistent and readable (User:Omegatron)

/* This function is used to include individual scripts from Quarl's pages in mine. */

function qinc(s) { var x='' document.write(x); }

/* All kinds of scripts from User:Quarl */

qinc('module'); qinc('datetime'); qinc('msg'); qinc('util'); qinc('wikiwidget'); qinc('wikins'); qinc('wikipage'); //qinc('wikiedit'); qinc('diff'); qinc('shortcuts'); qinc('diffsince'); qinc('wikiwatch'); qinc('watchlist'); qinc('watchbutton'); qinc('autofocus'); //qinc('autosummary'); qinc('newmessages'); qinc('tabsince'); $(function { $watchbutton.widgetLoad; $tabsince.widgetLoad; $watchlist.widgetLoad; /* User:Omegatron/monobook.js/quarl.js */ /* uncomment this to hide alert errors */ $msg.alert_disabled=true; }); /* Live Preview */

wpUserName  = 'Poccil';   // User name to display in signatures wpShowImages = true;     // Enable downloading and displaying of images winc('User:Pilaf/livepreview.js'); /* Move things around so that sidebar can be fixed in position and content can scroll independently */ /* Do some things when the page loads */

$(function {    addLink('p-personal', '/wiki/User:Poccil/myskin.js', 'My monobook.js', 'pt-monobookjs', 'monobook.js is used for storing user javascripts', , 'pt-logout');    addLink('p-personal', '/wiki/User:Poccil/myskin.css', 'My monobook.css', 'pt-monobookcss', 'monobook.css is used for storing user CSS styles', , 'pt-logout');    addLink('p-personal', '/w/index.php?title=Special%3AAllpages&from=Poccil&namespace=2', 'My subpages', 'pt-subpages', 'Subpages of my userspace', '', 'pt-logout'); });

/* Duplicate all the tabs from the top on the bottom of the content box, too. */ /* From WikiProject User scripts/Scripts/Duplicate tabs at bottom. */ $(function {    var tabs = document.getElementById('p-cactions').cloneNode(true);    tabs.id = 'mytabs';    var listitems = tabs.getElementsByTagName('LI');    for (i=0;i<listitems.length;i++) {        if(listitems[i].id) listitems[i].id = 'mytabs-' + listitems[i].id;    }

var content = document.getElementById("content");   // Find the content div content.parentNode.insertBefore(tabs, content.nextSibling);   // Place tab list right after content div }); /* See meta:Help:User style/floating quickbar */ $(function { var content = document.getElementById("column-content");   // Find the main content column

var footer = document.getElementById("footer"); // Find the footer footer.parentNode.removeChild(footer);   // Remove the footer from the global wrapper content.appendChild(footer);   // Place footer at the end of the content column;

var tabs = document.getElementById("p-cactions");  // Find the top tab list tabs.parentNode.removeChild(tabs);   // Remove the tab list from the side column content.insertBefore(tabs,content.firstChild);   // Place tab list at the beginning of the content column });

/* */

}