diff --git a/themes/bootstrap3/js/advanced_search.js b/themes/bootstrap3/js/advanced_search.js index 04e927a877204da731f8aa0e2ffe6405cb28aec7..bb70132c1546f42554123b47d3e8a16daccc3cc6 100644 --- a/themes/bootstrap3/js/advanced_search.js +++ b/themes/bootstrap3/js/advanced_search.js @@ -33,7 +33,7 @@ function addSearch(group, fieldValues) { // Insert it $("#group" + group + "Holder").before($newSearch); // Individual search ops (for searches like EDS) - if (groupLength[group] == 0) { + if (groupLength[group] === 0) { $newSearch.find('.first-op') .attr('name', 'op' + group + '[]') .removeClass('hidden'); @@ -63,16 +63,16 @@ function deleteSearch(group, sindex) { if (groupLength[group] > 1) { groupLength[group]--; $('#search' + group + '_' + groupLength[group]).remove(); - if (groupLength[group] == 1) { + if (groupLength[group] === 1) { $('#group' + group + ' .search .close').addClass('hidden'); // Hide x } } } function addGroup(firstTerm, firstField, join) { - if (firstTerm == undefined) { firstTerm = ''; } - if (firstField == undefined) { firstField = ''; } - if (join == undefined) { join = ''; } + if (firstTerm === undefined) { firstTerm = ''; } + if (firstField === undefined) { firstField = ''; } + if (join === undefined) { join = ''; } var $newGroup = $($('#new_group_template').html()); $newGroup.attr('id', 'group' + nextGroup); @@ -111,9 +111,9 @@ function deleteGroup(group) { // Find the group and remove it $("#group" + group).remove(); // If the last group was removed, add an empty group - if ($('.group').length == 0) { + if ($('.group').length === 0) { addGroup(); - } else if ($('#advSearchForm .group').length == 1) { + } else if ($('#advSearchForm .group').length === 1) { $('#groupJoin').addClass('hidden'); // Hide join menu $('.group .group-close').addClass('hidden'); // Hide x } diff --git a/themes/bootstrap3/js/autocomplete.js b/themes/bootstrap3/js/autocomplete.js index bb0af948b3c0c6a31de302c1ddf5935b96cef975..2121e1c546a52380746cb27fb9c9f1a0fbc80e7b 100644 --- a/themes/bootstrap3/js/autocomplete.js +++ b/themes/bootstrap3/js/autocomplete.js @@ -119,7 +119,7 @@ } function setup(input) { - if ($('.autocomplete-results').length == 0) { + if ($('.autocomplete-results').length === 0) { element = $('<div/>') .addClass('autocomplete-results hidden') .html('<i class="item loading">' + options.loadingString + '</i>'); diff --git a/themes/bootstrap3/js/cart.js b/themes/bootstrap3/js/cart.js index 26a32202c807b42562c0a742259189b280874db2..e7b9a461851427da200e5b269c98309f1132e9c5 100644 --- a/themes/bootstrap3/js/cart.js +++ b/themes/bootstrap3/js/cart.js @@ -38,7 +38,7 @@ VuFind.register('cart', function Cart() { var items = _getItems(); var sources = _getSources(); var full = []; - if (items.length == 0) { + if (items.length === 0) { return []; } for (var i = items.length; i--;) { @@ -81,11 +81,11 @@ VuFind.register('cart', function Cart() { var cartItem = cartItems[cartIndex]; var saveSource = false; for (var i = cartItems.length; i--;) { - if (i == cartIndex) { + if (i === cartIndex) { continue; } // If this source is shared by another, keep it - if (cartItems[i].charCodeAt(0) - 65 == sourceIndex) { + if (cartItems[i].charCodeAt(0) - 65 === sourceIndex) { saveSource = true; break; } @@ -131,7 +131,7 @@ VuFind.register('cart', function Cart() { var orig = getFullItems(); $(selected).each(function cartCheckedItemsAdd(i) { for (var x in orig) { - if (this == orig[x]) { + if (this === orig[x]) { inCart++; return; } diff --git a/themes/bootstrap3/js/check_item_statuses.js b/themes/bootstrap3/js/check_item_statuses.js index 50ffa14ba87290c6de38a954a01be0746bcfd151..9f191fb40c360f2e4b6c7a464297482ab83bdb34 100644 --- a/themes/bootstrap3/js/check_item_statuses.js +++ b/themes/bootstrap3/js/check_item_statuses.js @@ -7,7 +7,7 @@ function checkItemStatuses(container) { var elements = {}; var data = $.map(container.find('.ajaxItem'), function ajaxItemMap(record) { - if ($(record).find('.hiddenId').length == 0) { + if ($(record).find('.hiddenId').length === 0) { return null; } var datum = $(record).find('.hiddenId').val(); @@ -86,7 +86,7 @@ function checkItemStatuses(container) { // Default case -- load call number and location into appropriate containers: item.find('.callnumber').empty().append(result.callnumber + '<br/>'); item.find('.location').empty().append( - result.reserve == 'true' + result.reserve === 'true' ? result.reserve_message : result.location ); @@ -97,7 +97,7 @@ function checkItemStatuses(container) { }) .fail(function checkItemStatusFail(response, textStatus) { $('.ajax-availability').empty(); - if (textStatus == 'abort' || typeof response.responseJSON === 'undefined') { return; } + if (textStatus === 'abort' || typeof response.responseJSON === 'undefined') { return; } // display the error message on each of the ajax status place holder $('.ajax-availability').append(response.responseJSON.data).addClass('text-danger'); }); diff --git a/themes/bootstrap3/js/check_save_statuses.js b/themes/bootstrap3/js/check_save_statuses.js index 84247f4db1f803eb3be15e9bcc02923c748f95b2..cc31858b36a92db0521e1489acc935ed5a168248 100644 --- a/themes/bootstrap3/js/check_save_statuses.js +++ b/themes/bootstrap3/js/check_save_statuses.js @@ -10,7 +10,7 @@ function checkSaveStatuses(container) { var elements = {}; var data = $.map(container.find('.result,.record'), function checkSaveRecordMap(record) { - if ($(record).find('.hiddenId').length == 0 || $(record).find('.hiddenSource').length == 0) { + if ($(record).find('.hiddenId').length === 0 || $(record).find('.hiddenSource').length === 0) { return null; } var datum = {'id':$(record).find('.hiddenId').val(), 'source':$(record).find('.hiddenSource')[0].value}; diff --git a/themes/bootstrap3/js/combined-search.js b/themes/bootstrap3/js/combined-search.js index 80af508679fef237a2fa6c4056e2cf34ec2d6ea4..dd4c75d9117eb51142b04e646f50ccf42edc8fba 100644 --- a/themes/bootstrap3/js/combined-search.js +++ b/themes/bootstrap3/js/combined-search.js @@ -2,7 +2,7 @@ VuFind.combinedSearch = (function CombinedSearch() { var init = function init(container, url) { container.load(url, '', function containerLoad(responseText) { - if (responseText.length == 0) { + if (responseText.length === 0) { container.hide(); } else { VuFind.openurl.init(container); diff --git a/themes/bootstrap3/js/common.js b/themes/bootstrap3/js/common.js index 78e69bba976e7f83da746257847d1b4933fca82d..5cf978fe5f54a3507b6eb70df096651db7acf8ab 100644 --- a/themes/bootstrap3/js/common.js +++ b/themes/bootstrap3/js/common.js @@ -83,10 +83,10 @@ function deparam(url) { for (var i = 0; i < pairs.length; i++) { var pair = pairs[i].split('='); var name = decodeURIComponent(pair[0].replace(/\+/g, ' ')); - if (name.length == 0) { + if (name.length === 0) { continue; } - if (name.substring(name.length - 2) == '[]') { + if (name.substring(name.length - 2) === '[]') { name = name.substring(0,name.length - 2); if (!request[name]) { request[name] = []; @@ -116,7 +116,7 @@ function phoneNumberFormHandler(numID, regionCode) { var phoneInput = document.getElementById(numID); var number = phoneInput.value; var valid = isPhoneNumberValid(number, regionCode); - if (valid != true) { + if (valid !== true) { if (typeof valid === 'string') { valid = VuFind.translate(valid); } else { @@ -132,13 +132,13 @@ function phoneNumberFormHandler(numID, regionCode) { } function bulkFormHandler(event, data) { - if ($('.checkbox-select-item:checked,checkbox-select-all:checked').length == 0) { + if ($('.checkbox-select-item:checked,checkbox-select-all:checked').length === 0) { VuFind.lightbox.alert(VuFind.translate('bulk_noitems_advice'), 'danger'); return false; } var keys = []; for (var i in data) { - if ('print' == data[i].name) { + if ('print' === data[i].name) { return true; } } @@ -281,7 +281,7 @@ $(document).ready(function commonDocReady() { } var holder = $(this).next('.qrcode'); - if (holder.find('img').length == 0) { + if (holder.find('img').length === 0) { // We need to insert the QRCode image var template = holder.find('.qrCodeImgTag').html(); holder.html(template); @@ -292,7 +292,7 @@ $(document).ready(function commonDocReady() { // Print var url = window.location.href; - if (url.indexOf('?' + 'print' + '=') != -1 || url.indexOf('&' + 'print' + '=') != -1) { + if (url.indexOf('?' + 'print' + '=') !== -1 || url.indexOf('&' + 'print' + '=') !== -1) { $("link[media='print']").attr("media", "all"); $(document).ajaxStop(function triggerPrint() { window.print(); diff --git a/themes/bootstrap3/js/facets.js b/themes/bootstrap3/js/facets.js index e94f9c047ed0baf1ce0b062923008a13860f5c0e..9ca2759bbd35b69923c95170b59d7061f948e3ad 100644 --- a/themes/bootstrap3/js/facets.js +++ b/themes/bootstrap3/js/facets.js @@ -21,7 +21,7 @@ function buildFacetNodes(data, currentPath, allowExclude, excludeTitle, counts) url.replace("'", "\\'"); html += '<span class="main' + (this.isApplied ? ' applied' : '') + '" title="' + htmlEncode(this.displayText) + '"' + ' onclick="document.location.href=\'' + url + '\'; return false;">'; - if (this.operator == 'OR') { + if (this.operator === 'OR') { if (this.isApplied) { html += '<i class="fa fa-check-square-o" title="' + VuFind.translate('Selected') + '"></i>'; } else { @@ -80,7 +80,7 @@ function initFacetTree(treeNode, inSidebar) facetOperator: operator }, function getFacetData(response, textStatus) { - if (response.status == "OK") { + if (response.status === "OK") { var results = buildFacetNodes(response.data, currentPath, allowExclude, excludeTitle, inSidebar); treeNode.find('.fa-spinner').parent().remove(); if (inSidebar) { diff --git a/themes/bootstrap3/js/hierarchyTree.js b/themes/bootstrap3/js/hierarchyTree.js index 9ec0d3232ab9da600cbf57bcde5f31655b51dfa3..7a84efe5dbff5af19c39ea7ecadf07588332918e 100644 --- a/themes/bootstrap3/js/hierarchyTree.js +++ b/themes/bootstrap3/js/hierarchyTree.js @@ -61,7 +61,7 @@ function doTreeSearch() { $('#treeSearchLoadingImg').removeClass('hidden'); var keyword = $("#treeSearchText").val(); var type = $("#treeSearchType").val(); - if (keyword.length == 0) { + if (keyword.length === 0) { $('#hierarchyTree').find('.jstree-search').removeClass('jstree-search'); var tree = $('#hierarchyTree').jstree(true); tree.close_all(); @@ -156,12 +156,12 @@ $(document).ready(function hierarchyTreeReady() { tree.select_node(htmlID); tree._open_to(htmlID); - if (hierarchyContext == "Collection") { + if (hierarchyContext === "Collection") { getRecord(recordID); } $("#hierarchyTree").bind('select_node.jstree', function jsTreeSelect(e, resp) { - if (hierarchyContext == "Record") { + if (hierarchyContext === "Record") { window.location.href = resp.node.a_attr.href; } else { getRecord(resp.node.li_attr.recordid); @@ -221,7 +221,7 @@ $(document).ready(function hierarchyTreeReady() { $('#treeSearch [type=submit]').click(doTreeSearch); $('#treeSearchText').keyup(function treeSearchKeyup(e) { var code = (e.keyCode ? e.keyCode : e.which); - if (code == 13 || $(this).val().length == 0) { + if (code === 13 || $(this).val().length === 0) { doTreeSearch(); } }); diff --git a/themes/bootstrap3/js/hold.js b/themes/bootstrap3/js/hold.js index d300bc43e503f82a8c9476aecba3b4816be19673..ed16e9a35cd2dc3c8109d70a9546ac5d13f08e23 100644 --- a/themes/bootstrap3/js/hold.js +++ b/themes/bootstrap3/js/hold.js @@ -23,7 +23,7 @@ function setUpHoldRequestForm(recordId) { var defaultValue = $('#pickUpLocation').data('default'); $.each(response.data.locations, function holdPickupLocationEach() { var option = $('<option></option>').attr('value', this.locationID).text(this.locationDisplay); - if (this.locationID == defaultValue || (defaultValue == '' && this.isDefault && $emptyOption.length == 0)) { + if (this.locationID === defaultValue || (defaultValue === '' && this.isDefault && $emptyOption.length === 0)) { option.attr('selected', 'selected'); } $('#pickUpLocation').append(option); diff --git a/themes/bootstrap3/js/lightbox.js b/themes/bootstrap3/js/lightbox.js index 0a1f36f0320e168c3ad1db623fdb9d72365fc206..54ab9a0a90d3a78db738223f9c42c18bc2f6ef74 100644 --- a/themes/bootstrap3/js/lightbox.js +++ b/themes/bootstrap3/js/lightbox.js @@ -14,9 +14,9 @@ VuFind.register('lightbox', function Lightbox() { function html(content) { _modalBody.html(content); // Set or update title if we have one - if (_lightboxTitle != '') { + if (_lightboxTitle !== '') { var h2 = _modalBody.find('h2:first-child'); - if (h2.length == 0) { + if (h2.length === 0) { h2 = $('<h2/>').prependTo(_modalBody); } h2.text(_lightboxTitle); @@ -53,7 +53,7 @@ VuFind.register('lightbox', function Lightbox() { } else { var href = parts[0]; // Force reload with a timestamp - href += href.indexOf('?') == -1 ? '?_=' : '&_='; + href += href.indexOf('?') === -1 ? '?_=' : '&_='; href += new Date().getTime() + '#' + parts[1]; window.location.href = href; } @@ -140,7 +140,7 @@ VuFind.register('lightbox', function Lightbox() { _xhr = $.ajax(obj); _xhr.always(function lbAjaxAlways() { _xhr = false; }) .done(function lbAjaxDone(content, status, jq_xhr) { - if (jq_xhr.status == 205) { + if (jq_xhr.status === 205) { _refreshPage(); return; } @@ -154,10 +154,10 @@ VuFind.register('lightbox', function Lightbox() { } } if ( // Close the lightbox after deliberate login - obj.method // is a form - && ((obj.url.match(/MyResearch/) && !obj.url.match(/Bulk/)) // that matches login/create account - || obj.url.match(/catalogLogin/)) // or catalog login for holds - && $('<div/>').html(content).find('.flash-message.alert-danger').length == 0 // skip failed logins + obj.method // is a form + && ((obj.url.match(/MyResearch/) && !obj.url.match(/Bulk/)) // that matches login/create account + || obj.url.match(/catalogLogin/)) // or catalog login for holds + && $('<div/>').html(content).find('.flash-message.alert-danger').length === 0 // skip failed logins ) { var eventResult = _emit('VuFind.lightbox.login', { originalUrl: _originalUrl, diff --git a/themes/bootstrap3/js/openurl.js b/themes/bootstrap3/js/openurl.js index ef35356fa7ae26309579ae7bc0bfa2ca5bd39684..87254276b9fed06770feb103ea49bbae249b7451 100644 --- a/themes/bootstrap3/js/openurl.js +++ b/themes/bootstrap3/js/openurl.js @@ -12,7 +12,7 @@ VuFind.register('openurl', function OpenUrl() { }) .fail(function getResolverLinksFail(response, textStatus) { $target.removeClass('ajax_availability').addClass('text-danger').empty(); - if (textStatus == 'abort' || typeof response.responseJSON === 'undefined') { return; } + if (textStatus === 'abort' || typeof response.responseJSON == 'undefined') { return; } $target.append(response.responseJSON.data); }); } diff --git a/themes/bootstrap3/js/preview.js b/themes/bootstrap3/js/preview.js index c467b250f53ed001a02d6a9fb936b3ea0a8360a4..3fdb6dcd5ce78977cdbdecca7e15565f30ba7faa 100644 --- a/themes/bootstrap3/js/preview.js +++ b/themes/bootstrap3/js/preview.js @@ -24,7 +24,7 @@ function getHTPreviews(skeys) { var batch = []; for (var i = 0; i < bibkeys.length; i++) { batch.push(bibkeys[i]); - if ((i > 0 && i % 20 == 0) || i == bibkeys.length - 1) { + if ((i > 0 && i % 20 === 0) || i === bibkeys.length - 1) { var script = 'https://catalog.hathitrust.org/api/volumes/brief/json/' + batch.join('|') + '&callback=processHTBookInfo'; $.getScript(script); @@ -115,9 +115,9 @@ function setIndexOf() { var n = 0; if (arguments.length > 1) { n = Number(arguments[1]); - if (n != n) { // shortcut for verifying if it's NaN + if (n !== n) { // shortcut for verifying if it's NaN n = 0; - } else if (n != 0 && n != Infinity && n != -Infinity) { + } else if (n !== 0 && n !== Infinity && n !== -Infinity) { n = (n > 0 || -1) * Math.floor(Math.abs(n)); } } @@ -162,7 +162,7 @@ function getBookPreviews() { keyString += bibkeys[i] + ','; // send request when there are 100 requests ready or when there are no // more elements to be sent - if ((i > 0 && i % 100 == 0) || i == bibkeys.length - 1) { + if ((i > 0 && i % 100 === 0) || i === bibkeys.length - 1) { script = 'https://encrypted.google.com/books?jscmd=viewapi&bibkeys=' + keyString + '&callback=processGBSBookInfo'; $.getScript(script); diff --git a/themes/bootstrap3/js/pubdate_vis.js b/themes/bootstrap3/js/pubdate_vis.js index bb150253d1b47b52d47ccba19eeb5055436e178e..c35abc09614a95d2f4e3d77f748d69a868e53317 100644 --- a/themes/bootstrap3/js/pubdate_vis.js +++ b/themes/bootstrap3/js/pubdate_vis.js @@ -56,7 +56,7 @@ function loadVis(facetFields, searchParams, baseURL, zooming) { $.getJSON(url, function getVisDataJSON(data) { $.each(data['data'], function getVisDataEach(key, val) { //check if there is data to display, if there isn't hide the box - if (val['data'] == undefined || val['data'].length == 0) { + if (val['data'] === undefined || val['data'].length === 0) { return; } $("#datevis" + key + "xWrapper").removeClass('hidden'); @@ -68,25 +68,25 @@ function loadVis(facetFields, searchParams, baseURL, zooming) { var hasFilter = true; //set the has filter - if (val['min'] == 0 && val['max'] == 0) { + if (val['min'] === 0 && val['max'] === 0) { hasFilter = false; } //check if the min and max value have been set otherwise set them to the ends of the graph - if (val['min'] == 0) { + if (val['min'] === 0) { val['min'] = val['data'][0][0] - 5; } - if (val['max'] == 0) { + if (val['max'] === 0) { val['max'] = parseInt(val['data'][val['data'].length - 1][0], 10) + 5; } if (zooming) { //check the first and last elements of the data array against min and max value (+padding) //if the element exists leave it, otherwise create a new marker with a minus one value - if (val['data'][val['data'].length - 1][0] != parseInt(val['max'], 10) + 5) { + if (val['data'][val['data'].length - 1][0] !== parseInt(val['max'], 10) + 5) { val['data'].push([parseInt(val['max'], 10) + 5, -1]); } - if (val['data'][0][0] != val['min'] - 5) { + if (val['data'][0][0] !== val['min'] - 5) { val['data'].push([val['min'] - 5, -1]); } //check for values outside the selected range and remove them by setting them to null diff --git a/themes/bootstrap3/js/record.js b/themes/bootstrap3/js/record.js index e1c187ae38a4c6c279c097cb7e428b2c2fa219a1..39ef2fda63907d93bd9cef21a3218fb6eb2d0237 100644 --- a/themes/bootstrap3/js/record.js +++ b/themes/bootstrap3/js/record.js @@ -96,7 +96,7 @@ function registerAjaxCommentRecord() { $(form).find('input[type="submit"]').button('loading'); }) .fail(function addCommentFail(response, textStatus) { - if (textStatus == 'abort' || typeof response.responseJSON === 'undefined') { return; } + if (textStatus === 'abort' || typeof response.responseJSON === 'undefined') { return; } VuFind.lightbox.update(response.responseJSON.data); }); return false; @@ -219,9 +219,9 @@ function applyRecordTabHash() { ? window.location.hash.toLowerCase() : ''; // Open tag in url hash - if (newTab.length == 0 || newTab == '#tabnav') { + if (newTab.length === 0 || newTab === '#tabnav') { $initiallyActiveTab.click(); - } else if (newTab.length > 0 && '#' + activeTab != newTab) { + } else if (newTab.length > 0 && '#' + activeTab !== newTab) { $('.' + newTab.substr(1)).click(); } }