User:EricEttensohn/vector.js

//importScript("User:PleaseStand/hide-vector-sidebar.js");

mw.loader.load("//de.wikipedia.org/w/index.php?title=Benutzer:TMg/autoFormatter.js&action=raw&ctype=text/javascript");

importScript('User:Rezonansowy/SimpleLightbox.js'); // Backlink: User:Rezonansowy/SimpleLightbox.js

importScript('User:Smith609/toolbox.js');

// Allows the user to select a namespace to search in from the corner search bar prefixString = " Article: \n Article talk: \n Wikipedia: \n Wikipedia talk: \n User: \n User talk: \n WikiProject: \n WikiProject talk: \n Category: \n Category talk: \n Template: \n Template talk: \n Help: \n Special: "; addOnloadHook(addNSSearch); function addNSSearch {   //retrieve existing elements that we're going to use searchBar = document.getElementById("searchInput"); searchButton = document.getElementById("searchButton"); searchForm = document.getElementById("searchform"); searchDiv = document.getElementById("simpleSearch"); //create new elements that we're going to insert prefixList = document.createElement("select"); hiddenInput = document.createElement("input"); //initialize new elements prefixList.id = "prefixList"; prefixList.innerHTML = prefixString; hiddenInput.id = "hiddenInput"; hiddenInput.name = "search"; hiddenInput.type = "hidden"; //insert new elements searchDiv.insertBefore(hiddenInput, searchBar); searchForm.insertBefore(prefixList, searchDiv); //modify old ones searchForm.onsubmit = createSearchTerm; searchForm.style.marginTop = "0px"; searchBar.removeAttribute("name"); //since we're no longer using the search bar to submit the search terms directly searchDiv.style.display = "inline-block"; prefixList.style.marginTop = ".8em"; prefixList.tabIndex = searchBar.tabIndex; } //onsubmit handler; concatenates prefixList and searchBar and inserts into hidden input prior to submission function createSearchTerm(e) {   //retrieve used elements hiddenInput = document.getElementById("hiddenInput"); prefixList = document.getElementById("prefixList"); searchBar = document.getElementById("searchInput"); //do the work (handling special cases) if(prefixList.value == "Article:") {       hiddenInput.value = "" + searchBar.value; }   else if(prefixList.value == "Article talk:") {       hiddenInput.value = "" + "Talk:" + searchBar.value; }   else if(prefixList.value == "WikiProject:") {       hiddenInput.value = "" + "Wikipedia:WikiProject " + searchBar.value; }   else if(prefixList.value == "WikiProject talk:") {       hiddenInput.value = "" + "Wikipedia talk:WikiProject " + searchBar.value; }   else {            hiddenInput.value = "" + prefixList.value + searchBar.value; } }

importScript('User:Cameltrader/Advisor.js');

// User:ais523/bracketmatch.js - Colour matching brackets in a copy of the edit box. // By User:ais523, on a suggestion by User:Absidy. addOnloadHook(function{ var p=document.getElementById('wikiPreview');  if(p==null) p=document.getElementById('viewsourcetext');  if(p)    p.innerHTML+="Parse ";  try  {    var edh=document.getElementsByClassName('editHelp')[0];    if(bm_useparsebutton)      edh.innerHTML='  '+edh.innerHTML;  } catch(x) {} }); function bm_parsebrackets { var t=document.getElementById('wpTextbox1').value; var a=sajax_init_object; var p='action=expandtemplates&generatexml=1&format=json&callback=bm_callback&text='+encodeURIComponent(t); a.open('POST', mw.config.get('wgServer')+mw.config.get('wgScriptPath')+'/api.php'); a.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); a.setRequestHeader("Content-length", p.length); a.setRequestHeader("Connection", "close"); a.onreadystatechange=function{bm_apirespond(a)}; a.send(p); } function bm_showparsed { bm_parsebrackets; return 0; } function bm_apirespond(a) { try {   if(a.readyState==4) eval(a.responseText); } catch(e) {   document.getElementById('bm_parseres').innerHTML= "Could not parse due to a server error. Parse"; } } var colang; function bm_hexdigit(n) { var i=Math.floor(n); if(i<10) return i+''; if(i==10) return 'A'; if(i==11) return 'B'; if(i==12) return 'C'; if(i==13) return 'D'; if(i==14) return 'E'; if(i==15) return 'F'; } function bm_tohex(n) { var i=Math.floor(n); return bm_hexdigit(i/16)+bm_hexdigit(i%16); } function bm_gencol(ang) { var r=Math.sin(ang)+1; var g=Math.sin(ang+3.14159*2/3)+1; var b=Math.sin(ang-3.14159*2/3)+1; return bm_tohex(r*127.5)+bm_tohex(g*127.5)+bm_tohex(b*127.5); } function bm_callback(o) { var subs={"tplarg":"", "template":"", "part":"|", "ext":"&"+"lt;", "/attr":"&"+"gt;", "attr/":"&"+"gt;"}; var h=o.parsetree["*"].split("<"); var i=h.length; var r; var n;  var sp=0; var st=new Array; var col; colang=0; while(--i) {   col=""; n=1; h[i]=h[i].split(">"); h[i][0]=h[i][0].split(" "); r=subs[h[i][0][0]]; if(r==undefined) r=""; if(r=='}}}'||r=='}}') {     st[sp]=bm_gencol(colang); col=st[sp]; sp++; colang+=2.4; //golden angle in radians, approx }   else if(r=='{{{'||r=='{{') {     sp--; col=st[sp]; n=2; }   if(col!="") r=""+r+" "; h[i][0]=r; h[i]=h[i].join(""); } document.getElementById('bm_parseres').innerHTML= " "+h.join("").split("\n").join(" ")+ " Parse "; } function bm_highlight(x,c) { document.getElementById('bm_f'+x+'1').style.backgroundColor=c; document.getElementById('bm_f'+x+'2').style.backgroundColor=c; if(c=="black") window.setTimeout("bm_highlight('"+x+"','transparent')",3000); } // //test: {{{a|b}}} {{a|b}} {{c|{{e|a=b|3=c}}|f}} //test: f g h //test: i {{{{{{{{j}}}}}}}} /* test: {{startofline}}

