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){}bt.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++)vt.set(e[n],"globalEval",!t||vt.get(t[n],"globalEval"))}functiong(e,t){varn,o,i,a,r,s,l,u;if(1===t.nodeType){if(vt.hasData(e)&&(a=vt.access(e),r=vt.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])}bt.hasData(e)&&(s=bt.access(e),l=J.extend({},s),bt.set(t,l))}}functionv(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}functionb(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||Wt(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
}),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.2",version_code:"020602",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){e===!0?(localStorage.setItem("lychee_username",t),window.location.reload()):($("#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="",n=document.location.hash.replace("#","").split("/");$(".no_content").remove(),contextMenu.close(),multiselect.close(),void0!==n[0]&&(e=n[0]),void0!==n[1]&&(t=n[1]),e&&t?(albums.json=null,photo.json=null,(""===lychee.content.html()||$("#search").length&&0!==$("#search").val().length)&&(lychee.content.hide(),album.load(e,!0)),photo.load(t,e)):e?(albums.json=null,photo.json=null,visible.photo()&&view.photo.hide(),album.json&&e==album.json.id?view.album.title():album.load(e)):(albums.js
})}],["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"),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:function(){lychee.setTitle("Albums",!1)},content:{init:function(){vare="",t="";albums.parse(albums.json.unsortedAlbum),albums.parse(albums.json.publicAlbum),albums.parse(albums.json.starredAlbum),albums.parse(albums.json.recentAlbum),lychee.publicMode||(e=build.divider("Smart Albums")+build.album(albums.json.unsortedAlbum)+build.album(albums.json.starredAlbum)+build.album(albums.json.publicAlbum)+build.album(albums.json.recentAlbum)),albums.json.content&&(lychee.publicMode||(t=build.divider("Albums")),$.each(albums.json.content,function(){albums.parse(this),t+=build.album(this)})),""===e&&""===t?(lychee.content.html(""),$("body").append(build.no_content("share"))):lychee.content.html(e+t),$("img[data-type!='nonretina']").retina()},title:function(e){vart="",n="",o=albums.json.content[e].title;albums.json.content[e].password&&(t="<span class='icon-lock'></span> "),o.length>18&&(n=o,o=o.substr(0,18)+"..."),$(".al