lychee/assets/min/main.js

7 lines
163 KiB
JavaScript
Raw Normal View History

2014-04-30 08:54:45 +00:00
/*! Lychee 2.5.0 */
function mobileBrowser(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)?!0:!1}function gup(a){a=a.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var b="[\\?&]"+a+"=([^&#]*)",c=new RegExp(b),d=c.exec(window.location.href);return null===d?"":d[1]}!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){function c(a){var b=a.length,c=_.type(a);return"function"===c||_.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}function d(a,b,c){if(_.isFunction(b))return _.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return _.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(hb.test(b))return _.filter(b,a,c);b=_.filter(b,a)}return _.grep(a,function(a){return U.call(b,a)>=0!==c})}function e(a,b){for(;(a=a[b])&&1!==a.nodeType;);return a}function f(a){var b=ob[a]={};return _.each(a.match(nb)||[],function(a,c){b[c]=!0}),b}function g(){Z.removeEventListener("DOMContentLoaded",g,!1),a.removeEventListener("load",g,!1),_.ready()}function h(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=_.expando+Math.random()}function i(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(ub,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:tb.test(c)?_.parseJSON(c):c}catch(e){}sb.set(a,b,c)}else c=void 0;return c}function j(){return!0}function k(){return!1}function l(){try{return Z.activeElement}catch(a){}}function m(a,b){return _.nodeName(a,"table")&&_.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function n(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function o(a){var b=Kb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function p(a,b){for(var c=0,d=a.length;d>c;c++)rb.set(a[c],"globalEval",!b||rb.get(b[c],"globalEval"))}function q(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(rb.hasData(a)&&(f=rb.access(a),g=rb.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)_.event.add(b,e,j[e][c])}sb.hasData(a)&&(h=sb.access(a),i=_.extend({},h),sb.set(b,i))}}function r(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&_.nodeName(a,b)?_.merge([a],c):c}function s(a,b){var c=b.nodeName.toLowerCase();"input"===c&&yb.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}function t(b,c){var d,e=_(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:_.css(e[0],"display");return e.detach(),f}function u(a){var b=Z,c=Ob[a];return c||(c=t(a,b),"none"!==c&&c||(Nb=(Nb||_("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=Nb[0].contentDocument,b.write(),b.close(),c=t(a,b),Nb.detach()),Ob[a]=c),c}function v(a,b,c){var d,e,f,g,h=a.style;return c=c||Rb(a),c&&(g=c.getPropertyValue(b)||c[b]),c&&(""!==g||_.contains(a.ownerDocument,a)||(g=_.style(a,b)),Qb.test(g)&&Pb.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+"":g}function w(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}function x(a,b){if(b in a)return b;for(var c=b[0].toUpperCase()+b.slice(1),d=b,e=Xb.length;e--;)if(b=Xb[e]+c,b in a)return b;return d}function y(a,b,c){var d=Tb.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function z(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=_.css(a,c+wb[f],!0,e)),d?("content"===c&&(g-=_.css(a,"padding"+wb[f],!0,e)),"margin"!==c&&(g-=_.css(a,"border"+wb[f]+"Width",!0,e))):(g+=_.css(a,"padding"+wb[f],!0
}))},_.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(_(a).filter(function(){for(b=0;c>b;b++)if(_.contains(e[b],this))return!0}));for(b=0;c>b;b++)_.find(a,e[b],d);return d=this.pushStack(c>1?_.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(d(this,a||[],!1))},not:function(a){return this.pushStack(d(this,a||[],!0))},is:function(a){return!!d(this,"string"==typeof a&&fb.test(a)?_(a):a||[],!1).length}});var ib,jb=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,kb=_.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:jb.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||ib).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof _?b[0]:b,_.merge(this,_.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:Z,!0)),gb.test(c[1])&&_.isPlainObject(b))for(c in b)_.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=Z.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=Z,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):_.isFunction(a)?"undefined"!=typeof ib.ready?ib.ready(a):a(_):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),_.makeArray(a,this))};kb.prototype=_.fn,ib=_(Z);var lb=/^(?:parents|prev(?:Until|All))/,mb={children:!0,contents:!0,next:!0,prev:!0};_.extend({dir:function(a,b,c){for(var d=[],e=void 0!==c;(a=a[b])&&9!==a.nodeType;)if(1===a.nodeType){if(e&&_(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),_.fn.extend({has:function(a){var b=_(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(_.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=fb.test(a)||"string"!=typeof a?_(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&_.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?_.unique(f):f)},index:function(a){return a?"string"==typeof a?U.call(_(a),this[0]):U.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(_.unique(_.merge(this.get(),_(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}}),_.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return _.dir(a,"parentNode")},parentsUntil:function(a,b,c){return _.dir(a,"parentNode",c)},next:function(a){return e(a,"nextSibling")},prev:function(a){return e(a,"previousSibling")},nextAll:function(a){return _.dir(a,"nextSibling")},prevAll:function(a){return _.dir(a,"previousSibling")},nextUntil:function(a,b,c){return _.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return _.dir(a,"previousSibling",c)},siblings:function(a){return _.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return _.sibling(a.firstChild)},contents:function(a){return a.contentDocument||_.merge([],a.childNodes)}},function(a,b){_.fn[a]=function(c,d){var e=_.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=_.filter(d,e)),this.length>1&&(mb[a]||_.unique(e),lb.test(a)&&e.reverse()),this.pushStack(e)}});var nb=/\S+/g,ob={};_.Callbacks=function(a){a="string"==typeof a?ob[a]||f(a):_.extend({},a);var b,c,d,e,g,h,i=[],j=!a.once&&[],k=function(f){for(b=a.memory&&f,c=!0,h=e||0,e=0,g=i.length,d=!0;i&&g>h;h++)if(i[h].apply(f[0],f[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,i&&(j?j.length&&k(j.shift()):b?i=[]:l.disable())},l={add:function(){if(i){var c=i.length;!function f(b){_.each(b,function(b,c){var d=_.type(c);"function"===d?a.unique&&l.has(c)||i.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),d?g=i.length:b&&(e=c,k(b))}return this},remove:function(){return i&&_.each(arguments,function(a,b){for(var c;(c=_.inArray(b,i,c))>-1;)i.splice(c,1),d&&(g>=c&&g--,h>=c&&h--)}),this},has:function(a){return a?_.i
for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),_.each(["toggle","show","hide"],function(a,b){var c=_.fn[b];_.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(E(b,!0),a,d,e)}}),_.each({slideDown:E("show"),slideUp:E("hide"),slideToggle:E("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){_.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),_.timers=[],_.fx.tick=function(){var a,b=0,c=_.timers;for(Yb=_.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||_.fx.stop(),Yb=void 0},_.fx.timer=function(a){_.timers.push(a),a()?_.fx.start():_.timers.pop()},_.fx.interval=13,_.fx.start=function(){Zb||(Zb=setInterval(_.fx.tick,_.fx.interval))},_.fx.stop=function(){clearInterval(Zb),Zb=null},_.fx.speeds={slow:600,fast:200,_default:400},_.fn.delay=function(a,b){return a=_.fx?_.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a=Z.createElement("input"),b=Z.createElement("select"),c=b.appendChild(Z.createElement("option"));a.type="checkbox",Y.checkOn=""!==a.value,Y.optSelected=c.selected,b.disabled=!0,Y.optDisabled=!c.disabled,a=Z.createElement("input"),a.value="t",a.type="radio",Y.radioValue="t"===a.value}();var dc,ec,fc=_.expr.attrHandle;_.fn.extend({attr:function(a,b){return qb(this,_.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){_.removeAttr(this,a)})}}),_.extend({attr:function(a,b,c){var d,e,f=a.nodeType;return a&&3!==f&&8!==f&&2!==f?typeof a.getAttribute===zb?_.prop(a,b,c):(1===f&&_.isXMLDoc(a)||(b=b.toLowerCase(),d=_.attrHooks[b]||(_.expr.match.bool.test(b)?ec:dc)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=_.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void _.removeAttr(a,b)):void 0},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(nb);if(f&&1===a.nodeType)for(;c=f[e++];)d=_.propFix[c]||c,_.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)},attrHooks:{type:{set:function(a,b){if(!Y.radioValue&&"radio"===b&&_.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),ec={set:function(a,b,c){return b===!1?_.removeAttr(a,c):a.setAttribute(c,c),c}},_.each(_.expr.match.bool.source.match(/\w+/g),function(a,b){var c=fc[b]||_.find.attr;fc[b]=function(a,b,d){var e,f;return d||(f=fc[b],fc[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,fc[b]=f),e}});var gc=/^(?:input|select|textarea|button)$/i;_.fn.extend({prop:function(a,b){return qb(this,_.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[_.propFix[a]||a]})}}),_.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;return a&&3!==g&&8!==g&&2!==g?(f=1!==g||!_.isXMLDoc(a),f&&(b=_.propFix[b]||b,e=_.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]):void 0},propHooks:{tabIndex:{get:function(a){return a.hasAttribute("tabindex")||gc.test(a.nodeName)||a.href?a.tabIndex:-1}}}}),Y.optSelected||(_.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null}}),_.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){_.propFix[this.toLowerCase()]=this});var hc=/[\t\r\n\f]/g;_.fn.extend({addClass:function(a){var b,c,d,e,f,g,h="string"==typeof a&&a,i=0,j=this.length;if(_.isFunction(a))return this.each(function(b){_(this).addClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(nb)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(hc," "):" ")){for(f=0;e=b[f++];)d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=_.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0===arguments.length||"string"==typeof a&&a,i=0,j=this.length;if(_.isFunction(a))return this.each(function(b){_(th
},searchString:function(a){for(var b=0;b<a.length;b++){var c=a[b].string,d=a[b].prop;if(this.versionSearchString=a[b].versionSearch||a[b].identity,c){if(-1!=c.indexOf(a[b].subString))return a[b].identity}else if(d)return a[b].identity}},searchVersion:function(a){var b=a.indexOf(this.versionSearchString);if(-1!=b)return parseFloat(a.substring(b+this.versionSearchString.length+1))},dataBrowser:[{string:navigator.userAgent,subString:"Chrome",identity:"Chrome"},{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari",versionSearch:"Version"},{prop:window.opera,identity:"Opera"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.userAgent,subString:"iPhone",identity:"iPhone/iPod"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]};BrowserDetect.init(),function(a){a.fn.retina=function(b){var c={"retina-background":!1,"retina-suffix":"@2x"};b&&a.extend(c,b);var d=function(a,b){var c=new Image;c.onload=function(){b(c)},c.src=a};window.devicePixelRatio>1&&this.each(function(){var b=a(this);if("img"==this.tagName.toLowerCase()&&b.attr("src")){var e=b.attr("src").replace(/\.(?!.*\.)/,c["retina-suffix"]+".");d(e,function(c){b.attr("src",c.src);var d=a("<div>").append(b.clone()).remove().html();/(width|height)=["']\d+["']/.test(d)||b.attr("width",c.width/2)})}if(c["retina-background"]){var f=b.css("background-image");if(/^url\(.*\)$/.test(f)){var e=f.substring(4,f.length-1).replace(/\.(?!.*\.)/,c["retina-suffix"]+".");d(e,function(a){b.css("background-image","url("+a.src+")"),"auto auto"==b.css("background-size")&&b.css("background-size",a.width/2+"px auto")})}}})}}(jQuery),function(a){var b=function(b){var c=this;this.el=a(b),this.pos={start:{x:0,y:0},end:{x:0,y:0}},this.startTime,b.on("touchstart",function(a){c.touchStart(a)}),b.on("touchmove",function(a){c.touchMove(a)}),b.on("touchend",function(){c.swipeEnd()}),b.on("mousedown",function(a){c.mouseDown(a)})};b.prototype={touchStart:function(a){var b=a.originalEvent.touches[0];this.swipeStart(a,b.pageX,b.pageY)},touchMove:function(a){var b=a.originalEvent.touches[0];this.swipeMove(a,b.pageX,b.pageY)},mouseDown:function(a){var b=this;this.swipeStart(a,a.pageX,a.pageY),this.el.on("mousemove",function(a){b.mouseMove(a)}),this.el.on("mouseup",function(){b.mouseUp()})},mouseMove:function(a){this.swipeMove(a,a.pageX,a.pageY)},mouseUp:function(a){this.swipeEnd(a),this.el.off("mousemove"),this.el.off("mouseup")},swipeStart:function(a,b,c){this.pos.start.x=b,this.pos.start.y=c,this.pos.end.x=b,this.pos.end.y=c,this.startTime=(new Date).getTime(),this.trigger("swipeStart",a)},swipeMove:function(a,b,c){this.pos.end.x=b,this.pos.end.y=c,this.trigger("swipeMove",a)},swipeEnd:function(a){this.trigger("swipeEnd",a)},trigger:function(b,c){var d=this,e=a.Event(b),f=d.pos.start.x-d.pos.end.x,g=d.pos.end.y-d.pos.start.y,h=Math.atan2(g,f),i="up",j=Math.round(Math.sqrt(Math.pow(f,2)+Math.pow(g,2))),k=Math.round(180*h/Math.PI),l=Math.round(j/((new Date).getTime()-d.startTime)*1e3);0>k&&(k=360-Math.abs(k)),45>=k&&k>=0||360>=k&&k>=315?i="left":k>=135&&225>=k?i="right":k>45&&135>k&&(i="down"),e.originalEvent=c,e.swipe={x:f,y:g,direction:i,distance:j,angle:k,speed:l},a(d.el).trigger(e)}},a.fn.swipe=function(){new b(this);return this}}(jQuery),album={json:null,getID:function(){var a;return a=photo.json?photo.json.album:album.
},300))}};var lychee={title:"",version:"2.5.5",version_code:"020505",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:"",dropbox:!1,dropboxKey:"",loadingBar:$("#loading"),header:$("header"),content:$("#content"),imageview:$("#imageview"),infobox:$("#infobox"),init:function(){var a;a="init&version="+lychee.version_code,lychee.api(a,function(a){return a.loggedIn!==!0?lychee.setMode("public"):(lychee.username=a.config.username||"",lychee.sorting=a.config.sorting||"",lychee.dropboxKey=a.config.dropboxKey||""),"Warning: No configuration!"===a?(lychee.header.hide(),lychee.content.hide(),$("body").append(build.no_content("cog")),settings.createConfig(),!0):(a.config.login===!1&&settings.createLogin(),lychee.checkForUpdates=a.config.checkForUpdates,$(window).bind("popstate",lychee.load),void lychee.load())})},api:function(a,b,c){void 0===c&&loadingBar.show(),$.ajax({type:"POST",url:lychee.api_path,data:"function="+a,dataType:"text",success:function(c){return setTimeout(function(){loadingBar.hide()},100),"string"==typeof c&&"Error: "===c.substring(0,7)?(lychee.error(c.substring(7,c.length),a,c),upload.close(!0),!1):("1"===c?c=!0:""===c&&(c=!1),"string"==typeof c&&"{"===c.substring(0,1)&&"}"===c.substring(c.length-1,c.length)&&(c=$.parseJSON(c)),lychee.debugMode&&console.log(c),void b(c))},error:function(b,c,d){lychee.error("Server error or API not found.",a,d),upload.close(!0)}})},login:function(){var a,b=$("input#username").val(),c=md5($("input#password").val());a="login&user="+b+"&password="+c,lychee.api(a,function(a){a===!0?(localStorage.setItem("lychee_username",b),window.location.reload()):($("#password").val("").addClass("error").focus(),$(".message .button.active").removeClass("pressed"))})},loginDialog:function(){var a;$("body").append(build.signInModal()),$("#username").focus(),localStorage&&(a=localStorage.getItem("lychee_username"),null!==a&&(a.length>0&&$("#username").val(a),$("#password").focus())),"1"===lychee.checkForUpdates&&lychee.getUpdate()},logout:function(){lychee.api("logout",function(){window.location.reload()})},"goto":function(a){void 0===a&&(a=""),document.location.hash=a},load:function(){var a="",b="",c=document.location.hash.replace("#","").split("/");$(".no_content").remove(),contextMenu.close(),multiselect.close(),void 0!==c[0]&&(a=c[0]),void 0!==c[1]&&(b=c[1]),a&&b?(albums.json=null,photo.json=null,(""===lychee.content.html()||$("#search").length&&0!==$("#search").val().length)&&(lychee.content.hide(),album.load(a,!0)),photo.load(b,a)):a?(albums.json=null,photo.json=null,visible.photo()&&view.photo.hide(),album.json&&a==album.json.id?view.album.title():album.load(a)):(albums.json=null,album.json=null,photo.json=null,search.code="",visible.album()&&view.album.hide(),visible.photo()&&view.photo.hide(),albums.load())},getUpdate:function(){$.ajax({url:lychee.update_path,success:function(a){a!=lychee.version&&$("#version span").show()}})},setTitle:function(a,b){""===lychee.title&&(lychee.title=document.title),document.title="Albums"===a?lychee.title:lychee.title+" - "+a,b?$("#title").addClass("editable"):$("#title").removeClass("editable"),$("#title").html(a)},setMode:function(a){$("#button_settings, #button_settings, #button_search, #search, #button_trash_album, #button_share_album, .button_add, .button_divider").remove(),$("#button_trash, #button_move, #button_share, #button_star").remove(),$(document).on("mouseenter","#title.editable",function(){$(this).removeClass("editable")}).off("click","#title.editable").off("touchend","#title.editable").off("contextmenu",".photo").off("contextmenu",".album").off("drop"),Mousetrap.unbind(["u","ctrl+u"]).unbind(["s","ctrl+s"]).unbind(["r","ctrl+r"]).unbind(["d","ctrl+d"]).unbind(["t","ctrl+t"]).unbind(["command+backspace","ctrl+backspace"]),"public"===a?($("header #button_signin, header #hostedwith").show(),lychee.publicMode=!0):"view"===a&&(Mousetrap.unbind("esc
})),""===a&&""===b?$("body").append(build.no_content("picture")):lychee.content.html(a+b),$("img[data-type!='svg']").retina()},title:function(a){var b="",c="",d=albums.json.content[a].title;albums.json.content[a].password&&(b="<span class='icon-lock'></span> "),d.length>18&&(c=d,d=d.substr(0,18)+"..."),$(".album[data-id='"+a+"'] .overlay h1").html(b+d).attr("title",c)},"delete":function(a){$(".album[data-id='"+a+"']").css("opacity",0).animate({width:0,marginLeft:0},300,function(){$(this).remove(),albums.json.num<=0&&lychee.animate(".divider:last-of-type","fadeOut")})}}},album:{init:function(){album.parse(),view.album.infobox(),view.album.title(),view.album.public(),view.album.content.init(),album.json.init=1},hide:function(){view.infobox.hide()},title:function(){if((visible.album()||!album.json.init)&&!visible.photo())switch(album.getID()){case"f":lychee.setTitle("Starred",!1);break;case"s":lychee.setTitle("Public",!1);break;case"r":lychee.setTitle("Recent",!1);break;case"0":lychee.setTitle("Unsorted",!1);break;default:album.json.init&&$("#infobox .attr_title").html(album.json.title+" "+build.editIcon("edit_title_album")),lychee.setTitle(album.json.title,!0)}},description:function(){$("#infobox .attr_description").html(album.json.description+" "+build.editIcon("edit_description_album"))},content:{init:function(){var a="";$.each(album.json.content,function(){a+=build.photo(this)}),lychee.content.html(a),$("img[data-type!='svg']").retina()},title:function(a){var b="",c=album.json.content[a].title;c.length>18&&(b=c,c=c.substr(0,18)+"..."),$(".photo[data-id='"+a+"'] .overlay h1").html(c).attr("title",b)},star:function(a){$(".photo[data-id='"+a+"'] .icon-star").remove(),1==album.json.content[a].star&&$(".photo[data-id='"+a+"']").append("<a class='badge red icon-star'></a>")},"public":function(a){$(".photo[data-id='"+a+"'] .icon-share").remove(),1==album.json.content[a].public&&$(".photo[data-id='"+a+"']").append("<a class='badge red icon-share'></a>")},"delete":function(a){$(".photo[data-id='"+a+"']").css("opacity",0).animate({width:0,marginLeft:0},300,function(){$(this).remove(),visible.albums()||(album.json.num--,view.album.num(),view.album.title())})}},num:function(){$("#infobox .attr_images").html(album.json.num)},"public":function(){1==album.json.public?($("#button_share_album a").addClass("active"),$("#button_share_album").attr("title","Share Album"),$(".photo .icon-share").remove(),album.json.init&&$("#infobox .attr_visibility").html("Public")):($("#button_share_album a").removeClass("active"),$("#button_share_album").attr("title","Make Public"),album.json.init&&$("#infobox .attr_visibility").html("Private"))},password:function(){$("#infobox .attr_password").html(1==album.json.password?"Yes":"No")},infobox:function(){!visible.album()&&album.json.init||visible.photo()||lychee.infobox.html(build.infoboxAlbum(album.json)).show()}},photo:{init:function(){photo.parse(),view.photo.infobox(),view.photo.title(),view.photo.star(),view.photo.public(),view.photo.photo(),photo.json.init=1},show:function(){lychee.content.addClass("view"),view.header.mode("photo"),$("body").css("overflow","hidden"),$(document).bind("mouseenter",view.header.show).bind("mouseleave",view.header.hide),lychee.animate(lychee.imageview,"fadeIn")},hide:function(){view.header.show(),visible.infobox&&view.infobox.hide(),lychee.content.removeClass("view"),view.header.mode("album"),$("body").css("overflow","auto"),$(document).unbind("mouseenter").unbind("mouseleave"),lychee.animate(lychee.imageview,"fadeOut"),setTimeout(function(){lychee.imageview.hide(),view.album.infobox()},300)},title:function(){photo.json.init&&$("#infobox .attr_title").html(photo.json.title+" "+build.editIcon("edit_title")),lychee.setTitle(photo.json.title,!0)},description:function(){photo.json.init&&$("#infobox .attr_description").html(photo.json.description+" "+build.editIcon("edit_description"))},star:function(){$("#button_star a").removeClass("icon-star-empty icon-star"),1==photo.json.star?($("#button_star a").addClass("icon-star"),$("#button_star").attr("title","Unstar Photo")):($("#