%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/985914/root/data/old/home/stash/atlassian-stash/static/widget/
Upload File :
Create Path :
Current File : //proc/985914/root/data/old/home/stash/atlassian-stash/static/widget/keyboard-controller-min.js

define("widget/keyboard-controller",["jquery"],function(C){function A(H,F){if(!(this instanceof A)){return new A(H,F)}var E=C(H);var G;E.on("keydown",G=function(I){if(I.keyCode in F){if(!F[I.keyCode](I)){I.preventDefault()}}});this.destroy=function(){E.off("keydown",G)};return this}function B(H,F){F=C.extend({},B.defaults,F);function G(I){I.focus().addClass(F.focusedClass)}var E={};E[C.ui.keyCode.TAB]=function(M){var J,I,K,L=M.target;J=C("a:visible, :input:visible:enabled, :checkbox:visible:enabled, :radio:visible:enabled, [tabindex]",H).not("[tabindex=-1]").filter(function(){return C(this).css("visibility")!=="hidden"});K=J.last();I=J.first();J.removeClass(F.focusedClass);if(M.shiftKey&&L===I[0]){if(!F.wrapAround){return true}G(K)}else{if(!M.shiftKey&&L===K[0]){if(!F.wrapAround){return true}G(I)}else{if(M.shiftKey){G(J.eq(J.index(L)-1))}else{G(J.eq(J.index(L)+1))}}}};return new A(H,E)}B.defaults={focusedClass:"item-focused",wrapAround:true};function D(R,S,T){T=C.extend({},D.defaults,T);var F=C(S);var Q=C.Callbacks();var O=C.Callbacks();if(T.onSelect){Q.add(T.onSelect)}if(T.onFocus){O.add(T.onFocus)}var I=false,E=false,K=false;function H(V){do{var W=V.find(">:first-child");var U=V.next();if(W.length){V=W}else{if(U.length){V=U}else{V=V.parentsUntil(F[0]).next().first()}}}while(V.length&&!V.is(T.itemSelector));return V}function N(W){do{var V=W.prev();if(V.length){var U;while((U=V.find(">:last-child")).length){V=U}W=V}else{W=W.parent();if(W[0]===F[0]){W=C()}}}while(W.length&&!W.is(T.itemSelector));return W}function P(U){return function V(c){var b=C(T.itemSelector,F);var d=b.filter(function(){return C(this).hasClass(T.focusedClass)});var W=false;var f=U==="next";var Z;if(d.length){if(T.adjacentItems){Z=d[U](T.itemSelector)}else{if(U==="next"){Z=H(d)}else{Z=N(d)}}}else{if(U==="next"){Z=b.first()}else{if(T.wrapAround){Z=b.last()}else{return }}}K=true;if(!Z.length){if(U==="next"&&T.requestMore&&!I){if(!E){K=false;var h=T.requestMore();if(h){E=true;h.done(function(e){I=e;if(!K){V(c)}}).always(function(){E=false;K=false});return }else{I=true;V(c);return }}else{K=false;return }}else{if(T.wrapAround){W=true;f=!f;Z=b[U==="next"?"first":"last"]()}else{return }}}d.removeClass(T.focusedClass);Z.addClass(T.focusedClass);var X=Z[U](),a=!W&&X.length?X:Z;var Y=document.activeElement;if(T.focusIntoView&&Y){var g=a.attr("tabindex");a.attr("tabindex","0");a.focus();Y.focus();if(g==null){a.removeAttr("tabindex")}else{a.attr("tabindex",g)}}else{Z[0].scrollIntoView(false)}O.fire(Z,c)}}var J={};var M=J[C.ui.keyCode.UP]=P("prev");var G=J[C.ui.keyCode.DOWN]=P("next");J[C.ui.keyCode.ENTER]=function(U){var W=C(T.itemSelector,F);var V=W.filter(function(){return C(this).hasClass(T.focusedClass)});if(V.length){Q.fire(V,U)}};var L=new A(R,J);L.setListElement=function(U){F=C(U)};L.blur=function(){C(T.itemSelector,F).removeClass(T.focusedClass)};L.focus=function(){O.add.apply(O,arguments);return this};L.select=function(){Q.add.apply(Q,arguments);return this};L.moveToNext=G;L.moveToPrev=M;return L}D.defaults={itemSelector:"li",focusedClass:"item-focused",wrapAround:false,adjacentItems:true,requestMore:undefined,onFocus:undefined,onSelect:undefined};return{KeyboardController:A,TabKeyboardController:B,ListKeyboardController:D}});

Zerion Mini Shell 1.0