diff --git a/4chan_x.user.js b/4chan_x.user.js index 2238bd7e9..44e06430b 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -528,15 +528,16 @@ regexps: {}, callbacks: [], init: function() { - var filter, key, m, _i, _len; + var f, filter, key, m, _i, _len; for (key in config.filter) { - if (!(m = conf[key].match(/^(\/.+\/\w{0,})$/gm))) { + if (!(m = conf[key].match(/^\/.+\/\w{0,}$/gm))) { continue; } this.regexps[key] = []; for (_i = 0, _len = m.length; _i < _len; _i++) { filter = m[_i]; - this.regexps[key].push(Function("return " + filter)()); + f = filter.match(/^\/(.+)\/(\w{0,})$/); + this.regexps[key].push(RegExp(f[1], f[2])); } if (this.regexps[key].length) { this.callbacks.push(this[key]); diff --git a/script.coffee b/script.coffee index 6ec3bde6e..7f13f3d2b 100644 --- a/script.coffee +++ b/script.coffee @@ -386,11 +386,12 @@ filter = callbacks: [] init: -> for key of config.filter - unless m = conf[key].match /^(\/.+\/\w{0,})$/gm + unless m = conf[key].match /^\/.+\/\w{0,}$/gm continue @regexps[key] = [] for filter in m - @regexps[key].push Function("return #{filter}")() + f = filter.match /^\/(.+)\/(\w{0,})$/ + @regexps[key].push RegExp f[1], f[2] #only execute what's filterable @callbacks.push @[key] if @regexps[key].length