});$("#button_share_album").on(event_name,function(e){if(album.json.public==1)contextMenu.shareAlbum(album.getID(),e);elsemodal.show("Share Album","All photos inside this album will be public and visible for everyone. Existing public photos will have the same sharing permission as this album. Are your sure you want to share this album? <input class='text' type='password' placeholder='password (optional)' value=''>",[["Share Album",function(){album.setPublic(album.getID(),e)}],["Cancel",function(){}]])});$("#button_more").on(event_name,function(e){contextMenu.photoMore(photo.getID(),e)});$("#button_trash_album").on(event_name,function(){album.delete([album.getID()])});$("#button_move").on(event_name,function(e){contextMenu.move([photo.getID()],e)});$("#button_trash").on(event_name,function(){photo.delete([photo.getID()])});$("#button_info_album").on(event_name,function(){view.infobox.show()});$("#button_info").on(event_name,function(){view.infobox.show()});$("#button_archive").on(event_name,function(){album.getArchive(album.getID())});$("#button_star").on(event_name,function(){photo.setStar([photo.getID()])});$("#search").on("keyup click",function(){search.find($(this).val())});$("#clearSearch").on(event_name,function(){$("#search").focus();search.reset()});$("#button_back_home").on(event_name,function(){lychee.goto("")});$("#button_back").on(event_name,function(){lychee.goto(album.getID())});lychee.imageview.on(event_name,".arrow_wrapper.previous",photo.previous).on(event_name,".arrow_wrapper.next",photo.next);$("#infobox").on(event_name,".header a",function(){view.infobox.hide()}).on(event_name,"#edit_title_album",function(){album.setTitle([album.getID()])}).on(event_name,"#edit_description_album",function(){album.setDescription(album.getID())}).on(event_name,"#edit_title",function(){photo.setTitle([photo.getID()])}).on(event_name,"#edit_description",function(){photo.setDescription(photo.getID())}).on(event_name,"#edit_tags",function(){photo.editTags([photo.getID()])}).on(event_name,"#tags .tag span",function(){photo.deleteTag(photo.getID(),$(this).data("index"))});Mousetrap.bind("left",function(){if(visible.photo())$("#imageview a#previous").click()}).bind("right",function(){if(visible.photo())$("#imageview a#next").click()}).bind(["u","ctrl+u"],function(){$("#upload_files").click()}).bind(["s","ctrl+s"],function(){if(visible.photo())$("#button_star").click()}).bind(["r","ctrl+r"],function(e){e.preventDefault();if(visible.album())album.setTitle(album.getID());elseif(visible.photo())photo.setTitle([photo.getID()])}).bind(["d","ctrl+d"],function(e){e.preventDefault();if(visible.photo())photo.setDescription(photo.getID());elseif(visible.album())album.setDescription(album.getID())}).bind(["t","ctrl+t"],function(e){if(visible.photo()){e.preventDefault();photo.editTags([photo.getID()])}}).bind(["i","ctrl+i"],function(){if(visible.infobox())view.infobox.hide();elseif(!visible.albums())view.infobox.show()}).bind(["command+backspace","ctrl+backspace"],function(){if(visible.photo()&&!visible.message())photo.delete([photo.getID()]);elseif(visible.album()&&!visible.message())album.delete([album.getID()])});Mousetrap.bindGlobal("enter",function(){if($(".message .button.active").length)$(".message .button.active").addClass("pressed").click()});Mousetrap.bindGlobal(["esc","command+up"],function(e){e.preventDefault();if(visible.message()&&$(".message .close").length>0)modal.close();elseif(visible.contextMenu())contextMenu.close();elseif(visible.infobox())view.infobox.hide();elseif(visible.photo())lychee.goto(album.getID());elseif(visible.album())lychee.goto("");elseif(visible.albums()&&$("#search").val().length!==0)search.reset()});if(mobileBrowser()){$(document).on("touchend","#image",function(e){if(swipe.obj===null||swipe.offset>=-5&&swipe.offset<=5){if(visible.controls())view.header.hide(e,0);elseview.header.show()}}).swipe().on("swipeStart",function(){swipe.start($("#image"))}).swipe().on("swipeMove",function(e){swipe.move(e.swipe)}).swipe().on("swipeEnd",function(e){swipe.stop(e.swipe,photo.previous,photo.next)})}$(do
returnfalse},400)}else{params="setLogin&username="+escape(username)+"&password="+hex_md5(password);lychee.api(params,function(data){if(data!==true){setTimeout(function(){buttons=[["Retry",function(){setTimeout(settings.createLogin,400)}],["",function(){}]];modal.show("Creation Failed","Unable to save login. Please try again with another username and password!",buttons,null,false);returnfalse},400)}})}}],["",function(){}]];modal.show("Create Login","Enter a username and password for your installation: <input id='username' class='text less' type='text' placeholder='New Username' value=''><input id='password' class='text' type='password' placeholder='New Password' value=''>",buttons,-122,false)},setLogin:function(){varold_password,username,password,params,buttons;buttons=[["Change Login",function(){old_password=$(".message input.text#old_password").val();username=$(".message input.text#username").val();password=$(".message input.text#password").val();if(old_password.length<1){loadingBar.show("error","Your old password was entered incorrectly. Please try again!");returnfalse}if(username.length<1){loadingBar.show("error","Your new username was entered incorrectly. Please try again!");returnfalse}if(password.length<1){loadingBar.show("error","Your new password was entered incorrectly. Please try again!");returnfalse}params="setLogin&oldPassword="+hex_md5(old_password)+"&username="+escape(username)+"&password="+hex_md5(password);lychee.api(params,function(data){if(data!==true)lychee.error(null,params,data)})}],["Cancel",function(){}]];modal.show("Change Login","Enter your current password: <input id='old_password' class='text more' type='password' placeholder='Current Password' value=''><br>Your username and password will be changed to the following: <input id='username' class='text less' type='text' placeholder='New Username' value=''><input id='password' class='text' type='password' placeholder='New Password' value=''>",buttons,-171)},setSorting:function(){varbuttons,sorting;buttons=[["Change Sorting",function(){sorting[0]=$("select#settings_type").val();sorting[1]=$("select#settings_order").val();params="setSorting&type="+sorting[0]+"&order="+sorting[1];lychee.api(params,function(data){if(data===true){lychee.sorting="ORDER BY "+sorting[0]+" "+sorting[1];lychee.load()}elselychee.error(null,params,data)})}],["Cancel",function(){}]];modal.show("Change Sorting","Sort photos by <select id='settings_type'> <option value='id'>Upload Time</option> <option value='take'>Take Date</option> <option value='title'>Title</option> <option value='description'>Description</option> <option value='public'>Public</option> <option value='star'>Star</option> <option value='type'>Photo Format</option> </select> in an <select id='settings_order'> <option value='ASC'>Ascending</option> <option value='DESC'>Descending</option> </select> order. ",buttons);if(lychee.sorting!==""){sorting=lychee.sorting.replace("ORDER BY ","").split(" ");if(sorting[0]==='UNIX_TIMESTAMP(STR_TO_DATE(CONCAT(takedate,"-",taketime),"%d.%m.%Y-%H:%i:%S"))')sorting[0]="take";$("select#settings_type").val(sorting[0]);$("select#settings_order").val(sorting[1])}},setDropboxKey:function(callback){varbuttons,params,key;buttons=[["Set Key",function(){key=$(".message input.text#key").val();params="setDropboxKey&key="+key;lychee.api(params,function(data){if(data===true){lychee.dropboxKey=key;if(callback)lychee.loadDropbox(callback)}elselychee.error(null,params,data)})}],["Cancel",function(){}]];modal.show("Set Dropbox Key","In order to import photos from your Dropbox, you need a valid drop-ins app key from <a href='https://www.dropbox.com/developers/apps/create'>their website</a>. Generate yourself a personal key and enter it below: <input id='key' class='text' type='text' placeholder='Dropbox API Key' value='"+lychee.dropboxKey+"'>",buttons)}};swipe={obj:null,tolerance:150,offset:0,start:function(obj,tolerance){console.log("start with "+obj);if(obj)swipe.obj=obj;if(tolerance)swipe.tolerance=tolerance;retu