User:WhoSaidThat/vector.js

function begin{ importScriptsInOrder( 		['User:WhoSaidThat/RevisionData.js','User:WhoSaidThat/RDSet.js' ,'User:WhoSaidThat/RevisionsUI.js',		function(hist){	 try{ var r=new RevisionsData(wgPageName,loadCompleted);	}catch(e){ alert(hist.success);

} }],		true );

}

$( document ). ready( begin );

// Javascript Page View Tools

$( document ). ready( function{

//hide warinings

if(window.location.href.indexOf('&action=edit')>0){

$('#mw-userjsyoucanpreview').remove; $('#editpage-copywarn').remove; $('html').scrollTop( $('#firstHeading').offset.top );

$('#wpTextbox1').height($('html').height-250);

}

// enclose loose text nodes $('.javascript').contents.each(function(i,o){		if(!o.style){			$(o).replaceWith($(' '+o.nodeValue+' '));		}	});

// find and label functions /*$('.kw2').each(function(i,o){

if($(o).html=='function'){ var fn=$(o.nextSibling).html.replace(/\s/g,''); var p=o; while($(p.previousSibling).html.replace(/\s/,)== || $(p.previousSibling).html=='=' ) p=p.previousSibling; if(p!=o) fn=$(p).html; if(fn.length>2){ $(o).replaceWith($(' function ')); $('.javascript').children(':contains("'+fn+'")').each(function(i,o){					$(o).html($(o).html.replace(fn,''+fn+''));				}); }		}

});*/

// show and hide inside curly braces

$('.br0').each(function(i,o){		if($(o).html=='{'){			$(o).hover(function{ this.style.cursor='pointer'; },function{ this.style.cursor=''; });			$(o).click(function{ var n=this.nextSibling; var show=(n.style.display=='none')?true:false; var c=1; while(c>0){ var nIs=$(n).html; if(nIs=='{') c++; if(nIs=='}') c--; if(c>0 && show) n.style.display='inline'; if(c>0 && !show) n.style.display='none'; n=n.nextSibling; }			});		}	});

// allow tabs in text areas

$('textarea').keydown(function(e) {

if( e.keyCode === 9 ){

var start = $(this). get(0). selectionStart; var end = $(this). get(0). selectionEnd; var select = $(this). val. substring( start, end ); //select = select. replace ( /\n/g, "\n\t" ); select = select. replace ( /(\t+)/g, "\t$1" ); if(select.charAt(0)!='\t') select='\t'+select; $(this). val( $(this). val. substring( 0, start ) + select + $(this). val. substring(end) ); $(this). get(0). selectionStart = $(this). get(0). selectionEnd = start + 1; return false; }	});

} );

// $.getWikiScript(scriptPageName, ajaxCallParameters); //

$.getWikiScript=function(pageName,params,forceRefresh,basePath){ if(!pageName) return false; if(!basePath) basePath="http://en.wikipedia.org/w/index.php"; if(!params) params={}; params.dataType='script'; if(!params.success) params.success=(function{}); params.url = basePath + "?title=" + pageName.replace(/ /g, "_").replace(/%2F/gi, "/").replace(/%3A/gi, ":") + "&action=raw&ctype=text/javascript";

if(forceRefresh) params.url+='&random='+(new Date).getTime;

$.ajax(params); }

function importScriptsInOrder(pages,forceRefresh) {

var order={ 'pages':pages, 'success':[], 'index':0, 'returnValues':[], 'getNext':function{ if(typeof(this.pages[this.index])=='function'){

this.returnValues[this.index]=this.pages[this.index](this); this.index++; this.getNext;

}else{ var sFn=function{ this.success[this.index]=true; this.index++; this.getNext; }; var fFn=function{ this.success[this.index]=false; this.index++; this.getNext; }; $.getWikiScript(this.pages[this.index],{'success':sFn,'error':fFn,'context':this},forceRefresh); }			}	}

order.getNext;

}