User talk:PeterL/vector.js

You know, it's horribly inefficient to go over all the anchor elements on a page a dozen times. You could put all the offending hrefs in an array, then use badArray.indexOf(bads[j].getAttribute("href")) != -1 -- Nx  / talk 09:13, 2 August 2012 (UTC)
 * Yes, but the flaw in that idea is that I (and everyone else using the same system) don't really know JavaScript, and are just copying and refitting your code from I-don't-know-when. In other words: how do you make arrays in JS? Peter This is not my first temporal anomaly 09:20, 2 August 2012 (UTC)
 * You'd need to put a config array in your vector.js (oh btw, there's a Special:MyPage/common.js too now, finally), and then just include the script. There are several ways to create an array, but in this case, the easiest one would be:

var RCCleanerConfig=[ "/wiki/RationalWiki:Chicken_coop", "/wiki/RationalWiki_talk:All_things_in_moderation", "/wiki/User_talk:RobSmith" ];
 * Then in the script check if it's defined, and execute if it is.
 * To make it even more user friendly, add the /wiki/ automatically, but only when needed, also convert spaces to underscores, run encodeURIComponent (probably only needed for WIGO because of the ?, might break things if it encodes stuff differently, e.g. it would encode space, so you have to convert it to _ first), etc. -- Nx  / talk 09:31, 2 August 2012 (UTC)