Bug 28522: Correct eslint errors in staff-global.js
This patch makes minor corrections to staff-global.js in order to quiet warnings from ESLint. This includes: - Remove unused variables - Declare undeclared variables - Update list of global and exported variables and functions - Correct whitespace - Remove an unused function (paramOfUrl) To test, apply the patch and clear your browser cache if necessary. - Confirm that the first search header form field has focus when switching bewteen pages. - Confirm that text entered in any search header form field persists when you switch search header form tabs, e.g. a word typed into the "Check out" tab is copied to the "Check in" form when you switch to that tab. - Perform a search from the "Search the catalog" tab in the header. On the search results page and any following detail page your search term should remain in the header search form. - From a bibliographic detail page, confirm that selecting a list from the "Add to list" button menu correctly triggers a popup window. Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
c788d6205b
commit
3f55688626
1 changed files with 10 additions and 21 deletions
|
@ -1,5 +1,5 @@
|
||||||
/* global shortcut delCookie delBasket Sticky */
|
/* global shortcut delBasket Sticky AUDIO_ALERT_PATH */
|
||||||
/* exported paramOfUrl addBibToContext delBibToContext */
|
/* exported addBibToContext delBibToContext escape_str escape_price openWindow _ removeFocus toUC confirmDelete confirmClone playSound */
|
||||||
if ( KOHA === undefined ) var KOHA = {};
|
if ( KOHA === undefined ) var KOHA = {};
|
||||||
|
|
||||||
function _(s) { return s; } // dummy function for gettext
|
function _(s) { return s; } // dummy function for gettext
|
||||||
|
@ -48,8 +48,8 @@ $.fn.selectTabByID = function (tabID) {
|
||||||
$(this).tabs("option", "active", $( tabID ).tabIndex());
|
$(this).tabs("option", "active", $( tabID ).tabIndex());
|
||||||
};
|
};
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#header_search').tabs().on( "tabsactivate", function(e, ui) { $(this).find("div:visible").find('input').eq(0).focus(); });
|
$('#header_search').tabs().on( "tabsactivate", function() { $(this).find("div:visible").find('input').eq(0).focus(); });
|
||||||
|
|
||||||
$(".close").click(function(){ window.close(); });
|
$(".close").click(function(){ window.close(); });
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ function openHelp(){
|
||||||
|
|
||||||
jQuery.fn.preventDoubleFormSubmit = function() {
|
jQuery.fn.preventDoubleFormSubmit = function() {
|
||||||
jQuery(this).submit(function() {
|
jQuery(this).submit(function() {
|
||||||
$("body, form input[type='submit'], form button[type='submit'], form a").addClass('waiting');
|
$("body, form input[type='submit'], form button[type='submit'], form a").addClass('waiting');
|
||||||
if (this.beenSubmitted)
|
if (this.beenSubmitted)
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
|
@ -225,12 +225,11 @@ function openWindow(link,name,width,height) {
|
||||||
name = (typeof name == "undefined")?'popup':name;
|
name = (typeof name == "undefined")?'popup':name;
|
||||||
width = (typeof width == "undefined")?'600':width;
|
width = (typeof width == "undefined")?'600':width;
|
||||||
height = (typeof height == "undefined")?'400':height;
|
height = (typeof height == "undefined")?'400':height;
|
||||||
var newwin;
|
|
||||||
//IE <= 9 can't handle a "name" with whitespace
|
//IE <= 9 can't handle a "name" with whitespace
|
||||||
try {
|
try {
|
||||||
newin=window.open(link,name,'width='+width+',height='+height+',resizable=yes,toolbar=false,scrollbars=yes,top');
|
window.open(link,name,'width='+width+',height='+height+',resizable=yes,toolbar=false,scrollbars=yes,top');
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
newin=window.open(link,null,'width='+width+',height='+height+',resizable=yes,toolbar=false,scrollbars=yes,top');
|
window.open(link,null,'width='+width+',height='+height+',resizable=yes,toolbar=false,scrollbars=yes,top');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,7 +266,7 @@ function keep_text(clicked_index) {
|
||||||
var searchboxes = document.getElementsByClassName("head-searchbox");
|
var searchboxes = document.getElementsByClassName("head-searchbox");
|
||||||
var persist = searchboxes[0].value;
|
var persist = searchboxes[0].value;
|
||||||
|
|
||||||
for (i = 0; i < searchboxes.length - 1; i++) {
|
for (var i = 0; i < searchboxes.length - 1; i++) {
|
||||||
if (searchboxes[i].value != searchboxes[i+1].value) {
|
if (searchboxes[i].value != searchboxes[i+1].value) {
|
||||||
if (i === searchboxes.length-2) {
|
if (i === searchboxes.length-2) {
|
||||||
if (searchboxes[i].value != searchboxes[0].value) {
|
if (searchboxes[i].value != searchboxes[0].value) {
|
||||||
|
@ -306,18 +305,6 @@ function removeByValue(arr, val) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function paramOfUrl( url, param ) {
|
|
||||||
param = param.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
|
|
||||||
var regexS = "[\\?&]"+param+"=([^&#]*)";
|
|
||||||
var regex = new RegExp( regexS );
|
|
||||||
var results = regex.exec( url );
|
|
||||||
if( results == null ) {
|
|
||||||
return "";
|
|
||||||
} else {
|
|
||||||
return results[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function addBibToContext( bibnum ) {
|
function addBibToContext( bibnum ) {
|
||||||
bibnum = parseInt(bibnum, 10);
|
bibnum = parseInt(bibnum, 10);
|
||||||
var bibnums = getContextBiblioNumbers();
|
var bibnums = getContextBiblioNumbers();
|
||||||
|
@ -351,6 +338,8 @@ function resetSearchContext() {
|
||||||
|
|
||||||
function saveOrClearSimpleSearchParams() {
|
function saveOrClearSimpleSearchParams() {
|
||||||
// Simple masthead search - pass value for display on details page
|
// Simple masthead search - pass value for display on details page
|
||||||
|
var pulldown_selection;
|
||||||
|
var searchbox_value;
|
||||||
if( $("#cat-search-block select.advsearch").length ){
|
if( $("#cat-search-block select.advsearch").length ){
|
||||||
pulldown_selection = $("#cat-search-block select.advsearch").val();
|
pulldown_selection = $("#cat-search-block select.advsearch").val();
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue