%PDF- %PDF-
Mini Shell

Mini Shell

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

define("feature/watch",["jquery","underscore","util/ajax","util/deprecation","model/page-state"],function(G,C,F,A,E){var D={COMMIT:"commit",PULL_REQUEST:"pull-request"};function B(H,K,L){var I=this;this.url=K;this.$watch=H;this.isWatching=E.getIsWatching();this.watchableType=L;this.$watch.on("click",M);C.bindAll(this,"toggleWatch","toggleUnwatch","toggleTrigger");function J(P,O,Q){var N={user:E.getCurrentUser()};A.triggerDeprecated(P,I,N,undefined,O,Q)}function M(O){O.preventDefault();if(I.isWatching){J("stash.widget.watch-button.removing","2.11","3.0")}else{J("stash.widget.watch-button.adding","2.11","3.0")}var N=!I.isWatching;I.toggleTrigger(N);return F.rest({url:I.url,type:I.isWatching?"DELETE":"POST",statusCode:{"401":function(R,T,Q,S,P){return G.extend({},P,{title:AJS.I18n.getText("stash.web.watch.default.error.401.title"),message:AJS.I18n.getText("stash.web.watch.default.error.401.message"),fallbackUrl:false,shouldReload:true})},"409":function(R,T,Q,S,P){return G.extend({},P,{title:AJS.I18n.getText("stash.web.watch.default.error.409.title"),fallbackUrl:false,shouldReload:true})}}}).done(function(){I.isWatching=N;E.setIsWatching(N);if(I.isWatching){J("stash.widget.watch-button.added","2.11","3.0")}else{J("stash.widget.watch-button.removed","2.11","3.0")}}).fail(function(){I.toggleTrigger(I.isWatching);if(I.isWatching){J("stash.widget.watch-button.remove.fail","2.11","3.0")}else{J("stash.widget.watch-button.add.fail","2.11","3.0")}})}}B.prototype.setIsWatching=function(H){this.toggleTrigger(H);this.isWatching=H;if(E.getIsWatching()!==H){E.setIsWatching(H)}};B.prototype.toggleWatch=function(){this.toggleTrigger(true)};B.prototype.toggleUnwatch=function(){this.toggleTrigger(false)};B.prototype.toggleTrigger=function(I){var H;switch(this.watchableType){case B.type.COMMIT:H=stash.feature.watch.commitLabel({isWatching:I});break;case B.type.PULL_REQUEST:H=stash.feature.watch.pullRequestLabel({isWatching:I});break}this.$watch.fadeOut(200,function(){G(this).html(H).fadeIn(200)})};B.prototype.destroy=function(){this.url=null;this.$watch=null;this.isWatching=null};B.type=D;return B});

Zerion Mini Shell 1.0