lychee/dist/main.js

6 lines
166 KiB
JavaScript
Raw Normal View History

2015-01-22 20:29:05 +00:00
function mobileBrowser(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)?!0:!1}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=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(st.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 r(e){var t=ft[e]={};return J.each(e.match(ht)||[],function(e,n){t[n]=!0}),t}function a(){Q.removeEventListener("DOMContentLoaded",a,!1),e.removeEventListener("load",a,!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(wt,"-$1").toLowerCase(),n=e.getAttribute(o),"string"==typeof n){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)}else n=void 0;return n}function u(){return!0}function c(){return!1}function d(){try{return Q.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=Lt.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++)bt.set(e[n],"globalEval",!t||bt.get(t[n],"globalEval"))}function g(e,t){var n,o,i,r,a,s,l,u;if(1===t.nodeType){if(bt.hasData(e)&&(r=bt.access(e),a=bt.set(t,r),u=r.events)){delete a.handle,a.events={};for(i in u)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))}}function b(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&&jt.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),r=e.getDefaultComputedStyle&&(o=e.getDefaultComputedStyle(i[0]))?o.display:J.css(i[0],"display");return i.detach(),r}function w(e){var t=Q,n=Ht[e];return n||(n=y(e,t),"none"!==n&&n||(Rt=(Rt||J("<iframe frameborder='0' width='0' height='0'/>")).appendTo(t.documentElement),t=Rt[0].contentDocument,t.write(),t.close(),n=y(e,t),Rt.detach()),Ht[e]=n),n}function x(e,t,n){var o,i,r,a,s=e.style;return n=n||Ut(e),n&&(a=n.getPropertyValue(t)||n[t]),n&&(""!==a||J.contains(e.ownerDocument,e)||(a=J.style(e,t)),Bt.test(a)&&Ft.test(t)&&(o=s.width,i=s.minWidth,r=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=o,s.minWidth=i,s.maxWidth=r)),void 0!==a?a+"":a}function T(e,t){return{get:function(){return e()?void delete this.get:(this.get=t).apply(this,arguments)}}}function C(e,t){if(t in e)return t;for(var n=t[0].toUpperCase()+t.slice(1),o=t,i=Vt.length;i--;)if(t=Vt[i]+n,t in e)return t;return o}function j(e,t,n){var o=Xt.exec(t);return o?Math.max(0,o[1]-(n||0))+(o[2]||"px"):t}function k(e,t,n,o,i){for(var r=n===(o?"border":"content")?4:"width"===t?1:0,a=0;4>r;r+=2)"margin"===n&&(a+=J.css(e,n+Tt[r],!0,i)),o?("content"===n&&(a-=J.css(e,"padding"+Tt[r],!0,i)),"margin"!==n&&(a-=J.css(e,"border"+Tt[r]+"Width",!0,i))):(a+=J.css(e,"padding"+Tt[r],!0,i),"p
J.filter=function(e,t,n){var o=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===o.nodeType?J.find.matchesSelector(o,e)?[o]:[]:J.find.matches(e,J.grep(t,function(e){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&&rt.test(e)?J(e):e||[],!1).length}});var lt,ut=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,ct=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]:ut.exec(e),!n||!n[1]&&t)return!t||t.jquery?(t||lt).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:Q,!0)),at.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=Q.getElementById(n[2]),o&&o.parentNode&&(this.length=1,this[0]=o),this.context=Q,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):J.isFunction(e)?"undefined"!=typeof lt.ready?lt.ready(e):e(J):(void 0!==e.selector&&(this.selector=e.selector,this.context=e.context),J.makeArray(e,this))};ct.prototype=J.fn,lt=J(Q);var dt=/^(?:parents|prev(?:Until|All))/,pt={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,r=[],a=rt.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&&(a?a.index(n)>-1:1===n.nodeType&&J.find.matchesSelector(n,e))){r.push(n);break}return this.pushStack(r.length>1?J.unique(r):r)},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&&(pt[e]||J.unique(i),dt.test(e)&&i.reverse()),this.pushStack(i)}});var ht=/\S+/g,ft={};J.Callbacks=function(e){e="string"==typeof e?ft[e]||r(e):J.extend({},e);var t,n,o,i,a,s,l=[],u=!e.once&&[],c=function(r){for(t=e.memory&&r,n=!0,s=i||0,i=0,a=l.length,o=!0;l&&a>s;s++)if(l[s].apply(r[0],r[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 r(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&&r(n)})}(arguments),o?a=l.length:t&&(i=n,c
(t||!n)&&J.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=bt.get(this),o=n[e+"queue"],i=n[e+"queueHooks"],r=J.timers,a=o?o.length:0;for(n.finish=!0,J.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=r.length;t--;)r[t].elem===this&&r[t].queue===e&&(r[t].anim.stop(!0),r.splice(t,1));for(t=0;a>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(A(t,!0),e,o,i)}}),J.each({slideDown:A("show"),slideUp:A("hide"),slideToggle:A("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(Gt=J.now();t<n.length;t++)e=n[t],e()||n[t]!==e||n.splice(t--,1);n.length||J.fx.stop(),Gt=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(){Qt||(Qt=setInterval(J.fx.tick,J.fx.interval))},J.fx.stop=function(){clearInterval(Qt),Qt=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=Q.createElement("input"),t=Q.createElement("select"),n=t.appendChild(Q.createElement("option"));e.type="checkbox",G.checkOn=""!==e.value,G.optSelected=n.selected,t.disabled=!0,G.optDisabled=!n.disabled,e=Q.createElement("input"),e.value="t",e.type="radio",G.radioValue="t"===e.value}();var on,rn,an=J.expr.attrHandle;J.fn.extend({attr:function(e,t){return gt(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,r=e.nodeType;return e&&3!==r&&8!==r&&2!==r?typeof e.getAttribute===kt?J.prop(e,t,n):(1===r&&J.isXMLDoc(e)||(t=t.toLowerCase(),o=J.attrHooks[t]||(J.expr.match.bool.test(t)?rn:on)),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,r=t&&t.match(ht);if(r&&1===e.nodeType)for(;n=r[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}}}}}),rn={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=an[t]||J.find.attr;an[t]=function(e,t,o){var i,r;return o||(r=an[t],an[t]=i,i=null!=n(e,t,o)?t.toLowerCase():null,an[t]=r),i}});var sn=/^(?:input|select|textarea|button)$/i;J.fn.extend({prop:function(e,t){return gt(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,r,a=e.nodeType;return e&&3!==a&&8!==a&&2!==a?(r=1!==a||!J.isXMLDoc(e),r&&(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")||sn.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 ln=/[\t\r\n\f]/g;J.fn.extend({addClass:function(e){var t,n,o,i,r,a,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(ht)||[];u>l;l++)if(n=this[l],o=1===n.nod
BrowserDetect.init(),function(e){e.fn.retina=function(t){var n={"retina-background":!1,"retina-suffix":"@2x"};t&&e.extend(n,t);var o=function(e,t){var n=new Image;n.onload=function(){t(n)},n.src=e};window.devicePixelRatio>1&&this.each(function(){var t=e(this);if("img"==this.tagName.toLowerCase()&&t.attr("src")){var i=t.attr("src").replace(/\.(?!.*\.)/,n["retina-suffix"]+".");o(i,function(n){t.attr("src",n.src);var o=e("<div>").append(t.clone()).remove().html();/(width|height)=["']\d+["']/.test(o)||t.attr("width",n.width/2)})}if(n["retina-background"]){var r=t.css("background-image");if(/^url\(.*\)$/.test(r)){var i=r.substring(4,r.length-1).replace(/\.(?!.*\.)/,n["retina-suffix"]+".");o(i,function(e){t.css("background-image","url("+e.src+")"),"auto auto"==t.css("background-size")&&t.css("background-size",e.width/2+"px auto")})}}})}}(jQuery),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(){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),r=o.pos.start.x-o.pos.end.x,a=o.pos.end.y-o.pos.start.y,s=Math.atan2(a,r),l="up",u=Math.round(Math.sqrt(Math.pow(r,2)+Math.pow(a,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:r,y:a,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;return e=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},album.load=function(e,t){var n,o,i,r;password.get(e,function(){t||(lychee.animate(".album, .photo","contentZoomOut"),lychee.animate(".divider","fadeOut")),n=(new Date).getTime(),o="getAlbum&albumID="+e+"&password="+password.value,lychee.api(o,function(o){return"Warning: Album private!"===o?(void 0!=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=(new Date).getTime()-n,r=i>300?0:300-i,t===!0&&(r=0),visible.albums()||visible.photo()||visible.album()||(r=0),void setTimeout(function(){view.album.init(),t||(lychee.animate(".album, .photo","contentZoomIn"),view.header.mode("album"))},r))})})},album.parse=function(){album.json.title||(album.json.title="Untitled")},album.add=function(){var e,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)},album.dele
},multiselect.getSelection=function(e){var t,n,o=150,i=[],r=multiselect.getSize();return visible.contextMenu()?!1:visible.multiselect()?($(".photo, .album").each(function(){n=$(this).offset(),n.top>=r.top-o&&n.left>=r.left-o&&n.top+206<=r.top+r.height+o&&n.left+206<=r.left+r.width+o&&(t=$(this).data("id"),"0"!==t&&0!==t&&"f"!==t&&"s"!==t&&"r"!==t&&null!==t&&void 0!==t&&(i.push(t),$(this).addClass("active")))}),void(0!==i.length&&visible.album()?contextMenu.photoMulti(i,e):0!==i.length&&visible.albums()?contextMenu.albumMulti(i,e):multiselect.close())):!1},multiselect.close=function(){multiselect.stopResize(),multiselect.position.top=null,multiselect.position.right=null,multiselect.position.bottom=null,multiselect.position.left=null,lychee.animate("#multiselect","fadeOut"),setTimeout(function(){$("#multiselect").remove()},300)},password={value:""},password.get=function(e,t){var n,o=$(".message input.text").val();lychee.publicMode?album.json&&0==album.json.password?t():albums.json&&0==albums.json.content[e].password?t():albums.json||album.json?void 0==o?password.getDialog(e,t):(n="checkAlbumAccess&albumID="+e+"&password="+md5(o),lychee.api(n,function(e){e===!0?(password.value=md5(o),t()):(lychee.goto(""),loadingBar.show("error","Access denied. Wrong password!"))})):(album.json={password:!0},t("")):t()},password.getDialog=function(e,t){var n;n=[["Enter",function(){password.get(e,t)}],["Cancel",lychee.goto]],modal.show("<a class='icon-lock'></a> Enter Password","This album is protected by a password. Enter the password below to view the photos of this album: <input class='text' type='password' placeholder='password' value=''>",n,-110,!1)},photo={json:null,cache:null},photo.getID=function(){var e;return e=photo.json?photo.json.id:$(".photo:hover, .photo.active").attr("data-id"),e?e:!1},photo.load=function(e,t){var n,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(),void setTimeout(function(){lychee.content.show()},300))})},photo.preloadNext=function(e){var t,n;return mobileBrowser()?!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=new Image,photo.cache.src=n,photo.cache.onload=function(){photo.cache=null}))},photo.parse=function(){photo.json.title||(photo.json.title="Untitled")},photo.previous=function(e){var t=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(){return photo.getID()===!1?!1:void lychee.goto(album.getID()+"/"+album.json.content[photo.getID()].previousPhoto)},t))},photo.next=function(e){var t=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(){return photo.getID()===!1?!1:void lychee.goto(album.getID()+"/"+album.json.content[photo.getID()].nextPhoto)},t))},photo.duplicate=function(e){var t;return e?(e instanceof Array==!1&&(e=[e]),albums.refresh(),t="duplicatePhoto&photoIDs="+e,void lychee.api(t,function(e){e!==!0?lychee.error(null,t,e):album.load(album.getID())})):!1},photo.delete=function(e){var t,n,o;return e?(e instanceof Array==!1&&(e=[e]),1===e.length&&(o=visible.photo()?photo.json.title:album.json.content[e].title,""===o&&(o="Untitled")),n=[["",function(){var n="",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,
},tags:function(){$("#infobox #tags").html(build.tags(photo.json.tags))},photo:function(){lychee.imageview.html(build.imageview(photo.json,photo.getSize(),visible.controls())),(album.json&&album.json.content&&album.json.content[photo.getID()]&&""===album.json.content[photo.getID()].nextPhoto||lychee.viewMode)&&$("a#next").hide(),(album.json&&album.json.content&&album.json.content[photo.getID()]&&""===album.json.content[photo.getID()].previousPhoto||lychee.viewMode)&&$("a#previous").hide()},infobox:function(){lychee.infobox.html(build.infoboxPhoto(photo.json)).show()}},visible={},visible.albums=function(){return"block"===$("#tools_albums").css("display")?!0:!1},visible.album=function(){return"block"===$("#tools_album").css("display")?!0:!1},visible.photo=function(){return $("#imageview.fadeIn").length>0?!0:!1},visible.search=function(){return null!==search.code&&""!==search.code?!0:!1},visible.infobox=function(){return $("#infobox.active").length>0?!0:!1},visible.infoboxbutton=function(){return visible.albums()?!1:visible.photo()?!0:visible.album()&&$("#button_info_album:visible").length>0?!0:!1},visible.controls=function(){return lychee.loadingBar.css("opacity")<1?!1:!0},visible.message=function(){return $(".message").length>0?!0:!1},visible.signin=function(){return $(".message .sign_in").length>0?!0:!1},visible.contextMenu=function(){return basicContext.visible()},visible.multiselect=function(){return $("#multiselect").length>0?!0:!1},window.build={},build.divider=function(e){return"<div class='divider fadeIn'><h1>"+e+"</h1></div>"},build.editIcon=function(e){return"<div id='"+e+"' class='edit'><a class='icon-pencil'></a></div>"},build.multiselect=function(e,t){return"<div id='multiselect' style='top: "+e+"px; left: "+t+"px;'></div>"},build.album=function(e){var t,n,o,i;return null==e?"":(o=e.title,n="",i="",null!=o&&o.length>18&&(o=e.title.substr(0,18)+"...",n=e.title),"svg"===e.thumb0.split(".").pop()&&(i="nonretina"),t="<div class='album' data-id='"+e.id+"' data-password='"+e.password+"'>\n <img src='"+e.thumb2+"' width='200' height='200' alt='thumb' data-type='nonretina'>\n <img src='"+e.thumb1+"' width='200' height='200' alt='thumb' data-type='nonretina'>\n <img src='"+e.thumb0+"' width='200' height='200' alt='thumb' data-type='"+i+"'>\n <div class='overlay'>",t+=e.password&&lychee.publicMode===!1?"<h1 title='"+n+"'><span class='icon-lock'></span> "+o+"</h1>":"<h1 title='"+n+"'>"+o+"</h1>",t+=" <a>"+e.sysdate+"</a>\n</div>",lychee.publicMode===!1&&("1"===e.star&&(t+="<a class='badge icon-star'></a>"),"1"===e["public"]&&(t+="<a class='badge icon-share'></a>"),"1"===e.unsorted&&(t+="<a class='badge icon-reorder'></a>"),"1"===e.recent&&(t+="<a class='badge icon-time'></a>")),t+="</div>")},build.photo=function(e){var t,n,o;return null==e?"":(o=e.title,n="",null!=o&&o.length>18&&(o=e.title.substr(0,18)+"...",n=e.title),t="<div class='photo' data-album-id='"+e.album+"' data-id='"+e.id+"'>\n <img src='"+e.thumbUrl+"' width='200' height='200' alt='thumb'>\n <div class='overlay'>\n <h1 title='"+n+"'>"+o+"</h1>",t+="1"===e.cameraDate?"<a><span class='icon-camera' title='Photo Date'></span>"+e.sysdate+"</a>":"<a>"+e.sysdate+"</a>",t+="</div>","1"===e.star&&(t+="<a class='badge icon-star'></a>"),lychee.publicMode===!1&&"1"===e["public"]&&"1"!==album.json["public"]&&(t+="<a class='badge icon-share'></a>"),t+="</div>")},build.imageview=function(e,t,n){var o;return null==e?"":(o="<div class='arrow_wrapper previous'><a id='previous' class='icon-caret-left'></a></div>\n<div class='arrow_wrapper next'><a id='next' class='icon-caret-right'></a></div>","big"===t?o+=n===!0?"<div id='image' style='background-image: url("+e.url+")'></div>":"<div id='image' style='background-image: url("+e.url+");' class='full'></div>":"medium"===t?o+=n===!0?"<div id='image' style='background-image: url("+e.medium+")'></div>":"<div id='image' style='background-image: url("+e.medium+");' class='full'></div>":"small"===t&&(o+=n===!0?"<div id='image' class='small' style='background-image: url("+e.url+"); width: "+e.width+"px; height: "+e.height+"px; margi