JSHint errors

fixed some JSHint errors from the prompt dialog commit
This commit is contained in:
Jared Tabor
2015-01-21 18:00:25 -05:00
parent f9af559379
commit 0bf3d54095

View File

@@ -47,24 +47,27 @@ angular.module('PromptDialog', ['Utilities'])
// This will keep the tab indexing on the modal's focus. This is to fix an issue with tabbing working when
// the user is attempting to delete something. Might need to be checked for other occurances of the bootstrap
// modal other than deleting
function disableTabModalShown() {
function disableTabModalShown() {
$('.modal').on('shown.bs.modal', function() {
var modal = $(this);
var focusableChildren = modal.find('a[href], a[data-dismiss], area[href], input, select, textarea, button, iframe, object, embed, *[tabindex], *[contenteditable]');
var numElements = focusableChildren.length;
var currentIndex = 0;
var modal = $(this),
focusableChildren = modal.find('a[href], a[data-dismiss], area[href], input, select, textarea, button, iframe, object, embed, *[tabindex], *[contenteditable]'),
numElements = focusableChildren.length,
currentIndex = 0,
focus,
focusPrevious,
focusNext;
$(document.activeElement).blur();
var focus = function() {
focus = function() {
var focusableElement = focusableChildren[currentIndex];
if (focusableElement)
focusableElement.focus();
};
var focusPrevious = function () {
focusPrevious = function () {
currentIndex--;
if (currentIndex < 0)
currentIndex = numElements - 1;
@@ -74,7 +77,7 @@ angular.module('PromptDialog', ['Utilities'])
return false;
};
var focusNext = function () {
focusNext = function () {
currentIndex++;
if (currentIndex >= numElements)
currentIndex = 0;
@@ -86,11 +89,11 @@ angular.module('PromptDialog', ['Utilities'])
$(document).on('keydown', function (e) {
if (e.keyCode == 9 && e.shiftKey) {
if (e.keyCode === 9 && e.shiftKey) {
e.preventDefault();
focusPrevious();
}
else if (e.keyCode == 9) {
else if (e.keyCode === 9) {
e.preventDefault();
focusNext();
}
@@ -102,7 +105,7 @@ angular.module('PromptDialog', ['Utilities'])
$('.modal').on('hidden.bs.modal', function() {
$(document).unbind('keydown');
});
};
}
$('#prompt-modal').off('hidden.bs.modal');
@@ -112,12 +115,6 @@ angular.module('PromptDialog', ['Utilities'])
show: true
});
disableTabModalShown();
// $('#prompt-modal').on('shown.bs.modal', function (e) {
// if($('#prompt_action_btn')){
// $('#prompt_action_btn').focus();
// }
// });
};
}