
js.set-focus.js Maven / Gradle / Ivy
jQuery.namespace("jira.setFocus");jira.setFocus=(function(){var _defaultExcludeParentSelector="form.dont-default-focus",_defaultFocusElementSelector="input, select, textarea, button, a.cancel",_defaultParentElementSelectors=["div.aui-popup-content:visible","form.aui:visible","form:visible"],_configurationStack=[];var _focusIn=function(context,parentSelector,excludeParentSelector,elementSelector){var found=false;AJS.$(parentSelector,context).not(excludeParentSelector).find(elementSelector).each(function(){var elem=AJS.$(this);if(elem.is(":visible:enabled")||elem.is("a:visible")){elem.focus();if(elem.is(":text, :password, textarea")){if(elem.is(".focus-select-end")){elem.setCaretToPosition(elem[0].value.length)}else{elem.setSelectionRange(0,elem[0].value.length)}}found=true;return false}});return found},_defaultFocusNow=function(){var i=0,currentConfig=_configurationStack[_configurationStack.length-1];while(!_focusIn(currentConfig.context,currentConfig.parentElementSelectors[i],currentConfig.excludeParentSelector,currentConfig.focusElementSelector)&&i
© 2015 - 2025 Weber Informatics LLC | Privacy Policy