User:Granpa/wikia.js

alert('test'); var theBrokenLinksxyz = document.evaluate('//a[contains(@title,"(page does not exist)")]',document.body,null,6,null); alert('theBrokenLinksxyz='+theBrokenLinksxyz); for (i=0;i<theBrokenLinksxyz.snapshotLength;i++){ var theMatch = theBrokenLinksxyz.snapshotItem(i).href.match(/\?title=(.*)&action/)[1]; theBrokenLinksxyz.snapshotItem(i).href = 'http://en.wikipedia.org/wiki/'+theMatch;} alert('done');