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="length"ine&&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(re.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=fe[e]={};returnJ.each(e.match(he)||[],function(e,n){t[n]=!0}),t}functions(){Z.removeEventListener("DOMContentLoaded",s,!1),e.removeEventListener("load",s,!1),J.ready()}functionr(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=J.expando+r.uid++}functionl(e,t,n){varo;if(void0===n&&1===e.nodeType)if(o="data-"+t.replace(we,"-$1").toLowerCase(),n=e.getAttribute(o),"string"==typeofn){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:ye.test(n)?J.parseJSON(n):n}catch(i){}ve.set(e,t,n)}elsen=void0;returnn}functionu(){return!0}functionc(){return!1}functiond(){try{returnZ.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=Le.exec(e.type);returnt?e.type=t[1]:e.removeAttribute("type"),e}functionm(e,t){for(varn=0,o=e.length;o>n;n++)ge.set(e[n],"globalEval",!t||ge.get(t[n],"globalEval"))}functionb(e,t){varn,o,i,a,s,r,l,u;if(1===t.nodeType){if(ge.hasData(e)&&(a=ge.access(e),s=ge.set(t,a),u=a.events)){deletes.handle,s.events={};for(iinu)for(n=0,o=u[i].length;o>n;n++)J.event.add(t,i,u[i][n])}ve.hasData(e)&&(r=ve.access(e),l=J.extend({},r),ve.set(t,l))}}functiong(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&&Te.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=Z,n=Fe[e];returnn||(n=y(e,t),"none"!==n&&n||(He=(He||J("<iframe frameborder='0' width='0' height='0'/>")).appendTo(t.documentElement),t=He[0].contentDocument,t.write(),t.close(),n=y(e,t),He.detach()),Fe[e]=n),n}functionx(e,t,n){varo,i,a,s,r=e.style;returnn=n||Ue(e),n&&(s=n.getPropertyValue(t)||n[t]),n&&(""!==s||J.contains(e.ownerDocument,e)||(s=J.style(e,t)),Be.test(s)&&Oe.test(t)&&(o=r.width,i=r.minWidth,a=r.maxWidth,r.minWidth=r.maxWidth=r.width=s,s=n.width,r.width=o,r.minWidth=i,r.maxWidth=a)),void0!==s?s+"":s}functionj(e,t){return{get:function(){returne()?voiddeletethis.get:(this.get=t).apply(this,arguments)}}}functionM(e,t){if(tine)returnt;for(varn=t[0].toUpperCase()+t.slice(1),o=t,i=Ve.length;i--;)if(t=Ve[i]+n,tine)returnt;returno}functionT(e,t,n){varo=Xe.exec(t);returno?Math.max(0,o[1]-(n||0))+(o[2]||"px"):t}functionk(e,t,n,o,i){for(vara=n===(o?"border":"content")?4:"width"===t?1:0,s=0;4>a;a+=2)"margin"===n&&(s+=J.css(e,n+je[a],!0,i)),o?("content"===n&&(s-=J.css(e,"padding"+je[a],!0,i)),"margin"!==n&&(s-=J.css(e,"border"+je[a]+"Width",!0,i))):(s+=J.css(e,"padding"+je[a],!0,i),"padding"!==n&&(s+=J.css(e,"border"+je[a]+"Width",!0,i)));returns}functionC(e,t,n){varo=!0,i=
vare=n("#basicModal__action");returnnull!=e?(e.click(),!0):!1},d=function(){vare=n("#basicModal__cancel");returnnull!=e?(e.click(),!0):!1},p=function(){for(vare=n(".basicModal__button",!0),t=0;t<e.length;++t)e[t].classList.remove("basicModal__button--active");for(varo=n("input",!0),t=0;t<o.length;++t)o[t].classList.remove("error");return!0},h=function(t){if(u()===!1)return!1;t!==!0&&(t=!1);varo=n().parentElement;return"false"===o.getAttribute("data-closable")&&t===!1?!1:(o.classList.remove("basicModalContainer--fadeIn"),o.classList.add("basicModalContainer--fadeOut"),setTimeout(function(){returno.parentNode.removeChild(o)},300),null!=e&&(e.focus(),e=null),!0)};return{THEME:t,show:r,visible:u,getValues:a,action:c,cancel:d,error:l,reset:p,close:h}}),function(e){vart=function(t){varn=this;this.el=e(t),this.pos={start:{x:0,y:0},end:{x:0,y:0}},this.startTime,t.on("touchstart",function(e){n.touchStart(e)}),t.on("touchmove",function(e){n.touchMove(e)}),t.on("touchend",function(e){n.swipeEnd()}),t.on("mousedown",function(e){n.mouseDown(e)})};t.prototype={touchStart:function(e){vart=e.originalEvent.touches[0];this.swipeStart(e,t.pageX,t.pageY)},touchMove:function(e){vart=e.originalEvent.touches[0];this.swipeMove(e,t.pageX,t.pageY)},mouseDown:function(e){vart=this;this.swipeStart(e,e.pageX,e.pageY),this.el.on("mousemove",function(e){t.mouseMove(e)}),this.el.on("mouseup",function(){t.mouseUp()})},mouseMove:function(e){this.swipeMove(e,e.pageX,e.pageY)},mouseUp:function(e){this.swipeEnd(e),this.el.off("mousemove"),this.el.off("mouseup")},swipeStart:function(e,t,n){this.pos.start.x=t,this.pos.start.y=n,this.pos.end.x=t,this.pos.end.y=n,this.startTime=(newDate).getTime(),this.trigger("swipeStart",e)},swipeMove:function(e,t,n){this.pos.end.x=t,this.pos.end.y=n,this.trigger("swipeMove",e)},swipeEnd:function(e){this.trigger("swipeEnd",e)},trigger:function(t,n){varo=this,i=e.Event(t),a=o.pos.start.x-o.pos.end.x,s=o.pos.end.y-o.pos.start.y,r=Math.atan2(s,a),l="up",u=Math.round(Math.sqrt(Math.pow(a,2)+Math.pow(s,2))),c=Math.round(180*r/Math.PI),d=Math.round(u/((newDate).getTime()-o.startTime)*1e3);0>c&&(c=360-Math.abs(c)),45>=c&&c>=0||360>=c&&c>=315?l="left":c>=135&&225>=c?l="right":c>45&&135>c&&(l="down"),i.originalEvent=n,i.swipe={x:a,y:s,direction:l,distance:u,angle:c,speed:d},e(o.el).trigger(i)}},e.fn.swipe=function(){newt(this);returnthis}}(jQuery),album={json:null},album.getID=function(){vare=null,t=function(e){return"0"===e||"f"===e||"s"===e||"r"===e?!0:$.isNumeric(e)};returnphoto.json?e=photo.json.album:album.json&&(e=album.json.id),t(e)===!1&&(e=$(".album:hover, .album.active").attr("data-id")),t(e)===!1&&(e=$(".photo:hover, .photo.active").attr("data-album-id")),t(e)===!0?e:!1},album.load=function(e,t){password.get(e,function(){t||lychee.animate("#content","contentZoomOut");varn=(newDate).getTime(),o={albumID:e,password:password.value};api.post("Album::get",o,function(o){vari=0;if("Warning: Album private!"===o)returnvoid0!=document.location.hash.replace("#","").split("/")[1]?lychee.setMode("view"):(lychee.content.show(),lychee["goto"]("")),!1;if("Warning: Wrong password!"===o)returnalbum.load(e,t),!1;album.json=o;vara=(newDate).getTime()-n;i=a>300?0:300-a,t===!0&&(i=0),visible.albums()||visible.photo()||visible.album()||(i=0),setTimeout(function(){view.album.init(),t||(lychee.animate("#content","contentZoomIn"),header.setMode("album"))},i)})})},album.parse=function(){album.json.title||(album.json.title="Untitled")},album.add=function(){vare=function(e){vart=e.title,n=function(e){return!isNaN(parseFloat(e))&&isFinite(e)};basicModal.close(),0===t.length&&(t="Untitled"),api.post("Album::add",{title:t},function(e){e===!0&&(e=1),e!==!1&&n(e)?(albums.refresh(),lychee["goto"](e)):lychee.error(null,params,e)})};basicModal.show({body:"<p>Enter a title for the new album: <input class='text' name='title' type='text' maxlength='50' placeholder='Title' value='Untitled'></p>",buttons:{action:{title:"Create Album",fn:e},cancel:{title:"Cancel",fn:basicModal.close}}})},album["delete"]=function(e){vart={},n={},o="";i
!1):void0}).bind("u",function(){returnvisible.photo()?void0:($("#upload_files").click(),!1)}).bind(["s","f"],function(){returnvisible.photo()?(header.dom("#button_star").click(),!1):visible.albums()?(header.dom("#search").focus(),!1):void0}).bind("r",function(){returnvisible.album()?(album.setTitle(album.getID()),!1):visible.photo()?(photo.setTitle([photo.getID()]),!1):void0}).bind("d",function(){returnvisible.photo()?(photo.setDescription(photo.getID()),!1):visible.album()?(album.setDescription(album.getID()),!1):void0}).bind("t",function(){returnvisible.photo()?(photo.editTags([photo.getID()]),!1):void0}).bind("i",function(){returnvisible.multiselect()?void0:(sidebar.toggle(),!1)}).bind(["command+backspace","ctrl+backspace"],function(){returnvisible.photo()&&basicModal.visible()===!1?(photo["delete"]([photo.getID()]),!1):visible.album()&&basicModal.visible()===!1?(album["delete"]([album.getID()]),!1):void0}).bind(["command+a","ctrl+a"],function(){returnvisible.album()&&basicModal.visible()===!1?(multiselect.selectAll(),!1):visible.albums()&&basicModal.visible()===!1?(multiselect.selectAll(),!1):void0}),Mousetrap.bindGlobal("enter",function(){basicModal.visible()===!0&&basicModal.action()}),Mousetrap.bindGlobal(["esc","command+up"],function(){returnbasicModal.visible()===!0?basicModal.cancel():visible.contextMenu()?contextMenu.close():visible.photo()?lychee["goto"](album.getID()):visible.album()?lychee["goto"](""):visible.albums()&&0!==$("#search").val().length&&search.reset(),!1}),"touchend"===e&&$(document).on("touchend","#image",function(e){(null==swipe.obj||swipe.offset>=-5&&swipe.offset<=5)&&(visible.header()?header.hide(e,0):header.show())}).swipe().on("swipeStart",function(){visible.photo()&&swipe.start($("#image"))}).swipe().on("swipeMove",function(e){visible.photo()&&swipe.move(e.swipe)}).swipe().on("swipeEnd",function(e){visible.photo()&&swipe.stop(e.swipe,photo.previous,photo.next)}),$(document).on("click",".album",function(){lychee["goto"]($(this).attr("data-id"))}).on("click",".photo",function(){lychee["goto"](album.getID()+"/"+$(this).attr("data-id"))}).on("contextmenu",".photo",function(e){contextMenu.photo(photo.getID(),e)}).on("contextmenu",".album",function(e){contextMenu.album(album.getID(),e)}).on("change","#upload_files",function(){basicModal.close(),upload.start.local(this.files)}).on("dragover",function(){return!1},!1).on("drop",function(e){returnvisible.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")),!1}),lychee.init()}),loadingBar={status:null,_dom:$("#loading")},loadingBar.dom=function(e){returnnull==e||""===e?loadingBar._dom:loadingBar._dom.find(e)},loadingBar.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.header()&&header.dom().addClass("error"),loadingBar.dom().removeClass("loading uploading error").html("<h1>Error: <span>"+t+"</span></h1>").addClass(e).show(),clearTimeout(loadingBar._timeout),loadingBar._timeout=setTimeout(function(){returnloadingBar.hide(!0)},3e3),!0):null===loadingBar.status?(loadingBar.status="loading",clearTimeout(loadingBar._timeout),loadingBar._timeout=setTimeout(function(){visible.header()&&header.dom().addClass("loading"),loadingBar.dom().removeClass("loading uploading error").html("").addClass("loading").show()},1e3),!0):void0},loadingBar.hide=function(e){("error"!==loadingBar.status&&null!=loadingBar.status||e)&&(loadingBar.status=null,header.dom().removeClass("error loading"),clearTimeout(loadingBar._timeout),setTimeout(function(){returnloadingBar.dom().hide()},300))},lychee={title:document.title,version:"3.0.6",version_code:"030006",update_path:"http://lychee.electerious.com/version/index.php",updateURL:"https://github.com/electerious/Lychee",website:
basicModal.show({body:o,buttons:{action:{title:"Change Sorting",fn:n},cancel:{title:"Cancel",fn:basicModal.close}}}),""!==lychee.sortingAlbums&&(t=lychee.sortingAlbums.replace("ORDER BY ","").split(" "),$(".basicModal select#settings_albums_type").val(t[0]),$(".basicModal select#settings_albums_order").val(t[1])),""!==lychee.sortingPhotos&&(e=lychee.sortingPhotos.replace("ORDER BY ","").split(" "),$(".basicModal select#settings_photos_type").val(e[0]),$(".basicModal select#settings_photos_order").val(e[1]))},settings.setDropboxKey=function(e){vart=function(t){varn=t.key;returnt.key.length<1?(basicModal.error("key"),!1):(basicModal.close(),voidapi.post("Settings::setDropboxKey",{key:n},function(t){t===!0?(lychee.dropboxKey=n,e&&lychee.loadDropbox(e)):lychee.error(null,params,t)}))},n="\n <p>\n 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:\n <input class='text' name='key' type='text' placeholder='Dropbox API Key' value='"+lychee.dropboxKey+"'>\n </p>\n ";basicModal.show({body:n,buttons:{action:{title:"Set Dropbox Key",fn:t},cancel:{title:"Cancel",fn:basicModal.close}}})},sidebar={_dom:$("#sidebar"),types:{DEFAULT:0,TAGS:1},createStructure:{}},sidebar.dom=function(e){returnnull==e||""===e?sidebar._dom:sidebar._dom.find(e)},sidebar.bind=function(){vare=lychee.getEventName();returnsidebar.dom("#edit_title").off(e).on(e,function(){visible.photo()?photo.setTitle([photo.getID()]):visible.album()&&album.setTitle([album.getID()])}),sidebar.dom("#edit_description").off(e).on(e,function(){visible.photo()?photo.setDescription(photo.getID()):visible.album()&&album.setDescription(album.getID())}),sidebar.dom("#edit_tags").off(e).on(e,function(){photo.editTags([photo.getID()])}),sidebar.dom("#tags .tag span").off(e).on(e,function(){photo.deleteTag(photo.getID(),$(this).data("index"))}),!0},sidebar.toggle=function(){returnvisible.sidebar()||visible.sidebarbutton()?(header.dom(".button--info").toggleClass("active"),lychee.content.toggleClass("sidebar"),sidebar.dom().toggleClass("active"),!0):!1},sidebar.setSelectable=function(){vare=arguments.length<=0||void0===arguments[0]?!0:arguments[0];e===!0?sidebar.dom().removeClass("notSelectable"):sidebar.dom().addClass("notSelectable")},sidebar.changeAttr=function(e){vart=arguments.length<=1||void0===arguments[1]?"-":arguments[1];returnnull==e||""===e?!1:((null==t||""===t)&&(t="-"),sidebar.dom(".attr_"+e).html(t),!0)},sidebar.createStructure.photo=function(e){if(null==e||""===e)return!1;vart=!1,n=e.takestamp+e.make+e.model+e.shutter+e.aperture+e.focal+e.iso,o={},i="";switch(lychee.publicMode===!1&&(t=!0),e["public"]){case"0":i="No";break;case"1":i="Yes";break;case"2":i="Yes (Album)";break;default:i="-"}returno.basics={title:"Basics",type:sidebar.types.DEFAULT,rows:[{title:"Title",value:e.title,editable:t},{title:"Uploaded",value:e.sysdate},{title:"Description",value:e.description,editable:t}]},o.image={title:"Image",type:sidebar.types.DEFAULT,rows:[{title:"Size",value:e.size},{title:"Format",value:e.type},{title:"Resolution",value:e.width+" x "+e.height}]},lychee.publicMode===!1?o.tags={title:"Tags",type:sidebar.types.TAGS,value:build.tags(e.tags),editable:t}:o.tags={},"0"!==n?o.exif={title:"Camera",type:sidebar.types.DEFAULT,rows:[{title:"Captured",value:e.takedate},{title:"Make",value:e.make},{title:"Type/Model",value:e.model},{title:"Shutter Speed",value:e.shutter},{title:"Aperture",value:e.aperture},{title:"Focal Length",value:e.focal},{title:"ISO",value:e.iso}]}:o.exif={},o.sharing={title:"Sharing",type:sidebar.types.DEFAULT,rows:[{title:"Public",value:i}]},o=[o.basics,o.image,o.tags,o.exif,o.sharing]},sidebar.createStructure.album=function(e){if(null==e||""===e)return!1;vart=!1,n={},o="",i="",a="",s="";switch(lychee.publicMode===!1&&(t=!0),e["public"]){case"0":o="No";break;case"1":o="Yes";break;default:o="-"}switch(e.visible){case"0":i="No";break;case"1