functionTabs(e){functiont(e){console.log("hide",e),e.removeClass("js-tab-nav-show"),$(e.data("tab-target")).removeClass("js-tab-show").hide()}functionn(e){console.log("show",e),e.addClass("js-tab-nav-show"),$(e.data("tab-target")).addClass("js-tab-show").show()}varr=$(e);if(r.length){vari=r.find(".js-tab-nav-show");i.length&&$(i.data("tab-target")).addClass("js-tab-show"),r.on("click",".js-tab-nav",function(){vare=$(this);e.hasClass("js-tab-nav-show")||(i=r.find(".js-tab-nav-show").eq(0),t(i),n(e))}),console.log("init tabs @",e)}}functioninitCore(){Gogs.renderMarkdown(),Gogs.renderCodeView(),$(".js-tab-nav").click(function(e){$(this).hasClass("js-tab-nav-show")||($(this).parent().find(".js-tab-nav-show").each(function(){$(this).removeClass("js-tab-nav-show"),$($(this).data("tab-target")).hide()}),$(this).addClass("js-tab-nav-show"),$($(this).data("tab-target")).show())})}functioninitUserSetting(){$("#user-profile-form").submit(function(e){vart=$("#username");returnt.data("uname")==t.val()||confirm("Username has been changed, do you want to continue?")?void0:(e.preventDefault(),!0)}),$("#ssh-add").click(function(){$("#user-ssh-add-form").removeClass("hide")}),$("#delete-account-button").click(function(e){returnconfirm("This account is going to be deleted, do you want to continue?")?void0:(e.preventDefault(),!0)})}functioninitRepoCreate(){$("#repo-create-owner-list").on("click","li",function(){if(!$(this).hasClass("checked")){vare=$(this).data("uid");$("#repo-owner-id").val(e),$("#repo-owner-avatar").attr("src",$(this).find("img").attr("src")),$("#repo-owner-name").text($(this).text().trim()),$(this).parent().find(".checked").removeClass("checked"),$(this).addClass("checked"),console.log("set repo owner to uid :",e,$(this).text().trim())}}),$("#auth-button").click(function(e){$("#repo-migrate-auth").slideToggle("fast"),e.preventDefault()}),console.log("initRepoCreate")}functioninitRepo(){$("#repo-clone-ssh").click(function(){$(this).removeClass("btn-gray").addClass("btn-blue"),$("#repo-clone-https").removeClass("btn-blue").addClass("btn-gray"),$("#repo-clone-url").val($(this).data("link")),$(".clone-url").text($(this).data("link"))}),$("#repo-clone-https").click(function(){$(this).removeClass("btn-gray").addClass("btn-blue"),$("#repo-clone-ssh").removeClass("btn-blue").addClass("btn-gray"),$("#repo-clone-url").val($(this).data("link")),$(".clone-url").text($(this).data("link"))});vare=$("#repo-clone-copy");e.hover(function(){Gogs.bindCopy($(this))}),e.tipsy({fade:!0})}functioninitHookTypeChange(){$("select#hook-type").on("change",function(){hookTypes=["Gogs","Slack"];vare=$(this).val();hookTypes.forEach(function(t){e===t?$("div#"+t.toLowerCase()).toggleShow():$("div#"+t.toLowerCase()).toggleHide()})})}functioninitRepoSetting(){$("#repo-setting-form").submit(function(e){vart=$("#repo_name");returnt.data("repo-name")==t.val()||confirm("Repository name has been changed, do you want to continue?")?void0:(e.preventDefault(),!0)}),initHookTypeChange(),$("#transfer-button").click(function(){$("#transfer-form").show()}),$("#delete-button").click(function(){$("#delete-form").show()}),$("#repo-collab-list hr:last-child").remove();vare=$("#repo-collaborator").next().next().find("ul");$("#repo-collaborator").on("keyup",function(){vart=$(this);returnt.val()?voidGogs.searchUsers(t.val(),e):voide.toggleHide()}).on("focus",function(){$(this).val()?e.toggleShow():e.toggleHide()}).next().next().find("ul").on("click","li",function(){$("#repo-collaborator").val($(this).text()),e.toggleHide()})}functioninitOrgSetting(){$("#org-setting-form").submit(function(e){vart=$("#orgname");returnt.data("orgname")==t.val()||confirm("Organization name has been changed, do you want to continue?")?void0:(e.preventDefault(),!0)}),$("#delete-org-button").click(function(e){returnconfirm("This organization is going to be deleted, do you want to continue?")?void0:(e.preventDefault(),!0)}),initHookTypeChange()}functioninitInvite(){vare=$("#org-member-invite-list");$("#org-member-invite").on("keyup",function(){vart=$(this);retu
};varZn=/%20/g,Gn=/\[\]$/,Vn=/\r?\n/g,Qn=/^(?:submit|button|image|reset|file)$/i,Yn=/^(?:input|select|textarea|keygen)/i;ot.param=function(e,t){varn,r=[],i=function(e,t){t=ot.isFunction(t)?t():null==t?"":t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(void0===t&&(t=ot.ajaxSettings&&ot.ajaxSettings.traditional),ot.isArray(e)||e.jquery&&!ot.isPlainObject(e))ot.each(e,function(){i(this.name,this.value)});elsefor(nine)U(n,e[n],t,i);returnr.join("&").replace(Zn,"+")},ot.fn.extend({serialize:function(){returnot.param(this.serializeArray())},serializeArray:function(){returnthis.map(function(){vare=ot.prop(this,"elements");returne?ot.makeArray(e):this}).filter(function(){vare=this.type;returnthis.name&&!ot(this).is(":disabled")&&Yn.test(this.nodeName)&&!Qn.test(e)&&(this.checked||!jt.test(e))}).map(function(e,t){varn=ot(this).val();returnnull==n?null:ot.isArray(n)?ot.map(n,function(e){return{name:t.name,value:e.replace(Vn,"\r\n")}}):{name:t.name,value:n.replace(Vn,"\r\n")}}).get()}}),ot.ajaxSettings.xhr=void0!==e.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&X()||Z()}:X;varKn=0,Jn={},er=ot.ajaxSettings.xhr();e.ActiveXObject&&ot(e).on("unload",function(){for(vareinJn)Jn[e](void0,!0)}),rt.cors=!!er&&"withCredentials"iner,er=rt.ajax=!!er,er&&ot.ajaxTransport(function(e){if(!e.crossDomain||rt.cors){vart;return{send:function(n,r){vari,o=e.xhr(),a=++Kn;if(o.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(iine.xhrFields)o[i]=e.xhrFields[i];e.mimeType&&o.overrideMimeType&&o.overrideMimeType(e.mimeType),e.crossDomain||n["X-Requested-With"]||(n["X-Requested-With"]="XMLHttpRequest");for(iinn)void0!==n[i]&&o.setRequestHeader(i,n[i]+"");o.send(e.hasContent&&e.data||null),t=function(n,i){vars,l,c;if(t&&(i||4===o.readyState))if(deleteJn[a],t=void0,o.onreadystatechange=ot.noop,i)4!==o.readyState&&o.abort();else{c={},s=o.status,"string"==typeofo.responseText&&(c.text=o.responseText);try{l=o.statusText}catch(u){l=""}s||!e.isLocal||e.crossDomain?1223===s&&(s=204):s=c.text?200:404}c&&r(s,l,c,o.getAllResponseHeaders())},e.async?4===o.readyState?setTimeout(t):o.onreadystatechange=Jn[a]=t:t()},abort:function(){t&&t(void0,!0)}}}}),ot.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){returnot.globalEval(e),e}}}),ot.ajaxPrefilter("script",function(e){void0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),ot.ajaxTransport("script",function(e){if(e.crossDomain){vart,n=mt.head||ot("head")[0]||mt.documentElement;return{send:function(r,i){t=mt.createElement("script"),t.async=!0,e.scriptCharset&&(t.charset=e.scriptCharset),t.src=e.url,t.onload=t.onreadystatechange=function(e,n){(n||!t.readyState||/loaded|complete/.test(t.readyState))&&(t.onload=t.onreadystatechange=null,t.parentNode&&t.parentNode.removeChild(t),t=null,n||i(200,"success"))},n.insertBefore(t,n.firstChild)},abort:function(){t&&t.onload(void0,!0)}}}});vartr=[],nr=/(=)\?(?=&|$)|\?\?/;ot.ajaxSetup({jsonp:"callback",jsonpCallback:function(){vare=tr.pop()||ot.expando+"_"+jn++;returnthis[e]=!0,e}}),ot.ajaxPrefilter("json jsonp",function(t,n,r){vari,o,a,s=t.jsonp!==!1&&(nr.test(t.url)?"url":"string"==typeoft.data&&!(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&nr.test(t.data)&&"data");returns||"jsonp"===t.dataTypes[0]?(i=t.jsonpCallback=ot.isFunction(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,s?t[s]=t[s].replace(nr,"$1"+i):t.jsonp!==!1&&(t.url+=(Dn.test(t.url)?"&":"?")+t.jsonp+"="+i),t.converters["script json"]=function(){returna||ot.error(i+" was not called"),a[0]},t.dataTypes[0]="json",o=e[i],e[i]=function(){a=arguments},r.always(function(){e[i]=o,t[i]&&(t.jsonpCallback=n.jsonpCallback,tr.push(i)),a&&ot.isFunction(o)&&o(a[0]),a=o=void0}),"script"):void0}),ot.parseHTML=function(e,t,n){if(!e||"string"!=typeofe)returnnull;"boolean"==typeoft&&(n=t,t=!1),t=t||mt;varr=ft.exe