From daa658ace7c85d1ce9b8a4e9f94fbc60ce6cc3b3 Mon Sep 17 00:00:00 2001 From: Chris Hallberg <crhallberg@gmail.com> Date: Wed, 26 Sep 2018 16:11:48 -0400 Subject: [PATCH] Fix jshint errors --- themes/bootstrap3/js/channels.js | 6 ++++-- themes/bootstrap3/js/lib/autocomplete.js | 12 +++++------- themes/bootstrap3/js/preview.js | 4 +--- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/themes/bootstrap3/js/channels.js b/themes/bootstrap3/js/channels.js index c67f839d4b6..ef04974f6dd 100644 --- a/themes/bootstrap3/js/channels.js +++ b/themes/bootstrap3/js/channels.js @@ -127,6 +127,8 @@ VuFind.register('channels', function Channels() { .prependTo($(op).parent(".channel-wrapper")); } + var bindChannelAddMenu; // circular dependency fix for jshint + function selectAddedChannel(e) { $.ajax(e.target.href).done(function addChannelAjaxDone(data) { var list = $(e.target).closest('.dropdown-menu'); @@ -160,7 +162,7 @@ VuFind.register('channels', function Channels() { return false; } - function bindChannelAddMenu(iteration, channel) { + bindChannelAddMenu = function bindChannelAddMenuFunc(iteration, channel) { var scope = $(channel).parent(".channel-wrapper"); $(scope).find('.channel-add-menu .dropdown-menu a').click(selectAddedChannel); $(scope).find('.channel-add-menu .add-btn').click(function addChannels(e) { @@ -169,7 +171,7 @@ VuFind.register('channels', function Channels() { links[i].click(); } }); - } + }; function init () { $('.channel').each(setupChannelSlider); diff --git a/themes/bootstrap3/js/lib/autocomplete.js b/themes/bootstrap3/js/lib/autocomplete.js index cb6e6ee04e1..29665dbf85e 100644 --- a/themes/bootstrap3/js/lib/autocomplete.js +++ b/themes/bootstrap3/js/lib/autocomplete.js @@ -134,16 +134,16 @@ } }; var _defaultStaticSort = function _defaultStaticSort(a, b) { - // .bind(lcterm) return a.match.indexOf(this) - b.match.indexOf(this); }; var _staticGroups = function _staticGroups(lcterm) { var matches = []; + function isTermMatch(_item) { + return _item.match.match(lcterm); + } for (var i = 0; i < options.static.groups.length; i++) { if (typeof options.static.groups[i].label !== 'undefined') { - var mitems = options.static.groups[i].items.filter(function staticLabelledGroupFilter(_item) { - return _item.match.match(lcterm); - }); + var mitems = options.static.groups[i].items.filter(isTermMatch); if (mitems.length > 0) { if (typeof options.staticSort === 'function') { mitems.sort(options.staticSort); @@ -156,9 +156,7 @@ }); } } else { - var ms = options.static.groups[i].filter(function staticGroupFilter(_item) { - return _item.match.match(lcterm); - }); + var ms = options.static.groups[i].filter(isTermMatch); if (ms.length > 0) { if (typeof options.staticSort === 'function') { ms.sort(options.staticSort); diff --git a/themes/bootstrap3/js/preview.js b/themes/bootstrap3/js/preview.js index 677118850de..86bac3c7d87 100644 --- a/themes/bootstrap3/js/preview.js +++ b/themes/bootstrap3/js/preview.js @@ -112,9 +112,7 @@ function setIndexOf() { throw new TypeError(); } var t = Object(this); - /*jslint bitwise: false*/ - var len = t.length >>> 0; - /*jslint bitwise: true*/ + var len = t.length; if (len === 0) { return -1; } -- GitLab