From 3411c4e5a7efbda342171da65b4b133e87550114 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 5 Nov 2014 07:15:29 -0800 Subject: [PATCH] UI fixes Fixed: Series search won't break when term contains brackets Fixed: Attempting to apply the activity spinner incorrectly --- src/UI/Navbar/Search.js | 5 +---- src/UI/jQuery/jquery.spin.js | 4 ++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/UI/Navbar/Search.js b/src/UI/Navbar/Search.js index ea8b04d7e..4aa7e6657 100644 --- a/src/UI/Navbar/Search.js +++ b/src/UI/Navbar/Search.js @@ -34,11 +34,8 @@ define( var substringMatcher = function() { return function findMatches(q, cb) { - // regex used to determine if a string contains the substring `q` - var substrRegex = new RegExp(q, 'i'); - var matches = _.select(SeriesCollection.toJSON(), function (series) { - return substrRegex.test(series.title); + return series.title.toLowerCase().indexOf(q.toLowerCase()) > -1; }); cb(matches); diff --git a/src/UI/jQuery/jquery.spin.js b/src/UI/jQuery/jquery.spin.js index 082f4c9eb..edae78deb 100644 --- a/src/UI/jQuery/jquery.spin.js +++ b/src/UI/jQuery/jquery.spin.js @@ -21,6 +21,10 @@ define( var icon = this.find('i').andSelf('i'); + if (!icon || !icon.attr('class')) { + return this; + } + var iconClasses = icon.attr('class').match(/(?:^|\s)icon\-.+?(?:$|\s)/); if (iconClasses.length === 0) {