lychee/dist/main.js

6 lines
172 KiB
JavaScript
Raw Normal View History

2015-01-16 20:39:32 +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 a(e){var t=ft[e]={};return J.each(e.match(ht)||[],function(e,n){t[n]=!0}),t}function r(){Q.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(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 c(){return!0}function u(){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++)gt.set(e[n],"globalEval",!t||gt.get(t[n],"globalEval"))}function b(e,t){var n,o,i,a,r,s,l,c;if(1===t.nodeType){if(gt.hasData(e)&&(a=gt.access(e),r=gt.set(t,a),c=a.events)){delete r.handle,r.events={};for(i in c)for(n=0,o=c[i].length;o>n;n++)J.event.add(t,i,c[i][n])}vt.hasData(e)&&(s=vt.access(e),l=J.extend({},s),vt.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&&kt.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=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,a,r,s=e.style;return n=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)),void 0!==r?r+"":r}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 k(e,t,n){var o=Xt.exec(t);return o?Math.max(0,o[1]-(n||0))+(o[2]||"px"):t}function j(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+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,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&&at.test(e)?J(e):e||[],!1).length}});var lt,ct=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,ut=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]:ct.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)),rt.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))};ut.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,a=[],r=at.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&&(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]||a(e):J.extend({},e);var t,n,o,i,r,s,l=[],c=!e.once&&[],u=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&&(c?c.length&&u(c.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,u
(t||!n)&&J.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=gt.get(this),o=n[e+"queue"],i=n[e+"queueHooks"],a=J.timers,r=o?o.length:0;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(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,an,rn=J.expr.attrHandle;J.fn.extend({attr:function(e,t){return bt(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===jt?J.prop(e,t,n):(1===a&&J.isXMLDoc(e)||(t=t.toLowerCase(),o=J.attrHooks[t]||(J.expr.match.bool.test(t)?an: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,a=t&&t.match(ht);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}}}}}),an={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=rn[t]||J.find.attr;rn[t]=function(e,t,o){var i,a;return o||(a=rn[t],rn[t]=i,i=null!=n(e,t,o)?t.toLowerCase():null,rn[t]=a),i}});var sn=/^(?:input|select|textarea|button)$/i;J.fn.extend({prop:function(e,t){return bt(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")||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,a,r,s="string"==typeof e&&e,l=0,c=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)||[];c>l;l++)if(n=this[l],o=1===n.nod
},_getValues:function(){var e;return e=null,(0!==basicModal._dom("input").length||0!==basicModal._dom(".basicModal__dropdown").length)&&(e={},basicModal._dom("input").each(function(){var t,n;return t=$(this).attr("data-name"),n=$(this).val(),e[t]=n}),basicModal._dom(".basicModal__dropdown").each(function(){var t,n;return t=$(this).attr("data-name"),n=$(this).attr("data-value"),e[t]=n})),e},_bind:function(e){var t,n,o,i,a;return null!=(null!=(n=e.buttons)&&null!=(o=n.cancel)?o.fn:void 0)&&basicModal._dom("#basicModal__cancel").click(function(){return $(this).hasClass("basicModal__button--active")?!1:($(this).addClass("basicModal__button--active"),e.buttons.cancel.fn())}),null!=(null!=(i=e.buttons)&&null!=(a=i.action)?a.fn:void 0)&&basicModal._dom("#basicModal__action").click(function(){return $(this).hasClass("basicModal__button--active")?!1:($(this).addClass("basicModal__button--active"),e.buttons.action.fn(basicModal._getValues()))}),basicModal._dom("input").keydown(function(){return $(this).removeClass("error")}),t=null,basicModal._dom(".basicModal__dropdown .front").click(function(){var e;return e=$(this).parent(),clearTimeout(t),e.find(".back").show(),e.addClass("flip")}),basicModal._dom('.basicModal__dropdown .back ul li[class!="separator"]').click(function(){var e,n;return e=$(this).parent().parent().parent(),n=$(this).clone(),n.find("span").remove(),n=n.html().trim(),e.find(".front span").html(n),e.attr("data-value",$(this).data("value")),e.removeClass("flip"),t=setTimeout(function(){return e.find(".back").hide()},3e3)})},show:function(e){return basicModal._valid(e)?(basicModal._lastFocus=document.activeElement,0!==basicModal._dom().parent().length?(basicModal.close(!0),setTimeout(function(){return basicModal.show(e)},301),!1):($("body").append(basicModal._build(e)),basicModal._bind(e),null!=e.callback&&callback(),!0)):!1},error:function(e){return basicModal.reset(),basicModal._dom("input[data-name='"+e+"'], .basicModal__dropdown[data-name='"+e+"']").addClass("error").focus().select(),basicModal._dom().removeClass("basicModal--fadeIn basicModal--shake"),setTimeout(function(){return basicModal._dom().addClass("basicModal--shake")},1)},visible:function(){return 0===basicModal._dom().parent().length?!1:!0},action:function(){return 0!==basicModal._dom("#basicModal__action").length?(basicModal._dom("#basicModal__action").click(),!0):!1},cancel:function(){return 0!==basicModal._dom("#basicModal__cancel").length?(basicModal._dom("#basicModal__cancel").click(),!0):!1},reset:function(){return basicModal._dom(".basicModal__button").removeClass("basicModal__button--active"),basicModal._dom(".input, .basicModal__dropdown").removeClass("error"),!0},close:function(e){var t;return t=basicModal._dom().parent(),null==e||e===!0?"true"!==t.attr("data-closable")&&e!==!0?!1:(t.removeClass("basicModalContainer--fadeIn").addClass("basicModalContainer--fadeOut"),setTimeout(function(){return t.remove()},300),null!=basicModal._lastFocus&&(basicModal._lastFocus.focus(),basicModal._lastFocus=null),!0):!1}};var BrowserDetect={init:function(){this.browser=this.searchString(this.dataBrowser)||"An unknown browser",this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version",this.OS=this.searchString(this.dataOS)||"an unknown OS"},searchString:function(e){for(var t=0;t<e.length;t++){var n=e[t].string,o=e[t].prop;if(this.versionSearchString=e[t].versionSearch||e[t].identity,n){if(-1!=n.indexOf(e[t].subString))return e[t].identity}else if(o)return e[t].identity}},searchVersion:function(e){var t=e.indexOf(this.versionSearchString);if(-1!=t)return parseFloat(e.substring(t+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
})},lychee.api=function(e,t){loadingBar.show(),$.ajax({type:"POST",url:lychee.api_path,data:"function="+e,dataType:"text",success:function(n){return setTimeout(function(){loadingBar.hide()},100),"string"==typeof n&&"Error: "===n.substring(0,7)?(lychee.error(n.substring(7,n.length),e,n),upload.close(!0),!1):("1"===n?n=!0:""===n&&(n=!1),"string"==typeof n&&"{"===n.substring(0,1)&&"}"===n.substring(n.length-1,n.length)&&(n=$.parseJSON(n)),lychee.debugMode&&console.log(n),void t(n))},error:function(t,n,o){lychee.error("Server error or API not found.",e,o),upload.close(!0)}})},lychee.login=function(){var e,t=$("input#username").val(),n=md5($("input#password").val());e="login&user="+t+"&password="+n,lychee.api(e,function(e){if(e===!0){try{localStorage.setItem("lychee_username",t)}catch(n){}window.location.reload()}else $("#password").val("").addClass("error").focus(),$(".message .button.active").removeClass("pressed")})},lychee.loginDialog=function(){var e;$("body").append(build.signInModal()),$("#username").focus(),localStorage&&(e=localStorage.getItem("lychee_username"),null!==e&&(e.length>0&&$("#username").val(e),$("#password").focus())),"1"===lychee.checkForUpdates&&lychee.getUpdate()},lychee.logout=function(){lychee.api("logout",function(){window.location.reload()})},lychee.goto=function(e){e=void 0===e?"#":"#"+e,history.pushState(null,null,e),lychee.load()},lychee.load=function(){var e="",t="",n=document.location.hash.replace("#","").split("/");$(".no_content").remove(),contextMenu.close(),multiselect.close(),void 0!==n[0]&&(e=n[0]),void 0!==n[1]&&(t=n[1]),e&&t?(photo.json=null,(""===lychee.content.html()||$("#search").length&&0!==$("#search").val().length)&&(lychee.content.hide(),album.load(e,!0)),photo.load(t,e)):e?(photo.json=null,visible.photo()&&view.photo.hide(),album.json&&e==album.json.id?view.album.title():album.load(e)):(""!==search.code&&(albums.json=null,search.code=""),album.json=null,photo.json=null,visible.album()&&view.album.hide(),visible.photo()&&view.photo.hide(),albums.load())},lychee.getUpdate=function(){$.ajax({url:lychee.update_path,success:function(e){parseInt(e)>parseInt(lychee.version_code)&&$("#version span").show()}})},lychee.setTitle=function(e,t){var n=header.dom("#title");document.title=lychee.title+" - "+e,t?n.addClass("editable"):n.removeClass("editable"),n.html(e+build.iconic("caret-bottom"))},lychee.setMode=function(e){$("#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").unbind("s").unbind("f").unbind("r").unbind("d").unbind("t").unbind(["command+backspace","ctrl+backspace"]).unbind(["command+a","ctrl+a"]),"public"===e?(header.dom("#button_signin, #hostedwith").show(),lychee.publicMode=!0):"view"===e&&(Mousetrap.unbind(["esc","command+up"]),$("#button_back, a#next, a#previous").remove(),$(".no_content").remove(),lychee.publicMode=!0,lychee.viewMode=!0)},lychee.animate=function(e,t){var n=[["fadeIn","fadeOut"],["contentZoomIn","contentZoomOut"]];e.jQuery||(e=$(e));for(var o=0;o<n.length;o++)for(var i=0;i<n[o].length;i++)if(n[o][i]==t)return e.removeClass(n[o][0]+" "+n[o][1]).addClass(t),!0;return!1},lychee.escapeHTML=function(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},lychee.loadDropbox=function(e){if(!lychee.dropbox&&lychee.dropboxKey){loadingBar.show();var t=document.createElement("script"),n=document.getElementsByTagName("script")[0];t.src="https://www.dropbox.com/static/api/1/dropins.js",t.id="dropboxjs",t.type="text/javascript",t.async="true",t.setAttribute("data-app-key",lychee.dropboxKey),t.onload=t.onreadystatechange=function(){var t=this.readyState;t&&"complete"!==t&&"loaded"!==t||(lychee.dropbox=!0,loadingBar.hide(),e(
}),e="importUrl&url="+escape(n)+"&albumID="+t,lychee.api(e,function(n){upload.close(),upload.notify("Import complete"),albums.refresh(),album.getID()===!1?lychee.goto("0"):album.load(t),n!==!0&&lychee.error(null,e,n)})}})})}},upload.close=function(e){e===!0?$(".upload_overlay").remove():($(".upload_overlay").removeClass("fadeIn").css("opacity",0),setTimeout(function(){$(".upload_overlay").remove()},300))},view={},view.infobox={show:function(){visible.infobox()||$("body").append("<div id='infobox_overlay' class='fadeIn'></div>"),lychee.infobox.addClass("active")},hide:function(){lychee.animate("#infobox_overlay","fadeOut"),setTimeout(function(){$("#infobox_overlay").remove()},300),lychee.infobox.removeClass("active")}},view.albums={init:function(){view.albums.title(),view.albums.content.init()},title:function(){lychee.setTitle("Albums",!1)},content:{scrollPosition:0,init:function(){var e="",t="";albums.parse(albums.json.unsortedAlbum),albums.parse(albums.json.publicAlbum),albums.parse(albums.json.starredAlbum),albums.parse(albums.json.recentAlbum),lychee.publicMode||(e=build.divider("Smart Albums")+build.album(albums.json.unsortedAlbum)+build.album(albums.json.starredAlbum)+build.album(albums.json.publicAlbum)+build.album(albums.json.recentAlbum)),albums.json.content&&0!==albums.json.num&&($.each(albums.json.content,function(){albums.parse(this),t=build.album(this)+t}),lychee.publicMode||(t=build.divider("Albums")+t)),""===e&&""===t?(lychee.content.html(""),$("body").append(build.no_content("share"))):lychee.content.html(e+t),$('img[data-type!="nonretina"]').retina(),null!==view.albums.content.scrollPosition&&$(document).scrollTop(view.albums.content.scrollPosition)},title:function(e){var t="",n="",o=albums.json.content[e].title;albums.json.content[e].password&&(t="<span class='icon-lock'></span> "),null!==o&&o.length>18&&(n=o,o=o.substr(0,18)+"..."),$('.album[data-id="'+e+'"] .overlay h1').html(t+o).attr("title",n)},"delete":function(e){$('.album[data-id="'+e+'"]').css("opacity",0).animate({width:0,marginLeft:0},300,function(){$(this).remove(),albums.json.num<=0&&lychee.animate(".divider:last-of-type","fadeOut")})}}},view.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)}},content:{init:function(){var e="";view.albums.content.scrollPosition=$(document).scrollTop(),$("html, body").scrollTop(0),$.each(album.json.content,function(){e+=build.photo(this)}),lychee.content.html(e),$('img[data-type!="svg"]').retina()},title:function(e){var t="",n=album.json.content[e].title;null!==n&&n.length>18&&(t=n,n=n.substr(0,18)+"..."),$('.photo[data-id="'+e+'"] .overlay h1').html(n).attr("title",t)},star:function(e){$('.photo[data-id="'+e+'"] .icon-star').remove(),1==album.json.content[e].star&&$('.photo[data-id="'+e+'"]').append("<a class='badge red icon-star'></a>")},"public":function(e){$('.photo[data-id="'+e+'"] .icon-share').remove(),1==album.json.content[e].public&&$('.photo[data-id="'+e+'"]').append("<a class='badge red icon-share'></a>")},"delete":function(e){$('.photo[data-id="'+e+'"]').css("opacity",0).animate({width:0,marginLeft:0},300,function(){$(this).remove(),visible.albums()||(album.json.num--,view.album.num(),view.album.title())})}},description:function(){$("#infobox .attr_description").html(album.json.description+" "+build.editIcon("edit_description_album"))},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-shar