From 09eb62b853ab5148202dc26ea08f08bceda1a459 Mon Sep 17 00:00:00 2001
From: Chris Hallberg <crhallberg@gmail.com>
Date: Wed, 1 Jun 2016 15:38:36 -0400
Subject: [PATCH] no-unused-vars

---
 themes/bootstrap3/js/advanced_search.js |  1 +
 themes/bootstrap3/js/cart.js            |  4 ++--
 themes/bootstrap3/js/common.js          |  4 ++--
 themes/bootstrap3/js/embedded_record.js |  2 +-
 themes/bootstrap3/js/facets.js          |  6 +++---
 themes/bootstrap3/js/hierarchyTree.js   | 14 ++++++--------
 themes/bootstrap3/js/hold.js            |  3 ++-
 themes/bootstrap3/js/ill.js             |  3 ++-
 themes/bootstrap3/js/lightbox.js        | 12 ++++++------
 themes/bootstrap3/js/openurl.js         |  2 +-
 themes/bootstrap3/js/preview.js         |  2 ++
 themes/bootstrap3/js/pubdate_vis.js     |  1 +
 themes/bootstrap3/js/record.js          | 15 ++++++++-------
 13 files changed, 37 insertions(+), 32 deletions(-)

diff --git a/themes/bootstrap3/js/advanced_search.js b/themes/bootstrap3/js/advanced_search.js
index ea908c8de86..deab40e80f3 100644
--- a/themes/bootstrap3/js/advanced_search.js
+++ b/themes/bootstrap3/js/advanced_search.js
@@ -1,3 +1,4 @@
+/* exported addGroup, addSearch, deleteGroup, deleteSearch */
 var nextGroup = 0;
 var groupLength = [];
 
diff --git a/themes/bootstrap3/js/cart.js b/themes/bootstrap3/js/cart.js
index 2d610aef92e..d55527f58f1 100644
--- a/themes/bootstrap3/js/cart.js
+++ b/themes/bootstrap3/js/cart.js
@@ -1,4 +1,5 @@
 /*global Cookies, VuFind */
