User:AndyZ/monobook.js/personalredirect.js: Difference between revisions

Content deleted Content added
forgot }
m not thinking straight
 
(2 intermediate revisions by the same user not shown)
Line 1:
//<pre>
if(document.___location.href.substring(0,51)=="http://en.wikipedia.org/wiki/Special:Search?search="){
var p_redirects = new Array(
thePage = document.___location.href.substring(51,document.___location.href.length)
["WHAT YOU TYPE IN", "WHERE YOU WANT TO GO"], //update this
wikiURL = "http://en.wikipedia.org/wiki/"
["WHAT YOU TYPE IN", "WHERE YOU WANT TO GO"], //array
/*
["WHAT YOU TYPE IN", "WHERE YOU WANT TO GO"],
Usage for personal redirects:
["WHAT YOU TYPE IN", "WHERE YOU WANT TO GO"]
 
);
Add the contents of this page. For every personal redirect you wish to add, add the following onto your monobook.js file:
 
if(thePage=="THE REDIRECT"){
document.___location.href = wikiURL+"THE PAGE YOU WISH TO REACH"
}
 
where THE REDIRECT is the redirect (note: colons should be replaced with %3A), and THE PAGE YOU WISH TO REACH is the title of the page you wish to reach. Please do not forget the quotes, otherwise it won't work.
 
For example,
 
if(thePage=="U%3AAZ"){
document.___location.href = wikiURL+"User:AndyZ"
}
*/
 
if(wgPageName == "Special:Search"){
for(i = 0; i < p_redirects.length; i++){
if(document.getElementById("contentSub").getElementsByTagName("a")[0].innerHTML == p_redirects[i][0])
if( document.___location.href.substring(0,51)= = "http://en.wikipedia.org/wiki/Special:Search?search="){ + p_redirects[i][1];
}
}
//</pre>