functionmobileBrowser(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)?!0:!1}functiongup(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");vart="[\\?&]"+e+"=([^&#]*)",n=newRegExp(t),o=n.exec(window.location.href);returnnull===o?"":o[1]}!function(e,t){"object"==typeofmodule&&"object"==typeofmodule.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)thrownewError("jQuery requires a window with a document");returnt(e)}:t(e)}("undefined"!=typeofwindow?window:this,function(e,t){functionn(e){vart=e.length,n=J.type(e);return"function"===n||J.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||0===t||"number"==typeoft&&t>0&&t-1ine}functiono(e,t,n){if(J.isFunction(t))returnJ.grep(e,function(e,o){return!!t.call(e,o,e)!==n});if(t.nodeType)returnJ.grep(e,function(e){returne===t!==n});if("string"==typeoft){if(st.test(t))returnJ.filter(t,e,n);t=J.filter(t,e)}returnJ.grep(e,function(e){returnz.call(t,e)>=0!==n})}functioni(e,t){for(;(e=e[t])&&1!==e.nodeType;);returne}functiona(e){vart=ft[e]={};returnJ.each(e.match(ht)||[],function(e,n){t[n]=!0}),t}functionr(){Q.removeEventListener("DOMContentLoaded",r,!1),e.removeEventListener("load",r,!1),J.ready()}functions(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=J.expando+Math.random()}functionl(e,t,n){varo;if(void0===n&&1===e.nodeType)if(o="data-"+t.replace(wt,"-$1").toLowerCase(),n=e.getAttribute(o),"string"==typeofn){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:yt.test(n)?J.parseJSON(n):n}catch(i){}vt.set(e,t,n)}elsen=void0;returnn}functionu(){return!0}functionc(){return!1}functiond(){try{returnQ.activeElement}catch(e){}}functionp(e,t){returnJ.nodeName(e,"table")&&J.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}functionh(e){returne.type=(null!==e.getAttribute("type"))+"/"+e.type,e}functionf(e){vart=Lt.exec(e.type);returnt?e.type=t[1]:e.removeAttribute("type"),e}functionm(e,t){for(varn=0,o=e.length;o>n;n++)bt.set(e[n],"globalEval",!t||bt.get(t[n],"globalEval"))}functiong(e,t){varn,o,i,a,r,s,l,u;if(1===t.nodeType){if(bt.hasData(e)&&(a=bt.access(e),r=bt.set(t,a),u=a.events)){deleter.handle,r.events={};for(iinu)for(n=0,o=u[i].length;o>n;n++)J.event.add(t,i,u[i][n])}vt.hasData(e)&&(s=vt.access(e),l=J.extend({},s),vt.set(t,l))}}functionb(e,t){varn=e.getElementsByTagName?e.getElementsByTagName(t||"*"):e.querySelectorAll?e.querySelectorAll(t||"*"):[];returnvoid0===t||t&&J.nodeName(e,t)?J.merge([e],n):n}functionv(e,t){varn=t.nodeName.toLowerCase();"input"===n&&kt.test(e.type)?t.checked=e.checked:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}functiony(t,n){varo,i=J(n.createElement(t)).appendTo(n.body),a=e.getDefaultComputedStyle&&(o=e.getDefaultComputedStyle(i[0]))?o.display:J.css(i[0],"display");returni.detach(),a}functionw(e){vart=Q,n=Rt[e];returnn||(n=y(e,t),"none"!==n&&n||(qt=(qt||J("<iframe frameborder='0' width='0' height='0'/>")).appendTo(t.documentElement),t=qt[0].contentDocument,t.write(),t.close(),n=y(e,t),qt.detach()),Rt[e]=n),n}functionx(e,t,n){varo,i,a,r,s=e.style;returnn=n||Ut(e),n&&(r=n.getPropertyValue(t)||n[t]),n&&(""!==r||J.contains(e.ownerDocument,e)||(r=J.style(e,t)),Ft.test(r)&&Bt.test(t)&&(o=s.width,i=s.minWidth,a=s.maxWidth,s.minWidth=s.maxWidth=s.width=r,r=n.width,s.width=o,s.minWidth=i,s.maxWidth=a)),void0!==r?r+"":r}functionT(e,t){return{get:function(){returne()?voiddeletethis.get:(this.get=t).apply(this,arguments)}}}function$(e,t){if(tine)returnt;for(varn=t[0].toUpperCase()+t.slice(1),o=t,i=Vt.length;i--;)if(t=Vt[i]+n,tine)returnt;returno}functionk(e,t,n){varo=Xt.exec(t);returno?Math.max(0,o[1]-(n||0))+(o[2]||"px"):t}functionj(e,t,n,o,i){for(vara=n===(o?"border":"content")?4:"width"===t?1:0,r=0;4>a;a+=2)"margin"===n&&(r+=J.css(e,n+Tt[a],!0,i)),o?("content"===n&&(r-=J.css(e,"padding"+Tt[a],!0,i)),"margin"!==n&&(r-=J.css(e,"border"+Tt[a]+"Width",!0,i))):(r+=J.css(e,"padding"+Tt[a],!0
}).on(e,".upload_message a.close",upload.close).on("dragover",function(e){e.preventDefault()},!1).on("drop",function(e){returne.stopPropagation(),e.preventDefault(),visible.photo()&&lychee.goto(album.getID()),visible.contextMenu()&&contextMenu.close(),e.originalEvent.dataTransfer.files.length>0?upload.start.local(e.originalEvent.dataTransfer.files):e.originalEvent.dataTransfer.getData("Text").length>3&&upload.start.url(e.originalEvent.dataTransfer.getData("Text")),!0}),lychee.init()}),loadingBar={status:null,show:function(e,t){return"error"===e?(loadingBar.status="error",t&&(t=t.replace("<br>","")),t||(t="Whoops, it looks like something went wrong. Please reload the site and try again!"),visible.controls()&&lychee.header.addClass("error"),lychee.loadingBar.removeClass("loading uploading error").addClass(e).html("<h1>Error: <span>"+t+"</span></h1>").show().css("height","40px"),clearTimeout(lychee.loadingBar.data("timeout")),lychee.loadingBar.data("timeout",setTimeout(function(){loadingBar.hide(!0)},3e3)),!0):null===loadingBar.status?(loadingBar.status="loading",clearTimeout(lychee.loadingBar.data("timeout")),lychee.loadingBar.data("timeout",setTimeout(function(){visible.controls()&&lychee.header.addClass("loading"),lychee.loadingBar.removeClass("loading uploading error").addClass("loading").show()},1e3)),!0):void0},hide:function(e){("error"!==loadingBar.status&&null!==loadingBar.status||e)&&(loadingBar.status=null,visible.controls()&&lychee.header.removeClass("error loading"),lychee.loadingBar.html("").css("height","3px"),clearTimeout(lychee.loadingBar.data("timeout")),setTimeout(function(){lychee.loadingBar.hide()},300))}};varlychee={title:"",version:"2.6.3",version_code:"020603",api_path:"php/api.php",update_path:"http://lychee.electerious.com/version/index.php",updateURL:"https://github.com/electerious/Lychee",website:"http://lychee.electerious.com",publicMode:!1,viewMode:!1,debugMode:!1,username:"",checkForUpdates:!1,sorting:"",location:"",dropbox:!1,dropboxKey:"",loadingBar:$("#loading"),header:$("header"),content:$("#content"),imageview:$("#imageview"),infobox:$("#infobox"),init:function(){vare;e="init&version="+lychee.version_code,lychee.api(e,function(e){returne.loggedIn!==!0?lychee.setMode("public"):(lychee.username=e.config.username||"",lychee.sorting=e.config.sorting||"",lychee.dropboxKey=e.config.dropboxKey||"",lychee.location=e.config.location||""),"Warning: No configuration!"===e?(lychee.header.hide(),lychee.content.hide(),$("body").append(build.no_content("cog")),settings.createConfig(),!0):(e.config.login===!1&&settings.createLogin(),lychee.checkForUpdates=e.config.checkForUpdates,$(window).bind("popstate",lychee.load),voidlychee.load())})},api:function(e,t,n){void0===n&&loadingBar.show(),$.ajax({type:"POST",url:lychee.api_path,data:"function="+e,dataType:"text",success:function(n){returnsetTimeout(function(){loadingBar.hide()},100),"string"==typeofn&&"Error: "===n.substring(0,7)?(lychee.error(n.substring(7,n.length),e,n),upload.close(!0),!1):("1"===n?n=!0:""===n&&(n=!1),"string"==typeofn&&"{"===n.substring(0,1)&&"}"===n.substring(n.length-1,n.length)&&(n=$.parseJSON(n)),lychee.debugMode&&console.log(n),voidt(n))},error:function(t,n,o){lychee.error("Server error or API not found.",e,o),upload.close(!0)}})},login:function(){vare,t=$("input#username").val(),n=md5($("input#password").val());e="login&user="+t+"&password="+n,lychee.api(e,function(e){if(e===!0){try{localStorage.setItem("lychee_username",t)}catch(n){}window.location.reload()}else$("#password").val("").addClass("error").focus(),$(".message .button.active").removeClass("pressed")})},loginDialog:function(){vare;$("body").append(build.signInModal()),$("#username").focus(),localStorage&&(e=localStorage.getItem("lychee_username"),null!==e&&(e.length>0&&$("#username").val(e),$("#password").focus())),"1"===lychee.checkForUpdates&&lychee.getUpdate()},logout:function(){lychee.api("logout",function(){window.location.reload()})},"goto":function(e){e=void0===e?"#":"#"+e,history.pushState(null,null,e),lychee.load()},load:function(){vare="",t="
}],["Cancel",function(){}]],modal.show("Import from Link","Please enter the direct link to a photo to import it: <input class='text' type='text' placeholder='http://' value='http://'>",n)},server:function(){vare,t,n,o=album.getID(),i=[];o===!1&&(o=0),t=[["Import",function(){n=$(".message input.text").val(),i[0]={name:n,supported:!0},upload.show("Importing from server",i,function(){$(".upload_message .rows .row .status").html("Importing")}),e="importServer&albumID="+o+"&path="+escape(encodeURI(n)),lychee.api(e,function(t){returnupload.close(),upload.notify("Import complete"),albums.refresh(),"Notice: Import only contains albums!"===t?visible.albums()?lychee.load():lychee.goto(""):album.getID()===!1?lychee.goto("0"):album.load(o),"Notice: Import only contains albums!"===t?!0:void("Warning: Folder empty!"===t?lychee.error("Folder empty. No photos imported!",e,t):t!==!0&&lychee.error(null,e,t))})}],["Cancel",function(){}]],modal.show("Import from Server","This action will import all photos, folders and sub-folders which are located in the following directory. The <b>original files will be deleted</b> after the import when possible. <input class='text' type='text' maxlength='100' placeholder='Absolute path to directory' value='"+lychee.location+"uploads/import/'>",t)},dropbox:function(){vare,t=album.getID(),n="";t===!1&&(t=0),lychee.loadDropbox(function(){Dropbox.choose({linkType:"direct",multiselect:!0,success:function(o){for(vari=0;i<o.length;i++)n+=o[i].link+",",o[i]={name:o[i].link,supported:!0};n=n.substr(0,n.length-1),upload.show("Importing from Dropbox",o,function(){$(".upload_message .rows .row .status").html("Importing")}),e="importUrl&url="+escape(n)+"&albumID="+t,lychee.api(e,function(n){upload.close(),upload.notify("Import complete"),albums.refresh(),album.getID()===!1?lychee.goto("0"):album.load(t),n!==!0&&lychee.error(null,e,n)})}})})}},close:function(e){e===!0?$(".upload_overlay").remove():($(".upload_overlay").removeClass("fadeIn").css("opacity",0),setTimeout(function(){$(".upload_overlay").remove()},300))}},view={header:{show:function(){vare=-1*($("#imageview #image").height()/2)+20;clearTimeout($(window).data("timeout")),lychee.imageview.removeClass("full"),lychee.header.removeClass("hidden"),lychee.loadingBar.css("opacity",1),$("#imageview #image.small").length>0?$("#imageview #image").css("margin-top",e):$("#imageview #image").removeClass("full")},hide:function(e,t){varn=-1*($("#imageview #image").height()/2);void0===t&&(t=500),!visible.photo()||visible.infobox()||visible.contextMenu()||visible.message()||(clearTimeout($(window).data("timeout")),$(window).data("timeout",setTimeout(function(){lychee.imageview.addClass("full"),lychee.header.addClass("hidden"),lychee.loadingBar.css("opacity",0),$("#imageview #image.small").length>0?$("#imageview #image").css("margin-top",n):$("#imageview #image").addClass("full")},t)))},mode:function(e){vart=album.getID();switch(e){case"albums":lychee.header.removeClass("view"),$("#tools_album, #tools_photo").hide(),$("#tools_albums").show();break;case"album":lychee.header.removeClass("view"),$("#tools_albums, #tools_photo").hide(),$("#tools_album").show(),album.json.content===!1?$("#button_archive").hide():$("#button_archive").show(),lychee.publicMode&&"0"===album.json.downloadable&&$("#button_archive").hide(),"s"===t||"f"===t||"r"===t?$("#button_info_album, #button_trash_album, #button_share_album").hide():"0"===t?($("#button_info_album, #button_share_album").hide(),$("#button_trash_album").show()):$("#button_info_album, #button_trash_album, #button_share_album").show();break;case"photo":lychee.header.addClass("view"),$("#tools_albums, #tools_album").hide(),$("#tools_photo").show()}}},infobox:{show:function(){visible.infobox()||$("body").append("<div id='infobox_overlay' class='fadeIn'></div>"),lychee.infobox.addClass("active")},hide:function(){lychee.animate("#infobox_overlay","fadeOut"),setTimeout(function(){$("#infobox_overlay").remove()},300),lychee.infobox.removeClass("active")}},albums:{init:function(){view.albums.title(),view.albums.content.init()},title:fun