importScript('User:Js/ajaxPreview.js'); // user:js/ajaxPreview

/* splitPreview = { enabled:  true, width:    null }; splitPreview.init = function { if (wgAction == "edit" || wgAction == "submit") { splitPreview.loadCookies; if (splitPreview.enabled) { splitPreview.draw; }   } }; splitPreview.loadCookies=function { function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') { c = c.substring(1,c.length); } if (c.indexOf(nameEQ) === 0) { return c.substring(nameEQ.length,c.length); } }       return ''; }   var w = readCookie('splitPreview_width'); if (w) { splitPreview.width = w;   } }; splitPreview.saveCookies=function { var cend = "; expires=Tue, 31-Dec-2030 23:59:59 GMT; path=/"; document.cookie = 'splitPreview_width=' + splitPreview.width.toString + cend; }; splitPreview.draw=function { var wp = document.getElementById('wikiPreview'); if (wp) { var w = splitPreview.width; if (!w) { w = window.innerWidth / 3 + 'px'; }       //Make room var topbar = document.evaluate('//div[@id="p-personal"]//div[@class="pBody"]',            document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null); if (topbar.singleNodeValue) { topbar = topbar.singleNodeValue; topbar.style.marginRight=w; }       //Find the container where the placeholder goes. //This differs between monobook and modern skins. var container = document.getElementById('content'); if (!container) { container = document.getElementById('mw_content'); }       container.style.marginRight = w;        var ph = document.createElement('div'); with (ph) { id='splitPreview_placeholder'; style.width=w; style.top='0px'; style.right='0px'; style.bottom='0px'; style.zIndex=90; style.position='fixed'; style.backgroundColor=document.defaultView.getComputedStyle(document.body, null).backgroundColor; //innerHTML = "Testing... "; }       container.appendChild(ph); var slider = document.createElement('div'); with (slider) { id='splitPreview_slider'; style.position='absolute'; style.width='.5em'; style.top='0px'; style.left='0px'; style.bottom='0px'; style.borderLeft='1px solid #aaaaaa'; style.cursor='w-resize'; style.float='left'; }       ph.appendChild(slider); slider.onmousedown=function(event) { event.preventDefault; slider.initialWidth = parseInt( window.innerWidth - event.clientX - ph.offsetWidth ); window.onmouseup=function(event) { window.onmousemove=null; window.onmouseup=null; with (splitPreview) { width=w; saveCookies; }           }            window.onmousemove=function(event) { if (event.clientX > (window.innerWidth / 3)) { w=window.innerWidth - event.clientX - slider.initialWidth+'px'; topbar.style.marginRight=w; ph.style.width=w; container.style.marginRight=w; }           }        }        with (wp) { style.position='absolute'; style.top='0px'; style.left='0.5em'; style.right='0.5em'; style.bottom='0px'; style.float='right'; style.overflow='auto'; }       ph.appendChild(wp); } }; addOnloadHook(splitPreview.init);
 * Split-screen Edit Preview
 * Author: User:Bradv