%PDF- %PDF-
| Direktori : /data/old/home/stash/stash/atlassian-stash/static/page/filebrowser/ |
| Current File : //data/old/home/stash/stash/atlassian-stash/static/page/filebrowser/filebrowser-min.js |
define("page/filebrowser",["aui","jquery","memoir","util/deprecation","util/events","model/content-tree-node-types","model/path","model/revision-reference","feature/filebrowser/file-finder","feature/filebrowser/file-table","exports"],function(G,E,N,V,A,J,U,a,X,D,Z){var L=D.FileTable,F=D.FileTableView,W=X.FileFinder,P;var H,K,I;var O,T,R,C,S,M;function Y(){return C.find(".file-row a").map(function(c,e){var b=E(e);var d=b.parent().parent();return{name:b.text(),contentId:b.attr("data-contentId"),type:d.hasClass("file")?J.FILE:d.hasClass("directory")?J.DIRECTORY:J.SUBMODULE}})}Z.onReady=function(k,f,e,h){var j=new U(k),g=new a(f);R=E(".find-files");C=E(".filebrowser-content");S=R.find(".find-files-button");M=R.find(".browse-files-button");K=new F(e);H=new L(j,g,h);I=new W(e,g);E(document).on("focus","#browse-table tr.file-row",function(){E(".focused-file").removeClass("focused-file");E(this).addClass("focused-file")});A.on("memoir.popstate",function(l){if(l.state){g=new a(l.state.revisionRef)}});var c=function(l){if(g!==l){g=l;A.trigger("stash.page.filebrowser.revisionRefChanged",null,l)}};A.on("stash.layout.branch.revisionRefChanged",c);A.on("stash.feature.filetable.revisionRefChanged",c);A.on("stash.widget.branchselector.dialogShown",function(){P=true});A.on("stash.widget.branchselector.dialogHidden",function(){P=false});var i=function(l){A.trigger("stash.page.filebrowser.urlChanged",null,l)};A.on("stash.layout.*.urlChanged",i);A.on("stash.feature.*.urlChanged",i);A.on("stash.feature.*.pathChanged",function(l){j=new U(l);A.trigger("stash.page.filebrowser.pathChanged",null,V.jsonAsBrace(j,"3.1","4.0"))});A.on("stash.widget.keyboard-shortcuts.register-contexts",function(l){l.enableContext("filebrowser")});var d=function(){if(!I.isLoaded()){S.attr("aria-pressed",true);M.attr("aria-pressed",false);I.loadFinder()}};var b=function(){if(I.isLoaded()){S.attr("aria-pressed",false);M.attr("aria-pressed",true);I.unloadFinder();if(H.data){K.update(H.data)}else{H.reload()}}};A.on("stash.feature.filetable.showFind",d);A.on("stash.feature.filetable.hideFind",b);A.on("stash.page.filebrowser.revisionRefChanged",b);A.trigger("stash.feature.filebrowser.filesChanged",null,{files:Y(),path:V.jsonAsBrace(new U(k),"3.1","4.0"),revision:g.getId()});A.on("stash.feature.filetable.dataReceived",function(l){if(B(l)){return }A.trigger("stash.feature.filebrowser.filesChanged",null,{files:l.children.values.map(function(m){return _.pick(m,"name","contentId","type")}),path:l.path,revision:l.revisionRef&&l.revisionRef.id})});S.click(function(){A.trigger("stash.feature.filetable.showFind");return false});M.click(function(){A.trigger("stash.feature.filetable.hideFind");return false});Q()};function B(b){return !(b&&b.children)}function Q(){var b={focusedClass:"focused-file",wrapAround:false,escToCancel:false},c="#browse-table tr.file-row",d=c+"."+b.focusedClass;A.on("stash.keyboard.shortcuts.requestMoveToNextHandler",function(e){(this.moveToNextItem?this:G.whenIType(e)).moveToNextItem(c,b)});A.on("stash.keyboard.shortcuts.requestMoveToPreviousHandler",function(e){(this.moveToPrevItem?this:G.whenIType(e)).moveToPrevItem(c,b)});A.on("stash.keyboard.shortcuts.requestOpenItemHandler",function(e){(this.execute?this:G.whenIType(e)).execute(function(){if(!P){var f=E(d);if(f.length){if(f.hasClass("file")||!N.nativeSupport()){A.trigger("stash.feature.filetable.showSpinner",this);window.location.href=f.find("a").attr("href")}else{f.find("a").click()}}}})});A.on("stash.keyboard.shortcuts.requestOpenParentHandler",function(e){(this.execute?this:G.whenIType(e)).execute(function(){if(!P){var f=E(K.getParentDirSelector());if(f.length){if(N.nativeSupport()){f.click()}else{A.trigger("stash.feature.filetable.showSpinner",this);window.location.href=f.attr("href")}}}})});A.on("stash.keyboard.shortcuts.requestOpenFileFinderHandler",function(e){O=G.I18n.getText("stash.web.file.finder.findfiles.tooltip",e);S.attr("title",O);(this.execute?this:G.whenIType(e)).execute(function(){A.trigger("stash.feature.filetable.showFind",this)})});A.on("stash.keyboard.shortcuts.requestCloseFileFinderHandler",function(e){T=G.I18n.getText("stash.web.file.finder.browse.files.tooltip",e);M.attr("title",T);(this.execute?this:G.whenIType(e)).execute(function(){A.trigger("stash.feature.filetable.hideFind",this)})})}});