lychee/dist/main.js

6 lines
169 KiB
JavaScript
Raw Normal View History

2015-01-29 22:55:34 +00:00
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(rt.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 s(){Q.removeEventListener("DOMContentLoaded",s,!1),e.removeEventListener("load",s,!1),J.ready()}function r(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=J.expando+r.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,s,r,l,c;if(1===t.nodeType){if(gt.hasData(e)&&(a=gt.access(e),s=gt.set(t,a),c=a.events)){delete s.handle,s.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)&&(r=vt.access(e),l=J.extend({},r),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&&Ct.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||(Ot=(Ot||J("<iframe frameborder='0' width='0' height='0'/>")).appendTo(t.documentElement),t=Ot[0].contentDocument,t.write(),t.close(),n=y(e,t),Ot.detach()),Ht[e]=n),n}function x(e,t,n){var o,i,a,s,r=e.style;return n=n||Bt(e),n&&(s=n.getPropertyValue(t)||n[t]),n&&(""!==s||J.contains(e.ownerDocument,e)||(s=J.style(e,t)),Ut.test(s)&&Ft.test(t)&&(o=r.width,i=r.minWidth,a=r.maxWidth,r.minWidth=r.maxWidth=r.width=s,s=n.width,r.width=o,r.minWidth=i,r.maxWidth=a)),void 0!==s?s+"":s}function T(e,t){return{get:function(){return e()?void delete this.get:(this.get=t).apply(this,arguments)}}}function k(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 C(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,s=0;4>a;a+=2)"margin"===n&&(s+=J.css(e,n+Tt[a],!0,i)),o?("content"===n&&(s-=J.css(e,"padding"+Tt[a],!0,i)),"margin"!==n&&(s-=J.css(e,"border"+Tt[a]+"Width",!0,i))):(s+=J.css(e,"padding"+Tt[a],!0,i),"padding"!==n&&(s+=J.css(e,"border"+Tt[a]+"Width",!0,i)));return s}function M(e,t,n){var o=!0,i="width"===t?e.
}))},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)),st.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=[],s=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&&(s?s.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,s,r,l=[],c=!e.once&&[],u=function(a){for(t=e.memory&&a,n=!0,r=i||0,i=0,s=l.length,o=!0;l&&s>r;r++)if(l[r].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?s=l.length:t&&(i=n,u(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&&(s>=n&&s--,r>=n&&r--)}),this},has:function(e){return e?J.i
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;s>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(I(t,!0),e,o,i)}}),J.each({slideDown:I("show"),slideUp:I("hide"),slideToggle:I("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,sn=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=sn[t]||J.find.attr;sn[t]=function(e,t,o){var i,a;return o||(a=sn[t],sn[t]=i,i=null!=n(e,t,o)?t.toLowerCase():null,sn[t]=a),i}});var rn=/^(?: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,s=e.nodeType;return e&&3!==s&&8!==s&&2!==s?(a=1!==s||!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")||rn.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,s,r="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(r)for(t=(e||"").match(ht)||[];c>l;l++)if(n=this[l],o=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(ln," "):" ")){for(a=0;i=t[a++];)o.indexOf(" "+i+" ")<0&&(o+=i+" ");s=J.trim(o),n.className!==s&&(n.className=s)}return this},remo
2015-01-30 00:04:20 +00:00
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),0!==basicModal._dom("input").length&&basicModal._dom("input")[0].focus(),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}},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 a=t.css("background-image");if(/^url\(.*\)$/.test(a)){var i=a.substring(4,a.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.orig
2015-01-29 23:21:25 +00:00
},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())},n.parentNode.insertBefore(t,n)}else lychee.dropbox&&lychee.dropboxKey?e():settings.setDropboxKey(e)},lychee.removeHTML=function(e){var t=document.createElement("DIV");return t.innerHTML=e,t.textContent||t.innerText},lychee.error=function(e,t,n){console.error({description:e,params:t,response:n}),loadingBar.show("error",e)},multiselect={},multiselect.position={top:null,right:null,bottom:null,left:null},multiselect.show=function(e){return lychee.publicMode?!1:visible.search()?!1:visible.infobox()?!1:visible.albums()||visible.album?0!==$(".album:hover, .photo:hover").length?!1:(visible.multiselect()&&$("#multiselect").remove(),multiselect.position.top=e.pageY,multiselect.position.right=-1*(e.pageX-$(document).width()),multiselect.position.bottom=-1*(multiselect.position.top-$(window).height()),multiselect.position.left=e.pageX,$("body").append(build.multiselect(multiselect.position.top,multiselect.position.left)),void $(document).on("mousemove",multiselect.resize)):!1},multiselect.selectAll=function(){var e,t,n;return lychee.publicMode?!1:visible.search()?!1:visible.infobox()?!1:visible.albums()||visible.album?(visible.multiselect()&&$("#multiselect").remove(),multiselect.positio
2015-01-30 00:04:20 +00:00
},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+'"] .iconic-star').remove(),1==album.json.content[e].star&&$('.photo[data-id="'+e+'"]').append("<a class='badge iconic-star'>"+build.iconic("star")+"</a>")},"public":function(e){$('.photo[data-id="'+e+'"] .iconic-share').remove(),1==album.json.content[e]["public"]&&$('.photo[data-id="'+e+'"]').append("<a class='badge iconic-share'>"+build.iconic("eye")+"</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 .iconic-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.find(".wrapper").html(build.infoboxAlbum(album.json))}},view.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"),header.setMode("photo"),$("body").css("overflow","hidden"),$(document).bind("mouseenter",header.show).bind("mouseleave",header.hide),lychee.animate(lychee.imageview,"fadeIn")},hide:function(){header.show(),visible.infobox&&view.infobox.hide(),lychee.content.removeClass("view"),header.setMode("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(){1==photo.json.star?$("#button_star").addClass("active").attr("title","Unstar Photo"):($("#button_star").removeClass("active"),$("#b