From 9a7c6f695c4dd0fe5a1a92534ad0af79adbf1122 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Wed, 17 Feb 2016 09:54:28 -0500 Subject: [PATCH] Bug 15844 - Correct JSHint errors in staff-global.js This patch corrects minor errors in staff-global.js according to warnings raised by JSHint. To test, apply the patch and run JSHint on staff-global.js. No warnings should be raised. To confirm that the behavior of the JS is not changed, clear your browser cache if necessary and: - Confirm that the "Help" link opens the help window. - Confirm that audio alerts work with local and remote sound files - Confirm that the format() method is still working correctly by, for instance, opening the detail page for a bibliographic record with multiple items and choosing 'Edit -> Delete record' from the menu. The error message should read like "2 item(s) are attached to this record..." Signed-off-by: Hector Castro Works as described. No errors with JSHint CLI (6 errors fixed) Signed-off-by: Jonathan Druart Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com --- koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js index bc4318ef06..d915136f09 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js @@ -4,7 +4,7 @@ if ( KOHA === undefined ) var KOHA = {}; function _(s) { return s; } // dummy function for gettext // http://stackoverflow.com/questions/1038746/equivalent-of-string-format-in-jquery/5341855#5341855 -String.prototype.format = function() { return formatstr(this, arguments) } +String.prototype.format = function() { return formatstr(this, arguments); }; function formatstr(str, col) { col = typeof col === 'object' ? col : Array.prototype.slice.call(arguments, 1); var idx = 0; @@ -13,7 +13,7 @@ function formatstr(str, col) { if (m == "%s") { return col[idx++]; } return col[n]; }); -}; +} // http://stackoverflow.com/questions/14859281/select-tab-by-name-in-jquery-ui-1-10-0/16550804#16550804 @@ -97,11 +97,12 @@ function openWindow(link,name,width,height) { name = (typeof name == "undefined")?'popup':name; width = (typeof width == "undefined")?'600':width; height = (typeof height == "undefined")?'400':height; + var newwin; //IE <= 9 can't handle a "name" with whitespace try { - var newin=window.open(link,name,'width='+width+',height='+height+',resizable=yes,toolbar=false,scrollbars=yes,top'); + newin=window.open(link,name,'width='+width+',height='+height+',resizable=yes,toolbar=false,scrollbars=yes,top'); } catch(e) { - var newin=window.open(link,null,'width='+width+',height='+height+',resizable=yes,toolbar=false,scrollbars=yes,top'); + newin=window.open(link,null,'width='+width+',height='+height+',resizable=yes,toolbar=false,scrollbars=yes,top'); } } @@ -123,7 +124,7 @@ function confirmDelete(message) { } function playSound( sound ) { - if ( ! ( sound.indexOf('http://') == 0 || sound.indexOf('https://') == 0 ) ) { + if ( ! ( sound.indexOf('http://') === 0 || sound.indexOf('https://') === 0 ) ) { sound = AUDIO_ALERT_PATH + sound; } document.getElementById("audio-alert").innerHTML = ''; -- 2.39.5