User:Bernardissimo/monobook.js

importScript("User:Lupin/recent2.js");

importScript('User:Tim_Laqua/Scripts/formatRecentChanges.js');

// Search box for Mediawiki // (c) 2006 User:Zocky, released under GPL //

var sr$t; var sr$f; var sr$s; var sr$r; var sr$w; var sr$i; var sr$re; var sr$mc;

function $e(id) {return document.getElementById(id)}

function srBack { if (sr$s.value=='') {sr$t.focus; return }

if (sr$re.checked) { var searchString = sr$s.value; } else { searchString=sr$s.value.replace(/([\[\]\{\}\|\.\*\?\(\)\$\^\\])/g,'\\$1'); }

searchString="("+searchString+")(?![\\s\\S]*"+searchString+")"; if (sr$mc.checked) var re=new RegExp(searchString); else var re=new RegExp(searchString,"i");

var res = re.exec (sr$t.value.substring(0,sr$t.selectionStart)); if (!res) { var res = re.exec (sr$t.value) }

if (res) {   sr$t.selectionStart=res.index; sr$t.selectionEnd=res.index+res[1].length; } else sr$t.selectionStart=sr$t.selectionEnd; srSync; }

function srNext { if (sr$s.value=='') {sr$t.focus; return }

if (sr$re.checked) { var searchString = sr$s.value; } else { searchString=sr$s.value.replace(/([\[\]\{\}\|\.\*\?\(\)\$\^\\])/g,'\\$1'); }

if (sr$mc.checked) var re=new RegExp(searchString,"g"); else var re=new RegExp(searchString,"gi");

re.lastIndex=sr$t.selectionEnd; var res = re.exec (sr$t.value) if (!res) { re.lastIndex=0; var res = re.exec (sr$t.value) }

if (res) {   sr$t.selectionStart=res.index; sr$t.selectionEnd=res.index+res[0].length; } else sr$t.selectionStart=sr$t.selectionEnd; srSync; }

function srReplace {

var sels=sr$t.selectionStart; var sele=sr$t.selectionEnd; var selr=sr$t.value.length-sele;

if (sr$s.value=='' || sels==sele) {sr$t.focus; return }

if (sr$re.checked) { var searchString = sr$s.value; var replaceString = sr$r.value;

} else { searchString=sr$s.value.replace(/([\[\]\{\}\|\.\*\?\(\)\$\^\\])/g,'\\$1'); replaceString=sr$r.value.replace(/([\$\\])/g,'\\$1'); }

if (sr$mc.checked) var re=new RegExp(searchString,"g"); else var re=new RegExp(searchString,"gi");

re.lastIndex=sels; var res = re.exec (sr$t.value); var $$=0; if (res && res.index==sels && res[0].length==sele-sels) {   if (sr$re.checked) { replaceString=replaceString.replace(/\\\\/g,'&backslash;').replace(/\\\$/g,'&dollar;') var replaceBits=(" "+replaceString).split(/(?=\$\d)/); replaceString=replaceBits[0].substring(1); for (var i=1; i<replaceBits.length; i++) {       $$=replaceBits[i][1]-'0'; if ($$<res.length) replaceString += res[$$] + replaceBits[i].substring(2) else replaceString += replaceBits[i]; }    replaceString=replaceString.replace (/\\n/,"\n").replace (/&backslash;/g,"\\").replace (/&dollar;/g,"\$")

}    sr$t.value= sr$t.value.substring(0,sels) + replaceString + sr$t.value.substring(sele); }

sr$t.selectionStart=sels; sr$t.selectionEnd=sr$t.value.length-selr; srSync; }

function srReplaceall { if (!sr$s.value) {sr$t.focus; return }

var sels=sr$t.selectionStart; var sele=sr$t.selectionEnd; var selr=sr$t.value.length-sele;

var reps;

if (sr$re.checked) { var searchString = sr$s.value; var replaceString = sr$r.value.replace(/\\\\/,'&backslash;').replace(/\\n/,'\n').replace(/&backslash;/,"\\"); } else { searchString=sr$s.value.replace(/([\[\]\{\}\|\.\*\?\(\)\$\^\\])/g,'\\$1'); replaceString=sr$r.value.replace(/([\$\\])/g,'\\$1'); }

if (sele>sels) reps=sr$t.value.substring(sels,sele); else reps=sr$t.value; if (sr$mc.checked) var re=new RegExp(searchString,"g"); else var re=new RegExp(searchString,"gi"); var replaceCounter=0;

var replaceFunc=function{replaceCounter++;return replaceString};

reps=reps.replace(re,replaceFunc);

if (sele>sels) sr$t.value = sr$t.value.substring(0,sels) + reps + sr$t.value.substring(sele); else sr$t.value = reps;

sr$t.selectionStart=sels; sr$t.selectionEnd=sele>sels ? sr$t.value.length-selr : sels; window.status = replaceCounter+" ocurrences of " + searchString + " replaced."; srSync; }

function srToggleCase { var sels=sr$t.selectionStart; var sele=sr$t.selectionEnd; var selr=sr$t.value.length-sele; var selt=sr$t.value.substring(sels,sele);

if (sele>sels) {   if (selt==selt.toUpperCase) selt=selt.toLowerCase else if (selt==selt.toLowerCase && sele-sels>1) selt=selt.substring(0,1).toUpperCase+selt.substring(1).toLowerCase else selt=selt.toUpperCase;

sr$t.value = sr$t.value.substring(0,sels) + selt + sr$t.value.substring(sele); sr$t.selectionStart=sels; sr$t.selectionEnd=sele>sels ? sr$t.value.length-selr : sels; } srSync; }

function srSync {   var i;    var allLines=0; var lineNo=0; var w=sr$t.cols-5;

var dummy=sr$t.value.split("\n"); for (i=0;i<dummy.length;i++){allLines+=Math.ceil(dummy[i].length/w)}

var dummy=sr$t.value.substring(0,sr$t.selectionStart).split("\n"); for (i=0;i';

var ep=$e('toolbar'); if (ep) {     ep.appendChild(im) }   else {     var ep=$e('editform'); ep.parentNode.insertBefore(im,ep); }

sr$i=$e('SearchIcon'); sr$i.accessKey="F"; sr.firstChild.style.display='none';

var ep=$e('editform'); ep.parentNode.insertBefore(sr,ep);

sr$f=$e('srForm'); sr$s=$e('srSearch'); sr$r=$e('srReplace'); sr$re=$e('srRegexp'); sr$mc=$e('srCase');

} }

function srShowHide { if (sr$f.style.display=='none') {   sr$f.style.display='block'; sr$i.accessKey="none"; sr$t.style.width='auto'; sr$s.focus; } else {   sr$f.style.display='none'; sr$t.style.width=sr$w; sr$i.accessKey="F"; } }

document.write('');

$(srInit); //

document.write(' ');

// jncsp-start The section below (up to jncsp-end) is maintained by WikiProject_User_scripts/User-script_manager // jncsp-config setupPopups addTab_ee addSinceTab addUserTabs

if (location.href == "http://en.wikipedia.org/wiki/Wikipedia:WikiProject_User_scripts/User-script_manager") document.write(' ');

// From WikiProject User_scripts/Scripts/Add_LI_link, revision 73544143

function addlilink(tabs, url, name, id, title, key){ 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); 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; }

// From WikiProject User_scripts/Scripts/Changes_since_I_last_edited, revision 60911506

//From http://en.wikipedia.org/w/index.php?title=User:JesseW/monobook.js&oldid=20755510 function addSinceTab { var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; if (window.location.href.indexOf("&action=history&gotosince=true")!=-1) { do_since_I_last_edited }   else if (!/wiki\/Special:|w\/index.php?title=Special:/.test(window.location.href)) { var thetitle=document.title.slice(0, String(document.title).indexOf(" - ")); var l=addlilink(tabs, "/w/index.php?title="+thetitle+"&action=history&gotosince=true", 'Changes since I last edited', ''); l.lastChild.title="Changes since I last edited"; } } function do_since_I_last_edited { var csub=document.getElementById("contentSub"); var msg=document.createElement("p"); msg.appendChild(document.createTextNode                       ("Parsing history... please wait...")); msg.className="error"; csub.insertBefore(msg, csub.firstChild)

var username=document.getElementById("pt-userpage").textContent; var hists=document.getElementById("pagehistory").getElementsByTagName('li'); for (n=0;n<hists.length;n++) { if (hists[n].getElementsByTagName("span")[0].getElementsByTagName('a')[0].textContent==username) { document.location=hists[n].childNodes[1].href; return; }       }

msg.replaceChild(document.createTextNode                        ("You have not edited this page! (recently)"),                         msg.firstChild); }

$(addSinceTab);

// From WikiProject User_scripts/Scripts/Add_tab, revision 73544604

function addTab(url, name, id, title, key){ var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; return addlilink(tabs, url, name, id, title, key) };

// From WikiProject User_scripts/Scripts/User_tabs, revision 73795341

//Please leave the following line //user:Where/usertabs $(function {  if (document.title.search("/") != -1 || document.title.search("- History -") != -1) { //no subpages or history      return;   }   if (document.title.indexOf("User:") == 0 || document.title.indexOf("User talk:") == 0) {      username_a = document.URL.match(/:.*:(.*)/);      username=username_a[1];      addTab("http://en.wikipedia.org/wiki/Special:Contributions/" + username, "contrib", "ca-contrib", "contribs", "");      addTab("http://en.wikipedia.org/w/index.php?title=Special%3ALog&type=move&user=" + username, "page moves", "ca-pagemoves", "page moves", "");      addTab("http://en.wikipedia.org/w/index.php?title=Special%3ALog&type=block&user=" + username, "block log", "ca-blog", "blog", "");      addTab("http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?dbname=enwiki_p&user=" + username, "edit count", "ca-kate", "kate", "");   } });

// From WikiProject User_scripts/Scripts/External_editor, revision 38650024

//add ee

$(function { if (document.URL.search("=") == -1 && !document.getElementById("ca-viewsource") && document.URL.search("/Special:") == -1) { //viewing a page that isn't protected or special    addTab("javascript:location = document.URL + '?action=edit&externaledit=true';", "ee", "ca-exted", "external editor", "");  }  else if (document.title.indexOf("Editing ") == 0) { //this line from techniques subpage of WP:US    addTab("javascript:location = document.URL + '&externaledit=true';", "ee", "ca-exted", "external editor", "");  } } );

// Import User:Lupin/popups.js

document.write(' ');

// jncsp-end

// Script from User:Tra/userwatchlist.js document.write(' ');