User:Manishearth/scriptlinks.js: Difference between revisions

Content deleted Content added
m Remove legacy globals per phab:T72470 (via WP:JWB)
maintenance: more info Uncaught ReferenceError: getElementsByClassName is not defined
 
(One intermediate revision by one other user not shown)
Line 10:
importScript('boom.js')
function scriptLinks(className){
pre = getElementsByClassNamedocument.querySelectorAll(document, "*", ".source-javascript");
for(i = 0; i < pre.length; i++) {
par = getElementsByClassName(pre[i], .querySelectorAll("span.", + className);
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')+"\'>$1</a>");
Line 22:
}
}
addOnloadHook$(function(){
 
scriptLinks("co1");
Line 33:
//Taken from [[User:AoV2/importScript_links]]
function importScript_links(){
pre = getElementsByClassNamedocument.querySelectorAll(document, "*", ".source-javascript");
for(i = 0; i < pre.length; i++) {
par = getElementsByClassName(pre[i], .querySelectorAll("span", ".br0");
for(j = 0; j < par.length; j++) {
if(par[j].innerHTML != "(") continue;