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=Ht[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()),Ht[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)),Bt.test(r)&&Ft.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)}}}functionj(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}function$(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
}},e.fn.swipe=function(){newt(this);returnthis}}(jQuery),album={json:null,getID:function(){vare;returne=photo.json?photo.json.album:album.json?album.json.id:$(".album:hover, .album.active").attr("data-id"),e||(e=$(".album:hover, .album.active").attr("data-id")),e||(e=$(".photo:hover, .photo.active").attr("data-album-id")),e?e:!1},load:function(e,t){varn,o,i,a;password.get(e,function(){t||(loadingBar.show(),lychee.animate(".album:nth-child(-n+50), .photo:nth-child(-n+50)","contentZoomOut"),lychee.animate(".divider","fadeOut")),n=(newDate).getTime(),o="getAlbum&albumID="+e+"&password="+password.value,lychee.api(o,function(o){return"Warning: Album private!"===o?(void0!=document.location.hash.replace("#","").split("/")[1]?lychee.setMode("view"):(lychee.content.show(),lychee.goto("")),!1):"Warning: Wrong password!"===o?(album.load(e,t),!1):(album.json=o,i=(newDate).getTime()-n,a=i>300?0:t?0:300-i,visible.albums()||visible.photo()||visible.album()||(a=0),voidsetTimeout(function(){view.album.init(),t||(lychee.animate(".album:nth-child(-n+50), .photo:nth-child(-n+50)","contentZoomIn"),view.header.mode("album"))},a))})})},parse:function(){album.json.title||(album.json.title="Untitled")},add:function(){vare,t,n,o=function(e){return!isNaN(parseFloat(e))&&isFinite(e)};n=[["Create Album",function(){e=$(".message input.text").val(),0===e.length&&(e="Untitled"),modal.close(),t="addAlbum&title="+escape(encodeURI(e)),lychee.api(t,function(e){e===!0&&(e=1),e!==!1&&o(e)?(albums.refresh(),lychee.goto(e)):lychee.error(null,t,e)})}],["Cancel",function(){}]],modal.show("New Album","Enter a title for this album: <input class='text' type='text' maxlength='30' placeholder='Title' value='Untitled'>",n)},"delete":function(e){vart,n,o;returne?(einstanceofArray==!1&&(e=[e]),n=[["",function(){t="deleteAlbum&albumIDs="+e,lychee.api(t,function(n){visible.albums()?e.forEach(function(e){albums.json.num--,view.albums.content.delete(e),deletealbums.json.content[e]}):(albums.refresh(),lychee.goto("")),n!==!0&&lychee.error(null,t,n)})}],["",function(){}]],void("0"===e.toString()?(n[0][0]="Clear Unsorted",n[1][0]="Keep Unsorted",modal.show("Clear Unsorted","Are you sure you want to delete all photos from 'Unsorted'?<br>This action can't be undone!",n)):1===e.length?(n[0][0]="Delete Album and Photos",n[1][0]="Keep Album",album.json?o=album.json.title:albums.json&&(o=albums.json.content[e].title),modal.show("Delete Album","Are you sure you want to delete the album '"+o+"' and all of the photos it contains? This action can't be undone!",n)):(n[0][0]="Delete Albums and Photos",n[1][0]="Keep Albums",modal.show("Delete Albums","Are you sure you want to delete all "+e.length+" selected albums and all of the photos they contain? This action can't be undone!",n)))):!1},setTitle:function(e){vart,n,o,i="";returne?(einstanceofArray==!1&&(e=[e]),1===e.length&&(album.json?i=album.json.title:albums.json&&(i=albums.json.content[e].title),i||(i=""),i=i.replace("'","'")),o=[["Set Title",function(){if(t=$(".message input.text").val(),t=lychee.removeHTML(t),t=""===t?"Untitled":t,visible.album()){if(album.json.title=t,view.album.title(),albums.json){varo=e[0];albums.json.content[o].title=t}}elsevisible.albums()&&e.forEach(function(e){albums.json.content[e].title=t,view.albums.content.title(e)});n="setAlbumTitle&albumIDs="+e+"&title="+escape(encodeURI(t)),lychee.api(n,function(e){e!==!0&&lychee.error(null,n,e)})}],["Cancel",function(){}]],void(1===e.length?modal.show("Set Title","Enter a new title for this album: <input class='text' type='text' maxlength='30' placeholder='Title' value='"+i+"'>",o):modal.show("Set Titles","Enter a title for all "+e.length+" selected album: <input class='text' type='text' maxlength='30' placeholder='Title' value='"+i+"'>",o))):!1},setDescription:function(e){vart,n,o,i=album.json.description.replace("'","'");o=[["Set Description",function(){t=$(".message input.text").val(),t=lychee.removeHTML(t),visible.album()&&(album.json.description=t,view.album.description()),n="setAlbumDescription&albumID="+e+"&description="+escap
},load:function(e,t){varn,o;n="getPhoto&photoID="+e+"&albumID="+t+"&password="+password.value,lychee.api(n,function(n){return"Warning: Wrong password!"===n?(o=function(){""!==password.value?photo.load(e,t):setTimeout(o,250)},o(),!1):(photo.json=n,visible.photo()||view.photo.show(),view.photo.init(),lychee.imageview.show(),voidsetTimeout(function(){lychee.content.show()},300))})},preloadNext:function(e){vart,n;returnmobileBrowser()?!1:void(album.json&&album.json.content&&album.json.content[e]&&""!=album.json.content[e].nextPhoto&&(t=album.json.content[e].nextPhoto,n=album.json.content[t].url,photo.cache=newImage,photo.cache.src=n,photo.cache.onload=function(){photo.cache=null}))},parse:function(){photo.json.title||(photo.json.title="Untitled")},previous:function(e){vart=0;photo.getID()!==!1&&album.json&&album.json.content[photo.getID()]&&""!==album.json.content[photo.getID()].previousPhoto&&(e===!0&&(t=200,$("#image").css({WebkitTransform:"translateX(100%)",MozTransform:"translateX(100%)",transform:"translateX(100%)",opacity:0})),setTimeout(function(){returnphoto.getID()===!1?!1:voidlychee.goto(album.getID()+"/"+album.json.content[photo.getID()].previousPhoto)},t))},next:function(e){vart=0;photo.getID()!==!1&&album.json&&album.json.content[photo.getID()]&&""!==album.json.content[photo.getID()].nextPhoto&&(e===!0&&(t=200,$("#image").css({WebkitTransform:"translateX(-100%)",MozTransform:"translateX(-100%)",transform:"translateX(-100%)",opacity:0})),setTimeout(function(){returnphoto.getID()===!1?!1:voidlychee.goto(album.getID()+"/"+album.json.content[photo.getID()].nextPhoto)},t))},duplicate:function(e){vart;returne?(einstanceofArray==!1&&(e=[e]),albums.refresh(),t="duplicatePhoto&photoIDs="+e,voidlychee.api(t,function(e){e!==!0?lychee.error(null,t,e):album.load(album.getID(),!1)})):!1},"delete":function(e){vart,n,o;returne?(einstanceofArray==!1&&(e=[e]),1===e.length&&(o=visible.photo()?photo.json.title:album.json.content[e].title,""===o&&(o="Untitled")),n=[["",function(){varn="",o="";e.forEach(function(e){(""!==album.json.content[e].nextPhoto||""!==album.json.content[e].previousPhoto)&&(n=album.json.content[e].nextPhoto,o=album.json.content[e].previousPhoto,album.json.content[o].nextPhoto=n,album.json.content[n].previousPhoto=o),album.json.content[e]=null,view.album.content.delete(e)}),albums.refresh(),visible.photo()&&""!==n&&n!==photo.getID()?lychee.goto(album.getID()+"/"+n):visible.albums()||lychee.goto(album.getID()),t="deletePhoto&photoIDs="+e,lychee.api(t,function(e){e!==!0&&lychee.error(null,t,e)})}],["",function(){}]],void(1===e.length?(n[0][0]="Delete Photo",n[1][0]="Keep Photo",modal.show("Delete Photo","Are you sure you want to delete the photo '"+o+"'?<br>This action can't be undone!",n)):(n[0][0]="Delete Photos",n[1][0]="Keep Photos",modal.show("Delete Photos","Are you sure you want to delete all "+e.length+" selected photo?<br>This action can't be undone!",n)))):!1},setTitle:function(e){vart,n,o,i="";returne?(einstanceofArray==!1&&(e=[e]),1===e.length&&(photo.json?i=photo.json.title:album.json&&(i=album.json.content[e].title),i=i.replace("'","'")),o=[["Set Title",function(){t=$(".message input.text").val(),t=lychee.removeHTML(t),visible.photo()&&(photo.json.title=""===t?"Untitled":t,view.photo.title()),e.forEach(function(e){album.json.content[e].title=t,view.album.content.title(e)}),n="setPhotoTitle&photoIDs="+e+"&title="+escape(encodeURI(t)),lychee.api(n,function(e){e!==!0&&lychee.error(null,n,e)})}],["Cancel",function(){}]],void(1===e.length?modal.show("Set Title","Enter a new title for this photo: <input class='text' type='text' maxlength='30' placeholder='Title' value='"+i+"'>",o):modal.show("Set Titles","Enter a title for all "+e.length+" selected photos: <input class='text' type='text' maxlength='30' placeholder='Title' value=''>",o))):!1},setAlbum:function(e,t){varn,o,i;returne?(visible.photo&&lychee.goto(album.getID()),einstanceofArray==!1&&(e=[e]),e.forEach(function(e){(""!==album.json.content[e].nextPhoto||""!==album.json.content[e].previousPhoto)&&(o=album.json.con