mirror of
https://github.com/ansible/awx.git
synced 2026-03-22 11:25:08 -02:30
JSHint errors
fixed some JSHint errors from the prompt dialog commit
This commit is contained in:
@@ -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
|
// 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
|
// the user is attempting to delete something. Might need to be checked for other occurances of the bootstrap
|
||||||
// modal other than deleting
|
// modal other than deleting
|
||||||
function disableTabModalShown() {
|
function disableTabModalShown() {
|
||||||
|
|
||||||
$('.modal').on('shown.bs.modal', function() {
|
$('.modal').on('shown.bs.modal', function() {
|
||||||
|
|
||||||
var modal = $(this);
|
var modal = $(this),
|
||||||
var focusableChildren = modal.find('a[href], a[data-dismiss], area[href], input, select, textarea, button, iframe, object, embed, *[tabindex], *[contenteditable]');
|
focusableChildren = modal.find('a[href], a[data-dismiss], area[href], input, select, textarea, button, iframe, object, embed, *[tabindex], *[contenteditable]'),
|
||||||
var numElements = focusableChildren.length;
|
numElements = focusableChildren.length,
|
||||||
var currentIndex = 0;
|
currentIndex = 0,
|
||||||
|
focus,
|
||||||
|
focusPrevious,
|
||||||
|
focusNext;
|
||||||
|
|
||||||
$(document.activeElement).blur();
|
$(document.activeElement).blur();
|
||||||
|
|
||||||
var focus = function() {
|
focus = function() {
|
||||||
var focusableElement = focusableChildren[currentIndex];
|
var focusableElement = focusableChildren[currentIndex];
|
||||||
if (focusableElement)
|
if (focusableElement)
|
||||||
focusableElement.focus();
|
focusableElement.focus();
|
||||||
};
|
};
|
||||||
|
|
||||||
var focusPrevious = function () {
|
focusPrevious = function () {
|
||||||
currentIndex--;
|
currentIndex--;
|
||||||
if (currentIndex < 0)
|
if (currentIndex < 0)
|
||||||
currentIndex = numElements - 1;
|
currentIndex = numElements - 1;
|
||||||
@@ -74,7 +77,7 @@ angular.module('PromptDialog', ['Utilities'])
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
var focusNext = function () {
|
focusNext = function () {
|
||||||
currentIndex++;
|
currentIndex++;
|
||||||
if (currentIndex >= numElements)
|
if (currentIndex >= numElements)
|
||||||
currentIndex = 0;
|
currentIndex = 0;
|
||||||
@@ -86,11 +89,11 @@ angular.module('PromptDialog', ['Utilities'])
|
|||||||
|
|
||||||
$(document).on('keydown', function (e) {
|
$(document).on('keydown', function (e) {
|
||||||
|
|
||||||
if (e.keyCode == 9 && e.shiftKey) {
|
if (e.keyCode === 9 && e.shiftKey) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
focusPrevious();
|
focusPrevious();
|
||||||
}
|
}
|
||||||
else if (e.keyCode == 9) {
|
else if (e.keyCode === 9) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
focusNext();
|
focusNext();
|
||||||
}
|
}
|
||||||
@@ -102,7 +105,7 @@ angular.module('PromptDialog', ['Utilities'])
|
|||||||
$('.modal').on('hidden.bs.modal', function() {
|
$('.modal').on('hidden.bs.modal', function() {
|
||||||
$(document).unbind('keydown');
|
$(document).unbind('keydown');
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
$('#prompt-modal').off('hidden.bs.modal');
|
$('#prompt-modal').off('hidden.bs.modal');
|
||||||
@@ -112,12 +115,6 @@ angular.module('PromptDialog', ['Utilities'])
|
|||||||
show: true
|
show: true
|
||||||
});
|
});
|
||||||
disableTabModalShown();
|
disableTabModalShown();
|
||||||
// $('#prompt-modal').on('shown.bs.modal', function (e) {
|
|
||||||
// if($('#prompt_action_btn')){
|
|
||||||
// $('#prompt_action_btn').focus();
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user