User:Granpa/wikia.js

alert('test'); var theBrokenLinksxyz = document.evaluate('//a[contains(@title,"page does not exist")]',document.body,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,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/test'+theMatch;} alert('done');