Content deleted Content added
Manishearth (talk | contribs) No edit summary |
maintenance: more info Uncaught ReferenceError: getElementsByClassName is not defined |
||
(34 intermediate revisions by 3 users not shown) | |||
Line 1:
//Test stuff:
// [[User:Manishearth]] [[User:Manishearth|boom]]
// [http://en.wikipedia.org] [http://www.boom.com boom]
// http://www.wikia.com/blooper/testlink
/* [[Boomdeyada]] */
Line 10:
importScript('boom.js')
function scriptLinks(className){
pre =
for(i = 0; i < pre.length; i++) {
par =
for(j = 0; j < par.length; j++) {
par[j].innerHTML=par[j].innerHTML.replace(/\[\[([^\]\|]*)\]\]/g,"<a href='"+mw.config.get('wgServer')+mw.config.get('wgArticlePath')+"
par[j].innerHTML=par[j].innerHTML.replace(/\[\[([^\]\|]*)[\|]?([^\]]*)\]\]/g,"<a href='"+mw.config.get('wgServer')+mw.config.get('wgArticlePath')+"
par[j].innerHTML=par[j].innerHTML.replace(/\[(http[s]?:
par[j].innerHTML=par[j].innerHTML.replace(/\[(http[s]?:
}
}
}
scriptLinks("co1");
scriptLinks("co2");
scriptLinks("coMULTI");
importScript_links();
});
//Taken from [[User:AoV2/importScript_links]]
function importScript_links(){
pre =
for(i = 0; i < pre.length; i++) {
par =
for(j = 0; j < par.length; j++) {
if(par[j].innerHTML != "(") continue;
Line 43 ⟶ 45:
var h2=h+"";
var h3=h2+""
var h4=h3+"";▼
var q;
var quo;
Line 48 ⟶ 51:
else if(h.match(/"([^\"']+)\"/)) {
q = /\"([^\"']*)\"/g;
quo='\"'
p = encodeURIComponent(h3.replace(q, "$1").replace(/[_\s]+/g, "_")).replace(/%2F/g, "/");▼
s.innerHTML = quo + '<a href=\"' + mw.config.get('wgArticlePath').replace("$1", p) + '\">' + h4.replace(q, "$1") + '</a>' + quo;▼
}else if(h2.match(/'([^'\"]+)\'/)) {
q = /'([^'\"]*)'/g;
quo="\'"
p = encodeURIComponent(h3.replace(q, "$1").replace(/[_\s]+/g, "_")).replace(/%2F/g, "/");
}else continue;▼
s.innerHTML = quo + '<a href=\"' + mw.config.get('wgArticlePath').replace("$1", p) + '\">' + h4.replace(q, "$1") + '</a>' + quo;
▲ var h4=h3+"";
▲ }else{ continue;}
▲ p = encodeURIComponent(h3.replace(q, "$1").replace(/[_\s]+/g, "_")).replace(/%2F/g, "/");
▲ s.innerHTML = quo + '<a href="' + wgArticlePath.replace("$1", p) + '">' + h4.replace(q, "$1") + '</a>' + quo;
}
}
}
|