Browse Source

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 <hector.hecaxmmx@gmail.com>
Works as described. No errors with JSHint CLI (6 errors fixed)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
new_12478_elasticsearch
Owen Leonard 8 years ago
committed by Brendan Gallagher
parent
commit
9a7c6f695c
  1. 11
      koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js

11
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 = '<audio src="' + sound + '" autoplay="autoplay" autobuffer="autobuffer"></audio>';

Loading…
Cancel
Save