You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lychee/dist/main.js

7 lines
177 KiB

function gup(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t="[\\?&]"+e+"=([^&#]*)",n=new RegExp(t),o=n.exec(window.location.href);return null===o?"":o[1]}!function(e,t){"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){function n(e){var t="length"in e&&e.length,n=J.type(e);return"function"===n||J.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e}function o(e,t,n){if(J.isFunction(t))return J.grep(e,function(e,o){return!!t.call(e,o,e)!==n});if(t.nodeType)return J.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(se.test(t))return J.filter(t,e,n);t=J.filter(t,e)}return J.grep(e,function(e){return z.call(t,e)>=0!==n})}function i(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}function a(e){var t=fe[e]={};return J.each(e.match(he)||[],function(e,n){t[n]=!0}),t}function r(){Z.removeEventListener("DOMContentLoaded",r,!1),e.removeEventListener("load",r,!1),J.ready()}function s(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=J.expando+s.uid++}function l(e,t,n){var o;if(void 0===n&&1===e.nodeType)if(o="data-"+t.replace(we,"-$1").toLowerCase(),n=e.getAttribute(o),"string"==typeof n){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)}else n=void 0;return n}function u(){return!0}function c(){return!1}function d(){try{return Z.activeElement}catch(e){}}function p(e,t){return J.nodeName(e,"table")&&J.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function h(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function f(e){var t=Le.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function m(e,t){for(var n=0,o=e.length;o>n;n++)ge.set(e[n],"globalEval",!t||ge.get(t[n],"globalEval"))}function b(e,t){var n,o,i,a,r,s,l,u;if(1===t.nodeType){if(ge.hasData(e)&&(a=ge.access(e),r=ge.set(t,a),u=a.events)){delete r.handle,r.events={};for(i in u)for(n=0,o=u[i].length;o>n;n++)J.event.add(t,i,u[i][n])}ve.hasData(e)&&(s=ve.access(e),l=J.extend({},s),ve.set(t,l))}}function g(e,t){var n=e.getElementsByTagName?e.getElementsByTagName(t||"*"):e.querySelectorAll?e.querySelectorAll(t||"*"):[];return void 0===t||t&&J.nodeName(e,t)?J.merge([e],n):n}function v(e,t){var n=t.nodeName.toLowerCase();"input"===n&&Me.test(e.type)?t.checked=e.checked:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}function y(t,n){var o,i=J(n.createElement(t)).appendTo(n.body),a=e.getDefaultComputedStyle&&(o=e.getDefaultComputedStyle(i[0]))?o.display:J.css(i[0],"display");return i.detach(),a}function w(e){var t=Z,n=Re[e];return n||(n=y(e,t),"none"!==n&&n||(Fe=(Fe||J("<iframe frameborder='0' width='0' height='0'/>")).appendTo(t.documentElement),t=Fe[0].contentDocument,t.write(),t.close(),n=y(e,t),Fe.detach()),Re[e]=n),n}function x(e,t,n){var o,i,a,r,s=e.style;return n=n||Ue(e),n&&(r=n.getPropertyValue(t)||n[t]),n&&(""!==r||J.contains(e.ownerDocument,e)||(r=J.style(e,t)),Be.test(r)&&Oe.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)),void 0!==r?r+"":r}function j(e,t){return{get:function(){return e()?void delete this.get:(this.get=t).apply(this,arguments)}}}function T(e,t){if(t in e)return t;for(var n=t[0].toUpperCase()+t.slice(1),o=t,i=Ve.length;i--;)if(t=Ve[i]+n,t in e)return t;return o}function M(e,t,n){var o=Xe.exec(t);return o?Math.max(0,o[1]-(n||0))+(o[2]||"px"):t}function k(e,t,n,o,i){for(var a=n===(o?"border":"content")?4:"width"===t?1:0,r=0;4>a;a+=2)"margin"===n&&(r+=J.css(e,n+je[a],!0,i)),o?("content"===n&&(r-=J.css(e,"padding"+je[a],!0,i)),"margin"!==n&&(r-=J.css(e,"border"+je[a]+"Width",!0,i))):(r+=J.css(e,"padding"+je[a],!0,i),"padding"!==n&&(r+=J.css(e,"border"+je[a]+"Width",!0,i)));return r}function C(e,t,n){var o=!0,i=
return 1===e.nodeType}))},J.fn.extend({find:function(e){var t,n=this.length,o=[],i=this;if("string"!=typeof e)return this.pushStack(J(e).filter(function(){for(t=0;n>t;t++)if(J.contains(i[t],this))return!0}));for(t=0;n>t;t++)J.find(e,i[t],o);return o=this.pushStack(n>1?J.unique(o):o),o.selector=this.selector?this.selector+" "+e:e,o},filter:function(e){return this.pushStack(o(this,e||[],!1))},not:function(e){return this.pushStack(o(this,e||[],!0))},is:function(e){return!!o(this,"string"==typeof e&&ae.test(e)?J(e):e||[],!1).length}});var le,ue=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,ce=J.fn.init=function(e,t){var n,o;if(!e)return this;if("string"==typeof e){if(n="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:ue.exec(e),!n||!n[1]&&t)return!t||t.jquery?(t||le).find(e):this.constructor(t).find(e);if(n[1]){if(t=t instanceof J?t[0]:t,J.merge(this,J.parseHTML(n[1],t&&t.nodeType?t.ownerDocument||t:Z,!0)),re.test(n[1])&&J.isPlainObject(t))for(n in t)J.isFunction(this[n])?this[n](t[n]):this.attr(n,t[n]);return this}return o=Z.getElementById(n[2]),o&&o.parentNode&&(this.length=1,this[0]=o),this.context=Z,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):J.isFunction(e)?"undefined"!=typeof le.ready?le.ready(e):e(J):(void 0!==e.selector&&(this.selector=e.selector,this.context=e.context),J.makeArray(e,this))};ce.prototype=J.fn,le=J(Z);var de=/^(?:parents|prev(?:Until|All))/,pe={children:!0,contents:!0,next:!0,prev:!0};J.extend({dir:function(e,t,n){for(var o=[],i=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(i&&J(e).is(n))break;o.push(e)}return o},sibling:function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}}),J.fn.extend({has:function(e){var t=J(e,this),n=t.length;return this.filter(function(){for(var e=0;n>e;e++)if(J.contains(this,t[e]))return!0})},closest:function(e,t){for(var n,o=0,i=this.length,a=[],r=ae.test(e)||"string"!=typeof e?J(e,t||this.context):0;i>o;o++)for(n=this[o];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(r?r.index(n)>-1:1===n.nodeType&&J.find.matchesSelector(n,e))){a.push(n);break}return this.pushStack(a.length>1?J.unique(a):a)},index:function(e){return e?"string"==typeof e?z.call(J(e),this[0]):z.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(J.unique(J.merge(this.get(),J(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),J.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return J.dir(e,"parentNode")},parentsUntil:function(e,t,n){return J.dir(e,"parentNode",n)},next:function(e){return i(e,"nextSibling")},prev:function(e){return i(e,"previousSibling")},nextAll:function(e){return J.dir(e,"nextSibling")},prevAll:function(e){return J.dir(e,"previousSibling")},nextUntil:function(e,t,n){return J.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return J.dir(e,"previousSibling",n)},siblings:function(e){return J.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return J.sibling(e.firstChild)},contents:function(e){return e.contentDocument||J.merge([],e.childNodes)}},function(e,t){J.fn[e]=function(n,o){var i=J.map(this,t,n);return"Until"!==e.slice(-5)&&(o=n),o&&"string"==typeof o&&(i=J.filter(o,i)),this.length>1&&(pe[e]||J.unique(i),de.test(e)&&i.reverse()),this.pushStack(i)}});var he=/\S+/g,fe={};J.Callbacks=function(e){e="string"==typeof e?fe[e]||a(e):J.extend({},e);var t,n,o,i,r,s,l=[],u=!e.once&&[],c=function(a){for(t=e.memory&&a,n=!0,s=i||0,i=0,r=l.length,o=!0;l&&r>s;s++)if(l[s].apply(a[0],a[1])===!1&&e.stopOnFalse){t=!1;break}o=!1,l&&(u?u.length&&c(u.shift()):t?l=[]:d.disable())},d={add:function(){if(l){var n=l.length;!function a(t){J.each(t,function(t,n){var o=J.type(n);"function"===o?e.unique&&d.has(n)||l.push(n):n&&n.length&&"string"!==o&&a(n)})}(arguments),o?r=l.length:t&&(i=n,c(t))}return this},remove:function(){return l&&J.each(arguments,function(e,t){for(var n;(n=J.inArray(t,l,n))>-1;)l.splice(n,1),o&&(r>=n&&r--,s>=n&&s--)}),this},has:fun
for(n.finish=!0,J.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=a.length;t--;)a[t].elem===this&&a[t].queue===e&&(a[t].anim.stop(!0),a.splice(t,1));for(t=0;r>t;t++)o[t]&&o[t].finish&&o[t].finish.call(this);delete n.finish})}}),J.each(["toggle","show","hide"],function(e,t){var n=J.fn[t];J.fn[t]=function(e,o,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(S(t,!0),e,o,i)}}),J.each({slideDown:S("show"),slideUp:S("hide"),slideToggle:S("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){J.fn[e]=function(e,n,o){return this.animate(t,e,n,o)}}),J.timers=[],J.fx.tick=function(){var e,t=0,n=J.timers;for(Ge=J.now();t<n.length;t++)e=n[t],e()||n[t]!==e||n.splice(t--,1);n.length||J.fx.stop(),Ge=void 0},J.fx.timer=function(e){J.timers.push(e),e()?J.fx.start():J.timers.pop()},J.fx.interval=13,J.fx.start=function(){Ze||(Ze=setInterval(J.fx.tick,J.fx.interval))},J.fx.stop=function(){clearInterval(Ze),Ze=null},J.fx.speeds={slow:600,fast:200,_default:400},J.fn.delay=function(e,t){return e=J.fx?J.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var o=setTimeout(t,e);n.stop=function(){clearTimeout(o)}})},function(){var e=Z.createElement("input"),t=Z.createElement("select"),n=t.appendChild(Z.createElement("option"));e.type="checkbox",G.checkOn=""!==e.value,G.optSelected=n.selected,t.disabled=!0,G.optDisabled=!n.disabled,e=Z.createElement("input"),e.value="t",e.type="radio",G.radioValue="t"===e.value}();var ot,it,at=J.expr.attrHandle;J.fn.extend({attr:function(e,t){return be(this,J.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){J.removeAttr(this,e)})}}),J.extend({attr:function(e,t,n){var o,i,a=e.nodeType;return e&&3!==a&&8!==a&&2!==a?typeof e.getAttribute===ke?J.prop(e,t,n):(1===a&&J.isXMLDoc(e)||(t=t.toLowerCase(),o=J.attrHooks[t]||(J.expr.match.bool.test(t)?it:ot)),void 0===n?o&&"get"in o&&null!==(i=o.get(e,t))?i:(i=J.find.attr(e,t),null==i?void 0:i):null!==n?o&&"set"in o&&void 0!==(i=o.set(e,n,t))?i:(e.setAttribute(t,n+""),n):void J.removeAttr(e,t)):void 0},removeAttr:function(e,t){var n,o,i=0,a=t&&t.match(he);if(a&&1===e.nodeType)for(;n=a[i++];)o=J.propFix[n]||n,J.expr.match.bool.test(n)&&(e[o]=!1),e.removeAttribute(n)},attrHooks:{type:{set:function(e,t){if(!G.radioValue&&"radio"===t&&J.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}}}),it={set:function(e,t,n){return t===!1?J.removeAttr(e,n):e.setAttribute(n,n),n}},J.each(J.expr.match.bool.source.match(/\w+/g),function(e,t){var n=at[t]||J.find.attr;at[t]=function(e,t,o){var i,a;return o||(a=at[t],at[t]=i,i=null!=n(e,t,o)?t.toLowerCase():null,at[t]=a),i}});var rt=/^(?:input|select|textarea|button)$/i;J.fn.extend({prop:function(e,t){return be(this,J.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[J.propFix[e]||e]})}}),J.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(e,t,n){var o,i,a,r=e.nodeType;return e&&3!==r&&8!==r&&2!==r?(a=1!==r||!J.isXMLDoc(e),a&&(t=J.propFix[t]||t,i=J.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(o=i.set(e,n,t))?o:e[t]=n:i&&"get"in i&&null!==(o=i.get(e,t))?o:e[t]):void 0},propHooks:{tabIndex:{get:function(e){return e.hasAttribute("tabindex")||rt.test(e.nodeName)||e.href?e.tabIndex:-1}}}}),G.optSelected||(J.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null}}),J.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){J.propFix[this.toLowerCase()]=this});var st=/[\t\r\n\f]/g;J.fn.extend({addClass:function(e){var t,n,o,i,a,r,s="string"==typeof e&&e,l=0,u=this.length;if(J.isFunction(e))return this.each(function(t){J(this).addClass(e.call(this,t,this.className))});if(s)for(t=(e||"").match(he)||[];u>l;l++)if(n=this[l],o=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(st," "):" ")){for(a=0;i=t[a++];)o.indexOf(" "+i+" ")<0&&(o+=i+" ");r=J.trim(o),n.className!==r&&(n.className=r)}return this},remo
var e=n("#basicModal__action");return null!=e?(e.click(),!0):!1},d=function(){var e=n("#basicModal__cancel");return null!=e?(e.click(),!0):!1},p=function(){for(var e=n(".basicModal__button",!0),t=0;t<e.length;++t)e[t].classList.remove("basicModal__button--active");for(var o=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);var o=n().parentElement;return"false"===o.getAttribute("data-closable")&&t===!1?!1:(o.classList.remove("basicModalContainer--fadeIn"),o.classList.add("basicModalContainer--fadeOut"),setTimeout(function(){return o.parentNode.removeChild(o)},300),null!=e&&(e.focus(),e=null),!0)};return{THEME:t,show:s,visible:u,getValues:a,action:c,cancel:d,error:l,reset:p,close:h}}),function(e){var t=function(t){var n=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){var t=e.originalEvent.touches[0];this.swipeStart(e,t.pageX,t.pageY)},touchMove:function(e){var t=e.originalEvent.touches[0];this.swipeMove(e,t.pageX,t.pageY)},mouseDown:function(e){var t=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=(new Date).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){var o=this,i=e.Event(t),a=o.pos.start.x-o.pos.end.x,r=o.pos.end.y-o.pos.start.y,s=Math.atan2(r,a),l="up",u=Math.round(Math.sqrt(Math.pow(a,2)+Math.pow(r,2))),c=Math.round(180*s/Math.PI),d=Math.round(u/((new Date).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:r,direction:l,distance:u,angle:c,speed:d},e(o.el).trigger(i)}},e.fn.swipe=function(){new t(this);return this}}(jQuery),album={json:null},album.getID=function(){var e=null,t=function(e){return"0"===e||"f"===e||"s"===e||"r"===e?!0:$.isNumeric(e)};return photo.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");var n=(new Date).getTime(),o={albumID:e,password:password.value};api.post("Album::get",o,function(o){var i=0;if("Warning: Album private!"===o)return void 0!=document.location.hash.replace("#","").split("/")[1]?lychee.setMode("view"):(lychee.content.show(),lychee["goto"]("")),!1;if("Warning: Wrong password!"===o)return album.load(e,t),!1;album.json=o;var a=(new Date).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(){var e=function(e){var t=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){var t={},n={},o="";i
9 years ago
!1):visible.album()?(album.setDescription(album.getID()),!1):void 0}).bind("t",function(){return visible.photo()?(photo.editTags([photo.getID()]),!1):void 0}).bind("i",function(){return visible.multiselect()?void 0:(sidebar.toggle(),!1)}).bind(["command+backspace","ctrl+backspace"],function(){return visible.photo()&&!visible.message()?(photo["delete"]([photo.getID()]),!1):visible.album()&&!visible.message()?(album["delete"]([album.getID()]),!1):void 0}).bind(["command+a","ctrl+a"],function(){return visible.album()&&!visible.message()?(multiselect.selectAll(),!1):visible.albums()&&!visible.message()?(multiselect.selectAll(),!1):void 0}),Mousetrap.bindGlobal("enter",function(){basicModal.visible()===!0&&basicModal.action()}),Mousetrap.bindGlobal(["esc","command+up"],function(){return basicModal.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){return 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")),!1}),lychee.init()}),loadingBar={status:null,_dom:$("#loading")},loadingBar.dom=function(e){return null==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(){return loadingBar.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):void 0},loadingBar.hide=function(e){("error"!==loadingBar.status&&null!==loadingBar.status||e)&&(loadingBar.status=null,header.dom().removeClass("error loading"),clearTimeout(loadingBar._timeout),setTimeout(function(){return loadingBar.dom().hide()},300))},lychee={title:document.title,version:"3.0.4",version_code:"030004",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,checkForUpdates:"1",sortingPhotos:"",sortingAlbums:"",location:"",dropbox:!1,dropboxKey:"",content:$("#content"),imageview:$("#imageview")},lychee.init=function(){var e={version:lychee.version_code};api.post("Session::init",e,function(e){if(2===e.status)lychee.sortingPhotos=e.config.sortingPhotos||"",lychee.sortingAlbums=e.config.sortingAlbums||"",lychee.dropboxKey=e.config.dropboxKey||"",lychee.location=e.config.locati
$(".basicModal select#settings_photos_type").val(e[0]),$(".basicModal select#settings_photos_order").val(e[1]))},settings.setDropboxKey=function(e){var t=function(t){var n=t.key;return t.key.length<1?(basicModal.error("key"),!1):(basicModal.close(),void api.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){return null==e||""===e?sidebar._dom:sidebar._dom.find(e)},sidebar.bind=function(){var e=lychee.getEventName();return sidebar.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(){return visible.sidebar()||visible.sidebarbutton()?(header.dom(".button--info").toggleClass("active"),lychee.content.toggleClass("sidebar"),sidebar.dom().toggleClass("active"),!0):!1},sidebar.setSelectable=function(){var e=void 0===arguments[0]?!0:arguments[0];e===!0?sidebar.dom().removeClass("notSelectable"):sidebar.dom().addClass("notSelectable")},sidebar.changeAttr=function(e){var t=void 0===arguments[1]?"-":arguments[1];return null==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;var t=!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="-"}return o.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}]},o.tags=lychee.publicMode===!1?{title:"Tags",type:sidebar.types.TAGS,value:build.tags(e.tags),editable:t}:{},o.exif="0"!==n?{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.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;var t=!1,n={},o="",i="",a="",r="";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":i="Yes";break;default:i="-"}switch(e.downloadable){case"0":a="No";break;case"1":a="Yes";break;default:a="-"}switch(e.password){case"0":r="No";break;case"1":r="Yes";break;default:r="-"}return n.basics={title:"Basics",type:sidebar.types.DEFAULT,rows:[{title:"Title",value:e.title,editable:t},{title:"Description",value:e.description,editable:t}]},n.album={title:"Album",type:sidebar.types.DEFAULT,rows:[{title:"Created",value:e.sysdate},{title:"Images",valu