+/* exported cartFormHandler */
 
 VuFind.register('cart', function Cart() {
   var _COOKIE = 'vufind_cart';
@@ -76,7 +77,6 @@ VuFind.register('cart', function Cart() {
     var cartIndex = cartItems.indexOf(String.fromCharCode(65 + cartSources.indexOf(source)) + id);
     if (cartIndex > -1) {
       var sourceIndex = cartItems[cartIndex].charCodeAt(0) - 65;
-      var cartItem = cartItems[cartIndex];
       var saveSource = false;
       for (var i = cartItems.length; i--;) {
         if (i === cartIndex) {
@@ -127,7 +127,7 @@ VuFind.register('cart', function Cart() {
           var inCart = 0;
           var msg = "";
           var orig = getFullItems();
-          $(selected).each(function cartCheckedItemsAdd(i) {
+          $(selected).each(function cartCheckedItemsAdd() {
             for (var x in orig) {
               if (this === orig[x]) {
                 inCart++;
diff --git a/themes/bootstrap3/js/common.js b/themes/bootstrap3/js/common.js
index bd4bcd7eda9..d92f31228e4 100644
--- a/themes/bootstrap3/js/common.js
+++ b/themes/bootstrap3/js/common.js
@@ -1,4 +1,5 @@
-/*global btoa, console, hexEncode, isPhoneNumberValid, Lightbox, rc4Encrypt, unescape */
+/*global isPhoneNumberValid, unescape */
+/* exported VuFind, htmlEncode, deparam, moreFacets, lessFacets, phoneNumberFormHandler, bulkFormHandler */
 
 // IE 9< console polyfill
 window.console = window.console || {log: function polyfillLog() {}};
@@ -136,7 +137,6 @@ function bulkFormHandler(event, data) {
     VuFind.lightbox.alert(VuFind.translate('bulk_noitems_advice'), 'danger');
     return false;
   }
-  var keys = [];
   for (var i in data) {
     if ('print' === data[i].name) {
       return true;
diff --git a/themes/bootstrap3/js/embedded_record.js b/themes/bootstrap3/js/embedded_record.js
index b11ed7642e5..20633b0dbfd 100644
--- a/themes/bootstrap3/js/embedded_record.js
+++ b/themes/bootstrap3/js/embedded_record.js
@@ -1,4 +1,4 @@
-/* global checkSaveStatuses, sessionStorage, registerAjaxCommentRecord, registerTabEvents, setupRecordToolbar, syn_get_widget, VuFind */
+/* global checkSaveStatuses, sessionStorage, registerAjaxCommentRecord, registerTabEvents, syn_get_widget, VuFind */
 VuFind.register('embedded', function embedded() {
   var _STORAGEKEY = 'vufind_search_open';
   var _SEPERATOR = ':::';
diff --git a/themes/bootstrap3/js/facets.js b/themes/bootstrap3/js/facets.js
index 9ca2759bbd3..a19d6d4acea 100644
--- a/themes/bootstrap3/js/facets.js
+++ b/themes/bootstrap3/js/facets.js
@@ -1,4 +1,5 @@
 /*global htmlEncode, VuFind */
+/* exported initFacetTree */
 function buildFacetNodes(data, currentPath, allowExclude, excludeTitle, counts)
 {
   var json = [];
@@ -79,12 +80,12 @@ function initFacetTree(treeNode, inSidebar)
       facetSort: sort,
       facetOperator: operator
     },
-    function getFacetData(response, textStatus) {
+    function getFacetData(response/*, textStatus*/) {
       if (response.status === "OK") {
         var results = buildFacetNodes(response.data, currentPath, allowExclude, excludeTitle, inSidebar);
         treeNode.find('.fa-spinner').parent().remove();
         if (inSidebar) {
-          treeNode.on('loaded.jstree open_node.jstree', function treeNodeOpen(e, data) {
+          treeNode.on('loaded.jstree open_node.jstree', function treeNodeOpen(/*e, data*/) {
             treeNode.find('ul.jstree-container-ul > li.jstree-node').addClass('list-group-item');
           });
         }
@@ -104,7 +105,6 @@ VuFind.register('lightbox_facets', function LightboxFacets() {
 
   function lightboxFacetSorting() {
     var sortButtons = $('.js-facet-sort');
-    var lastsort, lastlimit;
     function sortAjax(sort) {
       var list = $('#facet-list-' + sort);
       if (list.find('.js-facet-item').length === 0) {
diff --git a/themes/bootstrap3/js/hierarchyTree.js b/themes/bootstrap3/js/hierarchyTree.js
index 7a84efe5dbf..62a8e482575 100644
--- a/themes/bootstrap3/js/hierarchyTree.js
+++ b/themes/bootstrap3/js/hierarchyTree.js
@@ -1,13 +1,12 @@
-/*global hierarchySettings, VuFind */
+/*global VuFind */
 
 var hierarchyID, recordID, htmlID, hierarchyContext;
-var baseTreeSearchFullURL;
 
 /* Utility functions */
 function htmlEncodeId(id) {
   return id.replace(/\W/g, "-"); // Also change Hierarchy/TreeRenderer/JSTree.php
 }
-function html_entity_decode(string, quote_style) {
+function html_entity_decode(string) {
   var hash_map = {
     '&': '&amp;',
     '>': '&gt;',
@@ -60,7 +59,6 @@ var searchAjax = false;
 function doTreeSearch() {
   $('#treeSearchLoadingImg').removeClass('hidden');
   var keyword = $("#treeSearchText").val();
-  var type = $("#treeSearchType").val();
   if (keyword.length === 0) {
     $('#hierarchyTree').find('.jstree-search').removeClass('jstree-search');
     var tree = $('#hierarchyTree').jstree(true);
@@ -150,7 +148,7 @@ $(document).ready(function hierarchyTreeReady() {
   $("#hierarchyLoading").removeClass('hide');
 
   $("#hierarchyTree")
-    .bind("ready.jstree", function jsTreeReady(event, data) {
+    .bind("ready.jstree", function jsTreeReady(/*event, data*/) {
       $("#hierarchyLoading").addClass('hide');
       var tree = $("#hierarchyTree").jstree(true);
       tree.select_node(htmlID);
@@ -194,13 +192,13 @@ $(document).ready(function hierarchyTreeReady() {
               'id': recordID
             },
             'statusCode': {
-              200: function jsTree200Status(json, status, request) {
+              200: function jsTree200Status(json /*, status, request*/) {
                 cb.call(this, json);
               },
-              204: function jsTree204Status(json, status, request) { // No Content
+              204: function jsTree204Status(/*json, status, request*/) { // No Content
                 buildTreeWithXml(cb);
               },
-              503: function jsTree503Status(json, status, request) { // Service Unavailable
+              503: function jsTree503Status(/*json, status, request*/) { // Service Unavailable
                 buildTreeWithXml(cb);
               }
             }
diff --git a/themes/bootstrap3/js/hold.js b/themes/bootstrap3/js/hold.js
index ed16e9a35cd..904ed12b843 100644
--- a/themes/bootstrap3/js/hold.js
+++ b/themes/bootstrap3/js/hold.js
@@ -1,4 +1,5 @@
 /*global VuFind */
+/* exported setUpHoldRequestForm */
 function setUpHoldRequestForm(recordId) {
   $('#requestGroupId').change(function requestGroupChange() {
     var $emptyOption = $("#pickUpLocation option[value='']");
@@ -32,7 +33,7 @@ function setUpHoldRequestForm(recordId) {
       $('#pickUpLocationLabel i').removeClass("fa fa-spinner icon-spin");
       $('#pickUpLocation').removeAttr('disabled');
     })
-    .fail(function holdPickupLocationsFail(response) {
+    .fail(function holdPickupLocationsFail(/*response*/) {
       $('#pickUpLocationLabel i').removeClass("fa fa-spinner icon-spin");
       $('#pickUpLocation').removeAttr('disabled');
     });
diff --git a/themes/bootstrap3/js/ill.js b/themes/bootstrap3/js/ill.js
index 76de720b4f7..2c8af1381da 100644
--- a/themes/bootstrap3/js/ill.js
+++ b/themes/bootstrap3/js/ill.js
@@ -1,4 +1,5 @@
 /*global VuFind */
+/* exported setUpILLRequestForm */
 function setUpILLRequestForm(recordId) {
   $("#ILLRequestForm #pickupLibrary").change(function illPickupChange() {
     $("#ILLRequestForm #pickupLibraryLocation option").remove();
@@ -23,7 +24,7 @@ function setUpILLRequestForm(recordId) {
       });
       $("#ILLRequestForm #pickupLibraryLocationLabel i").removeClass("fa fa-spinner icon-spin");
     })
-    .fail(function illPickupLocationsFail(response) {
+    .fail(function illPickupLocationsFail(/*response*/) {
       $("#ILLRequestForm #pickupLibraryLocationLabel i").removeClass("fa fa-spinner icon-spin");
     });
   });
diff --git a/themes/bootstrap3/js/lightbox.js b/themes/bootstrap3/js/lightbox.js
index 5d00ec2075b..579d3dcbecf 100644
--- a/themes/bootstrap3/js/lightbox.js
+++ b/themes/bootstrap3/js/lightbox.js
@@ -8,10 +8,10 @@ VuFind.register('lightbox', function Lightbox() {
   // Elements
   var _modal, _modalBody, _clickedButton = null;
   // Utilities
-  function storeClickedStatus() {
+  function _storeClickedStatus() {
     _clickedButton = this;
   }
-  function html(content) {
+  function _html(content) {
     _modalBody.html(content);
     // Set or update title if we have one
     if (_lightboxTitle !== '') {
@@ -44,7 +44,7 @@ VuFind.register('lightbox', function Lightbox() {
   /**
    * Reload the page without causing trouble with POST parameters while keeping hash
    */
-  function refreshPage() {
+  function _refreshPage() {
     var parts = window.location.href.split('#');
     if (typeof parts[1] === 'undefined') {
       window.location.href = window.location.href;
@@ -184,7 +184,7 @@ VuFind.register('lightbox', function Lightbox() {
   /**
    * Evaluate a callback
    */
-  function evalCallback(callback, event, data) {
+  function _evalCallback(callback, event, data) {
     if ('function' === typeof window[callback]) {
       return window[callback](event, data);
     } else {
@@ -200,7 +200,7 @@ VuFind.register('lightbox', function Lightbox() {
    * data-lightbox-post = post data
    * data-lightbox-title = Lightbox title (overrides any title the page provides)
    */
-  function constrainLink(event) {
+  function _constrainLink(event) {
     if (typeof $(this).data('lightboxIgnore') != 'undefined' || this.attributes.href.value.charAt(0) === '#') {
       return true;
     }
@@ -232,7 +232,7 @@ VuFind.register('lightbox', function Lightbox() {
    *
    * data-lightbox-ignore = do not handle clicking this button in lightbox
    */
-  function formSubmit(event) {
+  function _formSubmit(event) {
     // Gather data
     var form = event.target;
     var data = $(form).serializeArray();
diff --git a/themes/bootstrap3/js/openurl.js b/themes/bootstrap3/js/openurl.js
index b3a0e726b2e..e5c674a56a8 100644
--- a/themes/bootstrap3/js/openurl.js
+++ b/themes/bootstrap3/js/openurl.js
@@ -1,6 +1,6 @@
 /*global extractClassParams, VuFind */
 VuFind.register('openurl', function OpenUrl() {
-  function loadResolverLinks($target, openUrl, searchClassId) {
+  function _loadResolverLinks($target, openUrl, searchClassId) {
     $target.addClass('ajax_availability');
     var url = VuFind.path + '/AJAX/JSON?' + $.param({method:'getResolverLinks',openurl:openUrl,searchClassId:searchClassId});
     $.ajax({
diff --git a/themes/bootstrap3/js/preview.js b/themes/bootstrap3/js/preview.js
index 76e423ee25f..37ef7f531b1 100644
--- a/themes/bootstrap3/js/preview.js
+++ b/themes/bootstrap3/js/preview.js
@@ -1,3 +1,5 @@
+/* exported processGBSBookInfo, processOLBookInfo, processHTBookInfo */
+
 // functions to get rights codes for previews
 function getHathiOptions() {
   return $('[class*="hathiPreviewSpan"]').attr("class").split('__')[1].split(',');
diff --git a/themes/bootstrap3/js/pubdate_vis.js b/themes/bootstrap3/js/pubdate_vis.js
index 290c28a881b..1fac0bbb65c 100644
--- a/themes/bootstrap3/js/pubdate_vis.js
+++ b/themes/bootstrap3/js/pubdate_vis.js
@@ -1,4 +1,5 @@
 /*global htmlEncode*/
+/* exported loadVis */
 
 function PadDigits(number, totalDigits) {
   var n = number <= 0 ? 1 : number;
diff --git a/themes/bootstrap3/js/record.js b/themes/bootstrap3/js/record.js
index bee29182341..751df8cd23f 100644
--- a/themes/bootstrap3/js/record.js
+++ b/themes/bootstrap3/js/record.js
@@ -1,4 +1,5 @@
 /*global deparam, syn_get_widget, userIsLoggedIn, VuFind */
+/* exported ajaxTagUpdate, recordDocReady */
 
 /**
  * Functions and event handlers specific to record pages.
@@ -23,19 +24,19 @@ function checkRequestIsValid(element, requestType) {
       $(element).remove();
     }
   })
-  .fail(function checkValidFail(response) {
+  .fail(function checkValidFail(/*response*/) {
     $(element).remove();
   });
 }
 
 function setUpCheckRequest() {
-  $('.checkRequest').each(function checkRequest(i) {
+  $('.checkRequest').each(function checkRequest() {
     checkRequestIsValid(this, 'Hold');
   });
-  $('.checkStorageRetrievalRequest').each(function checkStorageRetrievalRequest(i) {
+  $('.checkStorageRetrievalRequest').each(function checkStorageRetrievalRequest() {
     checkRequestIsValid(this, 'StorageRetrievalRequest');
   });
-  $('.checkILLRequest').each(function checkILLRequest(i) {
+  $('.checkILLRequest').each(function checkILLRequest() {
     checkRequestIsValid(this, 'ILLRequest');
   });
 }
@@ -46,7 +47,7 @@ function deleteRecordComment(element, recordId, recordSource, commentId) {
     dataType: 'json',
     url: url
   })
-  .done(function deleteCommentDone(response) {
+  .done(function deleteCommentDone(/*response*/) {
     $($(element).closest('.comment')[0]).remove();
   });
 }
@@ -89,7 +90,7 @@ function registerAjaxCommentRecord() {
       data: data,
       dataType: 'json'
     })
-    .done(function addCommentDone(response) {
+    .done(function addCommentDone(/*response, textStatus*/) {
       var $tab = $(form).closest('.tab-pane');
       refreshCommentList($tab, id, recordSource);
       $(form).find('textarea[name="comment"]').val('');
@@ -223,7 +224,7 @@ function applyRecordTabHash() {
 $(window).on('hashchange', applyRecordTabHash);
 
 function recordDocReady() {
-  $('.record-tabs .nav-tabs a').click(function recordTabsClick(e) {
+  $('.record-tabs .nav-tabs a').click(function recordTabsClick() {
     var $li = $(this).parent();
     // If it's an active tab, click again to follow to a shareable link.
     if ($li.hasClass('active')) {
-- 
GitLab