Yet another filter improvements, use superior array manipulations.
This commit is contained in:
parent
99d5f8b1a9
commit
5fe0d4db22
@ -539,45 +539,29 @@
|
|||||||
f = filter.match(/^\/(.+)\/(\w*)$/);
|
f = filter.match(/^\/(.+)\/(\w*)$/);
|
||||||
this.regexps[key].push(RegExp(f[1], f[2]));
|
this.regexps[key].push(RegExp(f[1], f[2]));
|
||||||
}
|
}
|
||||||
if (this.regexps[key].length) {
|
this.callbacks.push(this[key]);
|
||||||
this.callbacks.push(this[key]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return g.callbacks.push(this.node);
|
return g.callbacks.push(this.node);
|
||||||
},
|
},
|
||||||
node: function(root) {
|
node: function(root) {
|
||||||
var callback, _i, _j, _len, _len2, _ref, _ref2;
|
if (!root.className) {
|
||||||
if (root.className === 'op') {
|
if (filter.callbacks.some(function(callback) {
|
||||||
if (!g.REPLY && conf['Filter OPs']) {
|
return callback(root);
|
||||||
_ref = filter.callbacks;
|
})) {
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
return replyHiding.hideHide($('td:not([nowrap])', root));
|
||||||
callback = _ref[_i];
|
|
||||||
if (callback(root)) {
|
|
||||||
threadHiding.hideHide(root.parentNode);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (!root.classList.contains('inline')) {
|
} else if (root.className === 'op' && !g.REPLY && conf['Filter OPs']) {
|
||||||
_ref2 = filter.callbacks;
|
if (filter.callbacks.some(function(callback) {
|
||||||
for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) {
|
return callback(root);
|
||||||
callback = _ref2[_j];
|
})) {
|
||||||
if (callback(root)) {
|
return threadHiding.hideHide(root.parentNode);
|
||||||
replyHiding.hideHide($('td:not([nowrap])', root));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
test: function(key, value) {
|
test: function(key, value) {
|
||||||
var regexp, _i, _len, _ref;
|
return filter.regexps[key].some(function(regexp) {
|
||||||
_ref = filter.regexps[key];
|
return regexp.test(value);
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
});
|
||||||
regexp = _ref[_i];
|
|
||||||
if (regexp.test(value)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
name: function(root) {
|
name: function(root) {
|
||||||
var name;
|
var name;
|
||||||
|
|||||||
@ -393,25 +393,20 @@ filter =
|
|||||||
f = filter.match /^\/(.+)\/(\w*)$/
|
f = filter.match /^\/(.+)\/(\w*)$/
|
||||||
@regexps[key].push RegExp f[1], f[2]
|
@regexps[key].push RegExp f[1], f[2]
|
||||||
#only execute what's filterable
|
#only execute what's filterable
|
||||||
@callbacks.push @[key] if @regexps[key].length
|
@callbacks.push @[key]
|
||||||
|
|
||||||
g.callbacks.push @node
|
g.callbacks.push @node
|
||||||
|
|
||||||
node: (root) ->
|
node: (root) ->
|
||||||
if root.className is 'op'
|
unless root.className
|
||||||
if !g.REPLY and conf['Filter OPs']
|
if filter.callbacks.some((callback) -> callback root)
|
||||||
for callback in filter.callbacks
|
replyHiding.hideHide $ 'td:not([nowrap])', root
|
||||||
if callback root
|
else if root.className is 'op' and not g.REPLY and conf['Filter OPs']
|
||||||
threadHiding.hideHide root.parentNode
|
if filter.callbacks.some((callback) -> callback root)
|
||||||
return
|
threadHiding.hideHide root.parentNode
|
||||||
else unless root.classList.contains 'inline'
|
|
||||||
for callback in filter.callbacks
|
|
||||||
if callback root
|
|
||||||
replyHiding.hideHide $ 'td:not([nowrap])', root
|
|
||||||
return
|
|
||||||
test: (key, value) ->
|
test: (key, value) ->
|
||||||
for regexp in filter.regexps[key]
|
filter.regexps[key].some (regexp) -> regexp.test value
|
||||||
return true if regexp.test value
|
|
||||||
|
|
||||||
name: (root) ->
|
name: (root) ->
|
||||||
name = if root.className is 'op' then $ '.postername', root else $ '.commentpostername', root
|
name = if root.className is 'op' then $ '.postername', root else $ '.commentpostername', root
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user