album={json:null,getID:function(){vare;if(photo.json)e=photo.json.album;elseif(album.json)e=album.json.id;elsee=$(".album:hover, .album.active").attr("data-id");if(!e)e=$(".photo:hover, .photo.active").attr("data-album-id");if(e)returne;elsereturnfalse},load:function(e,t){varn,r,i,s,o="";password.get(e,function(){if(!t){loadingBar.show();lychee.animate(".album, .photo","contentZoomOut");lychee.animate(".divider","fadeOut")}n=(newDate).getTime();r="getAlbum&albumID="+e+"&password="+password.value;lychee.api(r,"json",function(r){if(r=="HTTP/1.1 403 Album private!"){lychee.setMode("view");returnfalse}if(r=="HTTP/1.1 403 Wrong password!"){album.load(e,t);returnfalse}album.json=r;i=(newDate).getTime()-n;if(i>300)s=0;elseif(t)s=0;elses=300-i;if(!visible.albums()&&!visible.photo()&&!visible.album())s=0;setTimeout(function(){view.album.init();if(!t){lychee.animate(".album, .photo","contentZoomIn");view.header.mode("album")}},s)})})},parse:function(e){if(e&&e.thumbUrl)e.thumbUrl=lychee.upload_path_thumb+e.thumbUrl;elseif(!album.json.title)album.json.title="Untitled"},add:function(){vare=prompt("Please enter a title for this album:","Untitled"),t;if(e.length>0&&e.length<31){modal.close();t="addAlbum&title="+escape(encodeURI(e));lychee.api(t,"text",function(e){if(e)lychee.goto("a"+e);elseloadingBar.show("error")})}elseif(e.length>0)loadingBar.show("error","Error","Title to short or too long. Please try another one!")},"delete":function(e){vart,n,r;n=[["Delete Album and Photos",function(){t="deleteAlbum&albumID="+e+"&delAll=true";lychee.api(t,"text",function(t){if(visible.albums())view.albums.content.delete(e);elselychee.goto("");if(!t)loadingBar.show("error")})}],["Keep Album",function(){}]];if(e==0){n[0][0]="Clear Unsorted";modal.show("Clear Unsorted","Are you sure you want to delete all photos from 'Unsorted'?<br>This action can't be undone!",n)}else{if(album.json)r=album.json.title;elseif(albums.json)r=albums.json.content[e].title;modal.show("Delete Album","Are you sure you want to delete the album '"+r+"' and all of the photos it contains? This action can't be undone!",n)}},setTitle:function(e){vart="",n,r;if(!e)e=album.getID();if(album.json)t=album.json.title;elseif(albums.json)t=albums.json.content[e].title;n=prompt("Please enter a new title for this album:",t);if(e!=""&&e!=null&&e&&n.length>0&&n.length<31){if(visible.album()){album.json.title=n;view.album.title()}elseif(visible.albums()){albums.json.content[e].title=n;view.albums.content.title(e)}r="setAlbumTitle&albumID="+e+"&title="+escape(encodeURI(n));lychee.api(r,"text",function(e){if(!e)loadingBar.show("error")})}elseif(n.length>0)loadingBar.show("error","Error","New title to short or too long. Please try another one!")},setPublic:function(e,t){varn;if($("input.password").length>0&&$("input.password").val().length>0){n="setAlbumPublic&albumID="+e+"&password="+hex_md5($("input.password").val());album.json.password=true}else{n="setAlbumPublic&albumID="+e;album.json.password=false}if(visible.album()){album.json.public=album.json.public==0?1:0;view.album.public();if(album.json.public==1)contextMenu.shareAlbum(e,t)}lychee.api(n,"text",function(e){if(!e)loadingBar.show("error")})},share:function(e){vart="",n=location.href;switch(e){case0:t="https://twitter.com/share?url="+encodeURI(n);break;case1:t="http://www.facebook.com/sharer.php?u="+encodeURI(n)+"&t="+encodeURI(album.json.title);break;case2:t="mailto:?subject="+encodeURI(album.json.title)+"&body="+encodeURI("Hi! Check this out: "+n);break;default:t="";break}if(t.length>5)location.href=t},getArchive:function(e){vart;if(location.href.indexOf("index.html")>0)t=location.href.replace(location.hash,"").replace("index.html","php/api.php?function=getAlbumArchive&albumID="+e);elset=location.href.replace(location.hash,"")+"php/api.php?function=getAlbumArchive&albumID="+e;location.href=t}};albums={json:null,load:function(){vare,t,n,r,i,s="",o="";lychee.animate(".album, .photo","contentZoomOut");lychee.animate(".divider","fadeOut");e=(newDate).getTime();lychee.api("getAlbums","json",function(n){n.u