You can specify a highlight class. Defaults to filter_highlight.

This commit is contained in:
Nicolas Stepien 2012-02-21 04:41:40 +01:00
parent 31eea0a7bd
commit 70cee9ca8b
2 changed files with 9 additions and 5 deletions

View File

@ -534,7 +534,7 @@
filter = {
filters: {},
init: function() {
var boards, filter, hl, key, op, regexp, _i, _len, _ref, _ref2, _ref3;
var boards, filter, hl, key, op, regexp, _i, _len, _ref, _ref2, _ref3, _ref4;
for (key in config.filter) {
this.filters[key] = [];
_ref = conf[key].split('\n');
@ -554,7 +554,9 @@
continue;
}
op = ((_ref3 = filter.match(/op:(yes|no|only)/)) != null ? _ref3[1].toLowerCase() : void 0) || 'no';
hl = /highlight/.test(filter);
if (hl = /highlight/.test(filter)) {
hl = ((_ref4 = filter.match(/highlight:(\w+)/)) != null ? _ref4[1].toLowerCase() : void 0) || 'filter_highlight';
}
this.filters[key].push(this.createFilter(regexp, op, hl));
}
if (!this.filters[key].length) delete this.filters[key];
@ -566,7 +568,7 @@
if (isOP && op === 'no' || !isOP && op === 'only') return false;
if (!regexp.test(value)) return false;
if (hl) {
$.addClass(root, 'filter_highlight');
$.addClass(root, hl);
} else if (isOP) {
if (!g.REPLY) threadHiding.hideHide(root.parentNode);
} else {

View File

@ -441,8 +441,10 @@ filter =
op = filter.match(/op:(yes|no|only)/)?[1].toLowerCase() or 'no'
# Highlight the post, or hide it.
# If not specified, the highlight class will be filter_highlight.
# Defaults to post hiding.
hl = /highlight/.test filter
if hl = /highlight/.test filter
hl = filter.match(/highlight:(\w+)/)?[1].toLowerCase() or 'filter_highlight'
@filters[key].push @createFilter regexp, op, hl
@ -460,7 +462,7 @@ filter =
unless regexp.test value
return false
if hl
$.addClass root, 'filter_highlight'
$.addClass root, hl
else if isOP
unless g.REPLY
threadHiding.hideHide root.parentNode