");return t.inlineElement=i,i}return p.updateStatus("ready"),p._parseMarkup(n,{},t),n}}});var P="ajax",H,B=function(){H&&y.removeClass(H)},j=function(){B(),p.req&&p.req.abort()};e.magnificPopup.registerModule(P,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'
The content could not be loaded.'},proto:{initAjax:function(){p.types.push(P),H=p.st.ajax.cursor,x(t+"."+P,j),x("BeforeChange."+P,j)},getAjax:function(t){H&&y.addClass(H),p.updateStatus("loading");var n=e.extend({url:t.src,success:function(n,r,i){var s={data:n,xhr:i};N("ParseAjax",s),p.appendContent(e(s.data),P),t.finished=!0,B(),p._setFocus(),setTimeout(function(){p.wrap.addClass(l)},16),p.updateStatus("ready"),N("AjaxContentAdded")},error:function(){B(),t.finished=t.loadError=!0,p.updateStatus("error",p.st.ajax.tError.replace("%url%",t.src))}},p.st.ajax.settings);return p.req=e.ajax(n),""}}});var F,I=function(t){if(t.data&&t.data.title!==undefined)return t.data.title;var n=p.st.image.titleSrc;if(n){if(e.isFunction(n))return n.call(p,t);if(t.el)return t.el.attr(n)||""}return""};e.magnificPopup.registerModule("image",{options:{markup:'
',cursor:"mfp-zoom-out-cur",titleSrc:"title",verticalFit:!0,tError:'
The image could not be loaded.'},proto:{initImage:function(){var e=p.st.image,n=".image";p.types.push("image"),x(o+n,function(){p.currItem.type==="image"&&e.cursor&&y.addClass(e.cursor)}),x(t+n,function(){e.cursor&&y.removeClass(e.cursor),g.off("resize"+f)}),x("Resize"+n,p.resizeImage),p.isLowIE&&x("AfterChange",p.resizeImage)},resizeImage:function(){var e=p.currItem;if(!e||!e.img)return;if(p.st.image.verticalFit){var t=0;p.isLowIE&&(t=parseInt(e.img.css("padding-top"),10)+parseInt(e.img.css("padding-bottom"),10)),e.img.css("max-height",p.wH-t)}},_onImageHasSize:function(e){e.img&&(e.hasSize=!0,F&&clearInterval(F),e.isCheckingImgSize=!1,N("ImageHasSize",e),e.imgHidden&&(p.content&&p.content.removeClass("mfp-loading"),e.imgHidden=!1))},findImageSize:function(e){var t=0,n=e.img[0],r=function(i){F&&clearInterval(F),F=setInterval(function(){if(n.naturalWidth>0){p._onImageHasSize(e);return}t>200&&clearInterval(F),t++,t===3?r(10):t===40?r(50):t===100&&r(500)},i)};r(1)},getImage:function(t,n){var r=0,i=function(){t&&(t.img[0].complete?(t.img.off(".mfploader"),t===p.currItem&&(p._onImageHasSize(t),p.updateStatus("ready")),t.hasSize=!0,t.loaded=!0,N("ImageLoadComplete")):(r++,r<200?setTimeout(i,100):s()))},s=function(){t&&(t.img.off(".mfploader"),t===p.currItem&&(p._onImageHasSize(t),p.updateStatus("error",o.tError.replace("%url%",t.src))),t.hasSize=!0,t.loaded=!0,t.loadError=!0)},o=p.st.image,u=n.find(".mfp-img");if(u.length){var a=document.createElement("img");a.className="mfp-img",t.el&&t.el.find("img").length&&(a.alt=t.el.find("img").attr("alt")),t.img=e(a).on("load.mfploader",i).on("error.mfploader",s),a.src=t.src,u.is("img")&&(t.img=t.img.clone()),a=t.img[0],a.naturalWidth>0?t.hasSize=!0:a.width||(t.hasSize=!1)}return p._parseMarkup(n,{title:I(t),img_replaceWith:t.img},t),p.resizeImage(),t.hasSize?(F&&clearInterval(F),t.loadError?(n.addClass("mfp-loading"),p.updateStatus("error",o.tError.replace("%url%",t.src))):(n.removeClass("mfp-loading"),p.updateStatus("ready")),n):(p.updateStatus("loading"),t.loading=!0,t.hasSize||(t.imgHidden=!0,n.addClass("mfp-loading"),p.findImageSize(t)),n)}}});var q,R=function(){return q===undefined&&(q=document.createElement("p").style.MozTransform!==undefined),q};e.magnificPopup.registerModule("zoom",{options:{enabled:!1,easing:"ease-in-out",duration:300,opener:function(e){return e.is("img")?e:e.find("img")}},proto:{initZoom:function(){var e=p.st.zoom,r=".zoom",i;if(!e.enabled||!p.supportsTransition)return;var s=e.duration,o=function(t){var n=t.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"),r="all "+e.duration/1e3+"s "+e.easing,i={position:"fixed",zIndex:9999,left:0,top:0,"-webkit-backface-visibility":"hidden"},s="transition";return i["-webkit-"+s]=i["-moz-"+s]=i["-o-"+s]=i[s]=r,n.css(i),n},u=function(){p.content.css("visibility","visible")},a,f;x("BuildControls"+r,function(){if(p._allowZoom()){clearTimeout(a),p.content.css("visibility","hidden"),i=p._getItemToZoom();if(!i){u();return}f=o(i),f.css(p._getOffset()),p.wrap.append(f),a=setTimeout(function(){f.css(p._getOffset(!0)),a=setTimeout(function(){u(),setTimeout(function(){f.remove(),i=f=null,N("ZoomAnimationEnded")},16)},s)},16)}}),x(n+r,function(){if(p._allowZoom()){clearTimeout(a),p.st.removalDelay=s;if(!i){i=p._getItemToZoom();if(!i)return;f=o(i)}f.css(p._getOffset(!0)),p.wrap.append(f),p.content.css("visibility","hidden"),setTimeout(function(){f.css(p._getOffset())},16)}}),x(t+r,function(){p._allowZoom()&&(u(),f&&f.remove(),i=null)})},_allowZoom:function(){return p.currItem.type==="image"},_getItemToZoom:function(){return p.currItem.hasSize?p.currItem.img:!1},_getOffset:function(t){var n;t?n=p.currItem.img:n=p.st.zoom.opener(p.currItem.el||p.currItem);var r=n.offset(),i=parseInt(n.css("padding-top"),10),s=parseInt(n.css("padding-bottom"),10);r.top-=e(window).scrollTop()-i;var o={width:n.width(),height:(v?n.innerHeight():n[0].offsetHeight)-s-i};return R()?o["-moz-transform"]=o.transform="translate("+r.left+"px,"+r.top+"px)":(o.left=r.left,o.top=r.top),o}}});var U="iframe",z="//about:blank",W=function(e){if(p.currTemplate[U]){var t=p.currTemplate[U].find("iframe");t.length&&(e||(t[0].src=z),p.isIE8&&t.css("display",e?"block":"none"))}};e.magnificPopup.registerModule(U,{options:{markup:'
',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){p.types.push(U),x("BeforeChange",function(e,t,n){t!==n&&(t===U?W():n===U&&W(!0))}),x(t+"."+U,function(){W()})},getIframe:function(t,n){var r=t.src,i=p.st.iframe;e.each(i.patterns,function(){if(r.indexOf(this.index)>-1)return this.id&&(typeof this.id=="string"?r=r.substr(r.lastIndexOf(this.id)+this.id.length,r.length):r=this.id.call(this,r)),r=this.src.replace("%id%",r),!1});var s={};return i.srcAction&&(s[i.srcAction]=r),p._parseMarkup(n,s,t),p.updateStatus("ready"),n}}});var X=function(e){var t=p.items.length;return e>t-1?e-t:e<0?t+e:e},V=function(e,t,n){return e.replace(/%curr%/gi,t+1).replace(/%total%/gi,n)};e.magnificPopup.registerModule("gallery",{options:{enabled:!1,arrowMarkup:'
',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var n=p.st.gallery,r=".mfp-gallery",i=Boolean(e.fn.mfpFastClick);p.direction=!0;if(!n||!n.enabled)return!1;E+=" mfp-gallery",x(o+r,function(){n.navigateByImgClick&&p.wrap.on("click"+r,".mfp-img",function(){if(p.items.length>1)return p.next(),!1}),b.on("keydown"+r,function(e){e.keyCode===37?p.prev():e.keyCode===39&&p.next()})}),x("UpdateStatus"+r,function(e,t){t.text&&(t.text=V(t.text,p.currItem.index,p.items.length))}),x(s+r,function(e,t,r,i){var s=p.items.length;r.counter=s>1?V(n.tCounter,i.index,s):""}),x("BuildControls"+r,function(){if(p.items.length>1&&n.arrows&&!p.arrowLeft){var t=n.arrowMarkup,r=p.arrowLeft=e(t.replace(/%title%/gi,n.tPrev).replace(/%dir%/gi,"left")).addClass(h),s=p.arrowRight=e(t.replace(/%title%/gi,n.tNext).replace(/%dir%/gi,"right")).addClass(h),o=i?"mfpFastClick":"click";r[o](function(){p.prev()}),s[o](function(){p.next()}),p.isIE7&&(T("b",r[0],!1,!0),T("a",r[0],!1,!0),T("b",s[0],!1,!0),T("a",s[0],!1,!0)),p.container.append(r.add(s))}}),x(u+r,function(){p._preloadTimeout&&clearTimeout(p._preloadTimeout),p._preloadTimeout=setTimeout(function(){p.preloadNearbyImages(),p._preloadTimeout=null},16)}),x(t+r,function(){b.off(r),p.wrap.off("click"+r),p.arrowLeft&&i&&p.arrowLeft.add(p.arrowRight).destroyMfpFastClick(),p.arrowRight=p.arrowLeft=null})},next:function(){p.direction=!0,p.index=X(p.index+1),p.updateItemHTML()},prev:function(){p.direction=!1,p.index=X(p.index-1),p.updateItemHTML()},goTo:function(e){p.direction=e>=p.index,p.index=e,p.updateItemHTML()},preloadNearbyImages:function(){var e=p.st.gallery.preload,t=Math.min(e[0],p.items.length),n=Math.min(e[1],p.items.length),r;for(r=1;r<=(p.direction?n:t);r++)p._preloadItem(p.index+r);for(r=1;r<=(p.direction?t:n);r++)p._preloadItem(p.index-r)},_preloadItem:function(t){t=X(t);if(p.items[t].preloaded)return;var n=p.items[t];n.parsed||(n=p.parseEl(t)),N("LazyLoad",n),n.type==="image"&&(n.img=e('
![]()
').on("load.mfploader",function(){n.hasSize=!0}).on("error.mfploader",function(){n.hasSize=!0,n.loadError=!0,N("LazyLoadError",n)}).attr("src",n.src)),n.preloaded=!0}}});var $="retina";e.magnificPopup.registerModule($,{options:{replaceSrc:function(e){return e.src.replace(/\.\w+$/,function(e){return"@2x"+e})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var e=p.st.retina,t=e.ratio;t=isNaN(t)?t():t,t>1&&(x("ImageHasSize."+$,function(e,n){n.img.css({"max-width":n.img[0].naturalWidth/t,width:"100%"})}),x("ElementParse."+$,function(n,r){r.src=e.replaceSrc(r,t)}))}}}}),function(){var t=1e3,n="ontouchstart"in window,r=function(){g.off("touchmove"+s+" touchend"+s)},i="mfpFastClick",s="."+i;e.fn.mfpFastClick=function(i){return e(this).each(function(){var o=e(this),u;if(n){var a,f,l,c,h,p;o.on("touchstart"+s,function(e){c=!1,p=1,h=e.originalEvent?e.originalEvent.touches[0]:e.touches[0],f=h.clientX,l=h.clientY,g.on("touchmove"+s,function(e){h=e.originalEvent?e.originalEvent.touches:e.touches,p=h.length,h=h[0];if(Math.abs(h.clientX-f)>10||Math.abs(h.clientY-l)>10)c=!0,r()}).on("touchend"+s,function(e){r();if(c||p>1)return;u=!0,e.preventDefault(),clearTimeout(a),a=setTimeout(function(){u=!1},t),i()})})}o.on("click"+s,function(){u||i()})})},e.fn.destroyMfpFastClick=function(){e(this).off("touchstart"+s+" click"+s),n&&g.off("touchmove"+s+" touchend"+s)}}(),k()}),define("app/views/starred-file-item",["jquery","underscore","backbone","common"],function(e,t,n,r){var i=n.View.extend({tagName:"tr",template:t.template(e("#starred-file-item-tmpl").html()),events:{mouseenter:"showAction",mouseleave:"hideAction","click .unstar":"removeShare"},initialize:function(){},render:function(){var e=this.model.toJSON(),t=e.file_name;return e.is_img=r.imageCheck(t),e.encoded_path=r.encodePath(t),this.$el.html(this.template(e)),this},removeShare:function(){var t=this,n=this.model.get("repo"),i=this.model.get("file_name"),s=this.model.get("path");e.ajax({url:r.getUrl({name:"starred_files"})+"?p="+s+"&repo_id="+n,type:"DELETE",beforeSend:r.prepareCSRFToken,success:function(){t.remove(),r.feedback(gettext("Successfully unstared {placeholder}").replace("{placeholder}",r.HTMLescape(i)),"success")},error:function(t){var n;t.responseText?n=e.parseJSON(t.responseText).error:n=gettext("Failed. Please check the network."),r.feedback(n,"error")}})},showAction:function(){this.$el.addClass("hl"),this.$el.find(".op-icon").removeClass("vh")},hideAction:function(){this.$el.removeClass("hl"),this.$el.find(".op-icon").addClass("vh")}});return i}),define("app/models/starred-file",["underscore","backbone"],function(e,t){var n=t.Model.extend({});return n}),define("app/collections/starred-files",["underscore","backbone","common","app/models/starred-file"],function(e,t,n,r){var i=t.Collection.extend({model:r,url:function(){return n.getUrl({name:"starred_files"})}});return i}),define("app/views/starred-file",["jquery","underscore","backbone","common","jquery.magnific-popup","app/views/starred-file-item","app/collections/starred-files"],function(e,t,n,r,i,s,o){var u=n.View.extend({el:e("#starred-file"),initialize:function(){this.$table=this.$("table"),this.$tableBody=this.$("tbody"),this.$loadingTip=this.$(".loading-tip"),this.$emptyTip=this.$(".empty-tips"),this.starredFiles=new o,this.listenTo(this.starredFiles,"reset",this.reset),this.$el.magnificPopup({type:"image",delegate:".img-name-link",tClose:gettext("Close (Esc)"),tLoading:gettext("Loading..."),gallery:{enabled:!0,tPrev:gettext("Previous (Left arrow key)"),tNext:gettext("Next (Right arrow key)"),tCounter:gettext("%curr% of %total%")},image:{titleSrc:function(e){var t=e.el,n=t[0].innerHTML,r='
'+gettext("Open in New Tab")+"";return n+"
"+r},tError:gettext('
The image could not be loaded.')}})},addOne:function(e){var t=new s({model:e});this.$tableBody.append(t.render().el)},reset:function(){this.$tableBody.empty(),this.$loadingTip.hide(),this.starredFiles.each(this.addOne,this),this.starredFiles.length?(this.$emptyTip.hide(),this.$table.show()):(this.$emptyTip.show(),this.$table.hide())},hide:function(){this.$el.hide()},show:function(){this.$el.show(),this.$table.hide(),this.$loadingTip.show(),this.starredFiles.fetch({reset:!0})}});return u}),define("app/views/myhome-side-nav",["jquery","underscore","backbone","common"],function(e,t,n,r){var i=n.View.extend({el:"#myhome-side-nav",template:t.template(e("#myhome-side-nav-tmpl").html()),enableModTemplate:t.template(e("#myhome-mods-enable-form-tmpl").html()),initialize:function(){},render:function(t){return this.$el.html(this.template({mods_enabled:app.pageOptions.user_mods_enabled,can_add_repo:app.pageOptions.can_add_repo,events_enabled:app.pageOptions.events_enabled})),this.$el.find("li").removeClass("tab-cur"),this.$el.find("a").each(function(){if(e(this).attr("href").match(t)){e(this).parent().addClass("tab-cur");return}}),this},events:{"click #myhome-enable-mods":"enableMods"},enableMods:function(){var t=app.pageOptions.user_mods_enabled,n=e(this.enableModTemplate({mods_available:app.pageOptions.user_mods_available,mods_enabled:t}));n.modal(),e("#simplemodal-container").css("height","auto"),e(".checkbox-orig",n).click(function(){e(this).parent().toggleClass("checkbox-checked")});var i=e('[name="personal_wiki"]'),s=i.prop("checked"),o=this;n.submit(function(){var u=i.prop("checked");return u==s?!1:(r.ajaxPost({form:n,form_id:n.attr("id"),post_url:r.getUrl({name:"toggle_personal_modules"}),post_data:{personal_wiki:u},after_op_success:function(){if(u)t.push("personal wiki");else{var n=t.indexOf("personal wiki");n>-1&&t.splice(n,1)}e.modal.close(),o.render()}}),!1)})},show:function(e){this.render(e),this.$el.show()},hide:function(){this.$el.hide()}});return i}),define("app/views/myhome",["jquery","underscore","backbone","common","app/views/myhome-repos","app/views/myhome-sub-repos","app/views/myhome-shared-repos","app/views/starred-file","app/views/myhome-side-nav"],function(e,t,n,r,i,s,o,u,a){var f=n.View.extend({el:"#main",initialize:function(t){this.sideNavView=new a,this.reposView=new i,this.subReposView=new s,this.sharedReposView=new o,this.starredFileView=new u,this.dirView=t.dirView,this.currentView=this.reposView,e("#initial-loading-view").hide()},showMyRepos:function(){this.sideNavView.show("my-libs"),this.currentView.hide(),this.reposView.show(),this.currentView=this.reposView},showMySubRepos:function(){this.sideNavView.show("my-libs"),this.currentView.hide(),this.subReposView.show(),this.currentView=this.subReposView},showSharedRepos:function(){this.sideNavView.show("my-libs"),this.currentView.hide(),this.sharedReposView.show(),this.currentView=this.sharedReposView},showStarredFile:function(){this.sideNavView.show("starred"),this.currentView.hide(),this.starredFileView.show(),this.currentView=this.starredFileView},showDir:function(e,t,n){this.sideNavView.show("my-libs");var n=n||"/";this.currentView.hide(),this.dirView.showDir(e,t,n),this.currentView=this.dirView},hide:function(){this.currentView.hide(),this.sideNavView.hide()}});return f}),define("app/models/group-repo",["underscore","backbone","app/models/repo"],function(e,t,n){var r=n.extend({defaults:{permission:"r"}});return e.extend(r.prototype.defaults,n.prototype.defaults),r}),define("app/collections/group-repos",["underscore","backbone","common","app/models/group-repo"],function(e,t,n,r){var i=t.Collection.extend({model:r,comparator:0/0,url:function(){return n.getUrl({name:"group_repos",group_id:this.group_id})+"?from=web"},parse:function(e){return this.is_staff=e.is_staff,e.repos},setGroupID:function(e){this.group_id=e}});return i}),define("app/views/group-repo",["jquery","underscore","backbone","common"],function(e,t,n,r){var i=n.View.extend({tagName:"tr",template:t.template(e("#group-repo-tmpl").html()),events:{mouseenter:"highlight",mouseleave:"rmHighlight","click .cancel-share":"unshare"},initialize:function(e){this.group_id=e.group_id,this.is_staff=e.is_staff,this.listenTo(this.model,"destroy",this.remove)},render:function(){var t=this.model.toJSON();return e.extend(t,{group_id:this.group_id,is_staff:this.is_staff}),this.$el.html(this.template(t)),this},highlight:function(){this.$el.addClass("hl").find(".op-icon").removeClass("vh")},rmHighlight:function(){this.$el.removeClass("hl").find(".op-icon").addClass("vh")},unshare:function(){var t=this.model.get("name");this.model.destroy({wait:!0,success:function(){var e=gettext("Successfully unshared {placeholder}").replace("{placeholder}",'
'+r.HTMLescape(t)+"");r.feedback(e,"success",r.SUCCESS_TIMOUT)},error:function(t,n){var i;n.responseText?i=e.parseJSON(n.responseText).error_msg:i=gettext("Failed. Please check the network."),r.feedback(i,"error")}})}});return i}),define("app/views/add-group-repo",["jquery","simplemodal","underscore","backbone","common","app/views/add-repo"],function(e,t,n,r,i,s){var o=s.extend({templateData:function(){return{showSharePerm:!0}},newAttributes:function(){var t=s.prototype.newAttributes.apply(this);return n.extend(t,{permission:e("select[name=permission]",this.$el).val()})}});return o}),define("app/views/group-side-nav",["jquery","underscore","backbone","common"],function(e,t,n,r){var i=n.View.extend({el:"#group-side-nav",template:t.template(e("#group-side-nav-tmpl").html()),enableModTemplate:t.template(e("#group-mods-enable-form-tmpl").html()),initialize:function(){},render:function(t){this.group_id=t;var n=this;e.ajax({url:r.getUrl({name:"group_basic_info",group_id:this.group_id}),cache:!1,dataType:"json",success:function(e){n.$el.html(n.template(e)),n.mods_available=e.mods_available,n.mods_enabled=e.mods_enabled},error:function(t){var r;t.responseText?r=e.parseJSON(t.responseText).error:r=gettext("Please check the network."),n.$el.html('
'+r+"
")}})},events:{"click #enable-mods":"enableMods"},enableMods:function(){var t=e(this.enableModTemplate({mods_available:this.mods_available,mods_enabled:this.mods_enabled}));t.modal(),e("#simplemodal-container").css("height","auto"),e(".checkbox-orig",t).click(function(){e(this).parent().toggleClass("checkbox-checked")});var n=e('[name="group_wiki"]'),i=n.prop("checked"),s=this;t.submit(function(){var o=n.prop("checked");return o==i?!1:(r.ajaxPost({form:t,form_id:t.attr("id"),post_url:r.getUrl({name:"toggle_group_modules",group_id:s.group_id}),post_data:{group_wiki:o},after_op_success:function(){e.modal.close(),s.render(s.group_id)}}),!1)})},show:function(){this.$el.show()},hide:function(){this.$el.hide()}});return i}),define("app/views/group",["jquery","underscore","backbone","common","app/collections/group-repos","app/views/group-repo","app/views/add-group-repo","app/views/group-side-nav"],function(e,t,n,r,i,s,o,u){var a=n.View.extend({el:"#main",events:{"click #group-repo-tabs .repo-create":"createRepo","click #grp-repos .by-name":"sortByName","click #grp-repos .by-time":"sortByTime"},initialize:function(t){this.$tabs=this.$("#group-repo-tabs"),this.$table=this.$("#grp-repos table",this.$tabs),this.$tableHead=e("thead",this.$table),this.$tableBody=e("tbody",this.$table),this.$loadingTip=e(".loading-tip",this.$tabs),this.$emptyTip=e(".empty-tips",this.$tabs),this.sideNavView=new u,this.repos=new i,this.listenTo(this.repos,"add",this.addOne),this.listenTo(this.repos,"reset",this.reset),this.dirView=t.dirView},addOne:function(e,t,n){var r=new s({model:e,group_id:this.group_id,is_staff:this.repos.is_staff});n.prepend?this.$tableBody.prepend(r.render().el):this.$tableBody.append(r.render().el)},reset:function(){this.$tableBody.empty(),this.repos.each(this.addOne,this),this.$loadingTip.hide(),this.repos.length?(this.$emptyTip.hide(),this.$table.show()):(this.$emptyTip.show(),this.$table.hide())},showSideNav:function(){var e=this.sideNavView;if(e.group_id&&e.group_id==this.group_id){e.show();return}e.render(this.group_id),e.show()},showRepoList:function(e){this.group_id=e,this.showSideNav(),this.dirView.hide(),this.$emptyTip.hide(),this.$tabs.show(),this.$table.hide(),this.repos.setGroupID(e),this.repos.fetch({reset:!0}),this.$loadingTip.show()},hideRepoList:function(){this.$tabs.hide()},showDir:function(e,t,n){this.group_id=e,this.showSideNav(),this.hideRepoList(),this.dirView.showDir("group/"+this.group_id,t,n)},createRepo:function(){new o(this.repos)},sortByName:function(){var t=this.repos,n=e(".by-name",this.$table);t.comparator=function(e,t){var i=r.compareTwoWord(e.get("name"),t.get("name"));return n.hasClass("icon-caret-up")?-i:i},t.sort(),this.$tableBody.empty(),t.each(this.addOne,this),n.toggleClass("icon-caret-up icon-caret-down")},sortByTime:function(){var t=this.repos,n=e(".by-time",this.$table);t.comparator=function(e,t){return n.hasClass("icon-caret-down")?e.get("mtime")
'+r.HTMLescape(t)+"");r.feedback(n,"success",r.SUCCESS_TIMOUT)},after_op_error:function(e){r.ajaxErrorHandler(e)}})}});return i}),define("app/views/add-pub-repo",["jquery","simplemodal","underscore","backbone","common","app/views/add-repo"],function(e,t,n,r,i,s){var o=s.extend({templateData:function(){return{showSharePerm:!0}},newAttributes:function(){var t=s.prototype.newAttributes.apply(this);return n.extend(t,{permission:e("select[name=permission]",this.$el).val()})}});return o}),define("app/views/organization",["jquery","underscore","backbone","common","app/collections/pub-repos","app/views/organization-repo","app/views/add-pub-repo"],function(e,t,n,r,i,s,o){var u=n.View.extend({el:"#main",initialize:function(t){this.$sideNav=e("#org-side-nav"),this.$reposDiv=e("#organization-repos"),this.$table=e("#organization-repos table"),this.$tableBody=e("tbody",this.$table),this.$loadingTip=e("#organization-repos .loading-tip"),this.$emptyTip=e("#organization-repos .empty-tips"),this.repos=new i,this.listenTo(this.repos,"add",this.addOne),this.listenTo(this.repos,"reset",this.reset),this.dirView=t.dirView},events:{"click #organization-repos .repo-create":"createRepo","click #organization-repos .by-name":"sortByName","click #organization-repos .by-time":"sortByTime"},createRepo:function(){new o(this.repos)},addOne:function(e,t,n){var r=new s({model:e,collection:this.repos});n.prepend?this.$tableBody.prepend(r.render().el):this.$tableBody.append(r.render().el)},reset:function(){this.$tableBody.empty(),this.repos.each(this.addOne,this),this.repos.length?(this.$emptyTip.hide(),this.$table.show()):(this.$emptyTip.show(),this.$table.hide()),this.$loadingTip.hide()},showRepoList:function(){this.$sideNav.show(),this.dirView.hide(),this.$reposDiv.show(),this.repos.fetch({reset:!0}),this.$loadingTip.show()},hideRepoList:function(){this.$reposDiv.hide()},showDir:function(e,t){this.$sideNav.show();var t=t||"/";this.hideRepoList(),this.dirView.showDir("org",e,t)},sortByName:function(){var t=this.repos,n=e(".by-name",this.$table);t.comparator=function(e,t){var i=r.compareTwoWord(e.get("name"),t.get("name"));return n.hasClass("icon-caret-up")?-i:i},t.sort(),this.$tableBody.empty(),t.each(this.addOne,this),n.toggleClass("icon-caret-up icon-caret-down")},sortByTime:function(){var t=this.repos,n=e(".by-time",this.$table);t.comparator=function(e,t){return n.hasClass("icon-caret-down")?e.get("mtime")=0)&&t(n,!i)}}),e("").outerWidth(1).jquery||e.each(["Width","Height"],function(t,n){function o(t,n,i,s){return e.each(r,function(){n-=parseFloat(e.css(t,"padding"+this))||0,i&&(n-=parseFloat(e.css(t,"border"+this+"Width"))||0),s&&(n-=parseFloat(e.css(t,"margin"+this))||0)}),n}var r=n==="Width"?["Left","Right"]:["Top","Bottom"],i=n.toLowerCase(),s={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+n]=function(t){return t===undefined?s["inner"+n].call(this):this.each(function(){e(this).css(i,o(this,t)+"px")})},e.fn["outer"+n]=function(t,r){return typeof t!="number"?s["outer"+n].call(this,t):this.each(function(){e(this).css(i,o(this,t,!0,r)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}),e("").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(n){return arguments.length?t.call(this,e.camelCase(n)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.fn.extend({focus:function(t){return function(n,r){return typeof n=="number"?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),r&&r.call(t)},n)}):t.apply(this,arguments)}}(e.fn.focus),disableSelection:function(){var e="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.bind(e+".ui-disableSelection",function(e){e.preventDefault()})}}(),enableSelection:function(){return this.unbind(".ui-disableSelection")},zIndex:function(t){if(t!==undefined)return this.css("zIndex",t);if(this.length){var n=e(this[0]),r,i;while(n.length&&n[0]!==document){r=n.css("position");if(r==="absolute"||r==="relative"||r==="fixed"){i=parseInt(n.css("zIndex"),10);if(!isNaN(i)&&i!==0)return i}n=n.parent()}}return 0}}),e.ui.plugin={add:function(t,n,r){var i,s=e.ui[t].prototype;for(i in r)s.plugins[i]=s.plugins[i]||[],s.plugins[i].push([n,r[i]])},call:function(e,t,n,r){var i,s=e.plugins[t];if(!s)return;if(!r&&(!e.element[0].parentNode||e.element[0].parentNode.nodeType===11))return;for(i=0;i",options:{disabled:!1,create:null},_createWidget:function(n,r){r=e(r||this.defaultElement||this)[0],this.element=e(r),this.uuid=t++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=e.widget.extend({},this.options,this._getCreateOptions(),n),this.bindings=e(),this.hoverable=e(),this.focusable=e(),r!==this&&(e.data(r,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===r&&this.destroy()}}),this.document=e(r.style?r.ownerDocument:r.document||r),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(t,n){var r=t,i,s,o;if(arguments.length===0)return e.widget.extend({},this.options);if(typeof t=="string"){r={},i=t.split("."),t=i.shift();if(i.length){s=r[t]=e.widget.extend({},this.options[t]);for(o=0;o ").appendTo(this.element),this._refreshValue()},_destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove()},value:function(e){if(e===undefined)return this.options.value;this.options.value=this._constrainedValue(e),this._refreshValue()},_constrainedValue:function(e){return e===undefined&&(e=this.options.value),this.indeterminate=e===!1,typeof e!="number"&&(e=0),this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,e))},_setOptions:function(e){var t=e.value;delete e.value,this._super(e),this.options.value=this._constrainedValue(t),this._refreshValue()},_setOption:function(e,t){e==="max"&&(t=Math.max(this.min,t)),e==="disabled"&&this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this._super(e,t)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var t=this.options.value,n=this._percentage();this.valueDiv.toggle(this.indeterminate||t>this.min).toggleClass("ui-corner-right",t===this.options.max).width(n.toFixed(0)+"%"),this.element.toggleClass("ui-progressbar-indeterminate",this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=e("