Fix jQuery selector exception from single quotes in stream names

Fixes #1065

(imported from commit 67f74e41f16c01d0d307bd8edf48dd70dde4edf4)
This commit is contained in:
Zev Benjamin 2013-03-08 19:36:52 -05:00
parent 0e1b019f0a
commit c50abd1c76
2 changed files with 10 additions and 2 deletions

View File

@ -345,7 +345,7 @@ exports.activate = function (operators, opts) {
if (operators[0][0] === 'in' && operators[0][1] === 'all') {
$("#global_filters li[data-name='all']").addClass('active-filter');
} else if (operators[0][0] === "stream") {
$("#stream_filters li[data-name='" + encodeURIComponent(operators[0][1]) + "']").addClass('active-filter');
ui.get_filter_li('stream', operators[0][1]).addClass('active-filter');
} else if (operators[0][0] === "is" && operators[0][1] === "private-message") {
$("#global_filters li[data-name='private']").addClass('active-filter');
}

View File

@ -918,7 +918,15 @@ function sort_narrow_list() {
}
exports.get_filter_li = function(type, name) {
return $("#" + type + "_filters li[data-name='" + encodeURIComponent(name) + "']");
var retval = $();
$("#" + type + "_filters li").each(function (idx, elem) {
var jelem = $(elem);
if (jelem.attr('data-name') === name) {
retval = jelem;
return false;
}
});
return retval;
};
exports.add_narrow_filter = function(name, type, uri) {