$(document).ready(function(){$("#logout").click(function(a){returna.preventDefault(),$.ajax({type:"GET",url:"/admin",async:!1,username:"username",password:"password",headers:{Authorization:"Basic xxx"}}).fail(function(){window.location="/"}),!1}),$(document).pjax("a[data-pjax]","#content")}),$(document).on("ready pjax:end",function(){functiona(){this.style.height="5px",this.style.height=this.scrollHeight+"px"}return$("#content").off(),document.title=document.getElementById("site-title").innerHTML,$("textarea").each(a),$("textarea").keyup(a),$(window).resize(function(){$("textarea").each(a)}),$("main").hasClass("browse")&&$(document).trigger("page:browse"),$(".editor")[0]&&$(document).trigger("page:editor"),!1}),$(document).on("page:browse",function(){vara="#foreground",b=newObject;b.selector="form#delete",b.form=$(b.selector),b.row="",b.button="",b.url="",$("#content").on("click",".delete",function(c){returnc.preventDefault(),b.button=$(this),b.row=$(this).parent().parent(),$(a).fadeIn(200),b.url=b.row.find(".filename").text(),b.form.find("span").text(b.url),b.form.fadeIn(200),!1}),$("#content").on("submit",b.selector,function(c){returnc.preventDefault(),$.ajax({type:"DELETE",url:b.button.data("file")}).done(function(c){$(a).fadeOut(200),b.form.fadeOut(200),b.row.fadeOut(200),notification({text:b.button.data("message"),type:"success",timeout:5e3})}).fail(function(a){notification({text:"Something went wrong.",type:"error"}),console.log(a)}),!1}),$("#content").on("change",'input[type="file"]',function(a){a.preventDefault(),files=a.target.files;varb=newFormData;return$.each(files,function(a,c){b.append(a,c)}),$.ajax({url:window.location.pathname,type:"POST",data:b,cache:!1,dataType:"json",headers:{"X-Upload":"true"},processData:!1,contentType:!1}).done(function(a){notification({text:"File(s) uploaded successfully.",type:"success",timeout:5e3}),$.pjax({url:window.location.pathname,container:"#content"})}).fail(function(a){notification({text:"Something went wrong.",type:"error"}),console.log(a)}),!1}),$("#content").on("click","#upload",function(a){returna.preventDefault(),$('.actions input[type="file"]').click(),!1});varc=newObject;c.selector="form#new",c.form=$(c.selector),c.input=c.selector+' input[type="text"]',c.button="",c.url="",$("#content").on("click",".new",function(b){returnb.preventDefault(),c.button=$(this),$(a).fadeIn(200),c.form.fadeIn(200),!1}),$("#content").on("keypress",c.input,function(a){return13==a.keyCode?(a.preventDefault(),$(c.form).submit(),!1):void0}),$("#content").on("submit",c.selector,function(a){a.preventDefault();varb=c.form.find('input[type="text"]').val(),d=b.split(":"),e="",f="";if(""==b)returnnotification({text:"You have to write something. If you want to close the box, click the button again.",type:"warning",timeout:5e3}),!1;if(1==d.length)e=b;else{if(2!=d.length)returnnotification({text:"Hmm... I don't understand you. Try writing something like 'name[:archetype]'.",type:"error"}),!1;e=d[0],f=d[1]}varg='{"filename": "'+e+'", "archetype": "'+f+'"}';return$.ajax({type:"POST",url:window.location.pathname,data:g,dataType:"json",encode:!0}).done(function(a){notification({text:"File created successfully.",type:"success",timeout:5e3}),$.pjax({url:window.location.pathname.replace("browse","edit")+e,container:"#content"})}).fail(function(a){notification({text:"Something went wrong.",type:"error"}),console.log(a)}),!1});vard=newObject;d.selector="form#rename",d.form=$(d.selector),d.input=d.selector+' input[type="text"]',d.button="",d.url="",$("#content").on("click",".rename",function(b){returnb.preventDefault(),d.button=$(this),$(a).fadeIn(200),d.url=$(this).parent().parent().find(".filename").text(),d.form.fadeIn(200),d.form.find("span").text(d.url),d.form.find('input[type="text"]').val(d.url),!1}),$("#content").on("keypress",d.input,function(a){return13==a.keyCode?(a.preventDefault(),$(d.form).submit(),!1):void0}),$("#content").on("submit",d.selector,function(a){a.preventDefault();varb=d.form.find('input[type="text"]').val();if(""===b)return!1;"/"!=b.substring(0,1)&&(b=wi