User:Manishearth/scriptlinks.js: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 14:
par = getElementsByClassName(pre[i], "span", className);
for(j = 0; j < par.length; j++) {
//par[j].innerHTML=par[j].innerHTML.replace(/\[\[([^\]\|]*)\]\]/g,"<a href='"+wgServer+"/wiki/$1'>$1</a>");
//par[j].innerHTML=par[j].innerHTML.replace(/\[\[([^\]\|]*)[\|]?([^\]]*)\]\]/g,"<a href='"+wgServer+"/wiki/$1'>$2</a>");
//par[j].innerHTML=par[j].innerHTML.replace(/\[(http[s]?:\/\/[^\]\s]*)\]/g,"<a href='$1'>$1</a>");
//par[j].innerHTML=par[j].innerHTML.replace(/\[(http[s]?:\/\[^\]\s]*)[\s]?([^\]]*)\]/g,"<a href='$1'>$2</a>");
//par[j].innerHTML=par[j].innerHTML.replace(/[^\"\>][\s]?+(http[s]?:\/\/[^\s]*)/g,"<a href='$1'>$1</a>");
}
Line 42:
var h= s.innerHTML + "";
var q;
var quo;
if(s.className != "st0") continue;
else if(h.match(/"([^"]+)"/)) {
q = /"([^"]+)"/g;
quo='"'
}else if(h.match(/'([^']+)'/)) {
q = /'([^']+)'/g;
quo="'"
}else continue;
p = encodeURIComponent(h.replace(q, "$1").replace(/[_\s]+/g, "_")).replace(/%2F/g, "/");
s.innerHTML = qquo + '<a href="' + wgArticlePath.replace("$1", p) + '">' + h.replace(q, "$1") + '</a>' + qquo;
}
}