%PDF- %PDF-
Mini Shell

Mini Shell

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

define("util/ajax",["aui","jquery","underscore","util/error","util/function","util/navbuilder","model/page-state","widget/error-dialog","exports"],function(A,G,N,B,K,H,M,P,E){G.ajaxSetup({timeout:60000});var I=false;function D(W,X,V,U){var R=new Date();if(R<V){var T=function(){var Y=Math.ceil((+V-+new Date())/X);if(Y<=0){clearInterval(S);U()}else{W.text(Y)}},S=setInterval(T,X);T()}else{U()}}function Q(T,S,V,W,U){var R=new Date();if(R<U){T.addClass("hidden");T.before(S);D(V,W,U,function(){S.remove();T.removeClass("hidden")})}}function O(V,W,Z,a){var U,R,e;function b(f){R=f;e=R.abort;R.abort=Y}function Y(){e.apply(R,arguments)}function T(o,w,i,t,u,v,l){if(o.shouldLogin){window.onbeforeunload=null;window.location.href=H.login().next(window.location.href).build();return G.Deferred()}if(w){delete w.errors}var p;if(!I){p=new P()}var s=o.shouldRetry&&!I?G.Deferred():G.Deferred().rejectWith(this,[t,i,u,w,p]);if(!I){var m="",j=false;var q=stash.widget.errorContent(o);p.addHideListener(function(){I=false});var r={id:"ajax-error",titleText:o.title,titleClass:o.titleClass||"error-header",showCloseButton:N.isUndefined(o.canClose)?true:o.canClose,closeOnOutsideClick:false};if(o.fallbackUrl){r.okButtonText=A.escapeHtml(o.fallbackTitle);p.addOkListener(function(x){window.location.href=o.fallbackUrl;x.preventDefault()})}else{if(o.shouldReload){r.okButtonText=A.escapeHtml(AJS.I18n.getText("stash.web.ajax.reload"));p.addOkListener(function(x){window.location.reload();x.preventDefault()})}else{if(o.shouldRetry){s.notify("stalled");if(o.retryAfterDate){if(+o.retryAfterDate-+new Date()>60*60*1000){m=AJS.I18n.getText("stash.web.retry.later")}else{j=true}}r.okButtonText=A.escapeHtml(AJS.I18n.getText("stash.web.ajax.try.again"));var n;p.addOkListener(function(x){s.notify("unstalled");p.remove();n=L(v,l);b(n);n.done(function(){return s.resolveWith(this,arguments)});n.fail(function(){return s.rejectWith(this,arguments)});x.preventDefault()});p.addHideListener(function(){if(s.state()==="pending"&&!n){s.rejectWith(this,[t,i,u,w])}})}else{r.showCloseButton=false}}}r.panelContent="<p>"+q+m+"</p>";p.reinit(r).show();I=true;if(j){var f,k;if(+o.retryAfterDate-+new Date()>60*1000){k=AJS.I18n.getText("stash.web.retry.in.x.minutes","<time><span></span>","</time>");f=60*1000}else{k=AJS.I18n.getText("stash.web.retry.in.x.seconds","<time><span></span>","</time>");f=1000}var h=G("<span>"+k+"</span>"),g=h.children("time").children();Q(p.getOkButton(),h,g,f,o.retryAfterDate)}}return s}function c(h,f,g,i,n,m){var l=a?B.getDominantRESTError(h,g):B.getDominantAJAXError(g),j=true;if(n){var k=n(l);if(k&&typeof k.promise==="function"){return k.promise(g)}if(k&&N.isObject(k)){l=k}j=k!==false}if(j&&l){return T(l,h,f,g,i,W,a)}else{return m()}}function d(f){var g=Z[f];if(g===undefined||g===null){g=Z["*"]}if(typeof g==="function"){return g}else{return K.constant(g)}}function X(j,k,i){var g=this;var h=d(i.status),f=h?N.bind(h,g,j,k,i):null;return c(j,k,i,null,f,function(){return G.Deferred().resolveWith(g,[j,k,i])})}function S(i,m,l){var g=this;var j=i.responseText;try{j=JSON.parse(j)}catch(k){}var h=d(i.status),f=h?N.bind(h,g,i,m,l,j):null;return c(j,m,i,l,f,function(){return G.Deferred().rejectWith(g,[i,m,l,j])})}b(V);U=V.then(X,S);return U.promise(V)}function L(T,S){var R;if(T.statusCode){R=T.statusCode;delete T.statusCode}R=R||{};var U=O(G.ajax(T),T,R,S);U.statusCode=function(W){if(W){if(U.state()==="pending"){G.extend(R,W)}else{for(var X in W){if(W.hasOwnProperty(X)){A.log("xhr.statusCode() should not be called after the request has completed. Your handler will have no affect on the resolution of the request.");break}}var V=W[U.status];U.then(V,V)}}};return U}function C(R){var S={};if(M.getCurrentUser()){S["X-AUSERNAME"]=M.getCurrentUser().getName();S["X-AUSERID"]=M.getCurrentUser().getId()}R=G.extend(true,{dataType:"json",contentType:"application/json",headers:S,jsonp:false,type:"GET"},R);if(R.type.toUpperCase()!=="GET"&&(G.isPlainObject(R.data)||G.isArray(R.data))){R.data=JSON.stringify(R.data)}return L(R,true)}function F(R){var S=N.reduce(R.find("input[type=checkbox]:checked"),function(V,U){var T=G(U);if(T.attr("value")==="on"){V[T.attr("name")]=true}return V},{});return N.reduce(R.serializeArray(),function(W,U){var V=W[U.name],T=U.value===undefined?"":U.value;if(S[U.name]){T=true}if(V!==undefined){if(!G.isArray(V)){W[U.name]=[V]}W[U.name].push(T)}else{W[U.name]=T}return W},{})}function J(S){S=G.extend({pollTimeout:60000,interval:500,delay:0,tick:G.noop},S);var T=false;var V=false;var X=G.Deferred(),U=new Date().getTime(),R=function(){if(T||V){return }V=true;C(S).done(function(Z,b,a){var Y=S.tick(Z,b,a);if(Y){X.resolveWith(this,[Z,b,a])}else{if((new Date().getTime()-U)>S.pollTimeout||typeof Y!=="undefined"){X.rejectWith(this,[a,b,null,Z])}else{setTimeout(R,S.interval)}}}).fail(function(a,b,Z,Y){X.rejectWith(this,[a,b,Z,Y])}).always(function(){V=false})};setTimeout(R,S.delay);var W=X.promise();W.resume=function(){if(T){T=false;R()}};W.pause=function(){T=true};return W}E.ignore404WithinRepository=function(R){return{"404":function(X,S,W,U,V){var T=U&&U.errors&&U.errors.length&&U.errors[0];if(B.isErrorEntityWithinRepository(T)){return R&&R(U)||false}}}};E.ajax=L;E.rest=C;E.poll=J;E.formToJSON=F});

Zerion Mini Shell 1.0