lychee/assets/min/main.js

7 lines
162 KiB
JavaScript
Raw Normal View History

/*! Lychee 2.1.1 | 2014-04-01 */
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=ab.type(a);return"function"===c||ab.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(ab.isFunction(b))return ab.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return ab.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(hb.test(b))return ab.filter(b,a,c);b=ab.filter(b,a)}return ab.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 ab.each(a.match(nb)||[],function(a,c){b[c]=!0}),b}function g(){$.removeEventListener("DOMContentLoaded",g,!1),a.removeEventListener("load",g,!1),ab.ready()}function h(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=ab.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)?ab.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 $.activeElement}catch(a){}}function m(a,b){return ab.nodeName(a,"table")&&ab.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++)ab.event.add(b,e,j[e][c])}sb.hasData(a)&&(h=sb.access(a),i=ab.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&&ab.nodeName(a,b)?ab.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=ab(c.createElement(b)).appendTo(c.body),e=a.getDefaultComputedStyle?a.getDefaultComputedStyle(d[0]).display:ab.css(d[0],"display");return d.detach(),e}function u(a){var b=$,c=Ob[a];return c||(c=t(a,b),"none"!==c&&c||(Nb=(Nb||ab("<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||ab.contains(a.ownerDocument,a)||(g=ab.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+=ab.css(a,c+wb[f],!0,e)),d?("content"===c&&(g-=ab.css(a,"padding"+wb[f],!0,e)),"margin"!==c&&(g-=ab.css(a,"border"+wb[f]+"Width",!0,e))):(g+=ab.css(a,
if("string"!=typeof a)return this.pushStack(ab(a).filter(function(){for(b=0;c>b;b++)if(ab.contains(e[b],this))return!0}));for(b=0;c>b;b++)ab.find(a,e[b],d);return d=this.pushStack(c>1?ab.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)?ab(a):a||[],!1).length}});var ib,jb=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,kb=ab.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 ab?b[0]:b,ab.merge(this,ab.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:$,!0)),gb.test(c[1])&&ab.isPlainObject(b))for(c in b)ab.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=$.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=$,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):ab.isFunction(a)?"undefined"!=typeof ib.ready?ib.ready(a):a(ab):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),ab.makeArray(a,this))};kb.prototype=ab.fn,ib=ab($);var lb=/^(?:parents|prev(?:Until|All))/,mb={children:!0,contents:!0,next:!0,prev:!0};ab.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&&ab(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}}),ab.fn.extend({has:function(a){var b=ab(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(ab.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?ab(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&&ab.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?ab.unique(f):f)},index:function(a){return a?"string"==typeof a?U.call(ab(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(ab.unique(ab.merge(this.get(),ab(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}}),ab.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return ab.dir(a,"parentNode")},parentsUntil:function(a,b,c){return ab.dir(a,"parentNode",c)},next:function(a){return e(a,"nextSibling")},prev:function(a){return e(a,"previousSibling")},nextAll:function(a){return ab.dir(a,"nextSibling")},prevAll:function(a){return ab.dir(a,"previousSibling")},nextUntil:function(a,b,c){return ab.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return ab.dir(a,"previousSibling",c)},siblings:function(a){return ab.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return ab.sibling(a.firstChild)},contents:function(a){return a.contentDocument||ab.merge([],a.childNodes)}},function(a,b){ab.fn[a]=function(c,d){var e=ab.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=ab.filter(d,e)),this.length>1&&(mb[a]||ab.unique(e),lb.test(a)&&e.reverse()),this.pushStack(e)}});var nb=/\S+/g,ob={};ab.Callbacks=function(a){a="string"==typeof a?ob[a]||f(a):ab.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){ab.each(b,function(b,c){var d=ab.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&&ab.each(arguments,function(a,b){for(var c;(c=ab.inArray(b,i,c))>-1;)i.splice(c,1),d&&(g>=c&&g--,h>=c&&h--)}),this},has:function(a){return a?ab.inArray(a,i)>-1:!(!
for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),ab.each(["toggle","show","hide"],function(a,b){var c=ab.fn[b];ab.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(E(b,!0),a,d,e)}}),ab.each({slideDown:E("show"),slideUp:E("hide"),slideToggle:E("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){ab.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),ab.timers=[],ab.fx.tick=function(){var a,b=0,c=ab.timers;for(Yb=ab.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||ab.fx.stop(),Yb=void 0},ab.fx.timer=function(a){ab.timers.push(a),a()?ab.fx.start():ab.timers.pop()},ab.fx.interval=13,ab.fx.start=function(){Zb||(Zb=setInterval(ab.fx.tick,ab.fx.interval))},ab.fx.stop=function(){clearInterval(Zb),Zb=null},ab.fx.speeds={slow:600,fast:200,_default:400},ab.fn.delay=function(a,b){return a=ab.fx?ab.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=$.createElement("input"),b=$.createElement("select"),c=b.appendChild($.createElement("option"));a.type="checkbox",Z.checkOn=""!==a.value,Z.optSelected=c.selected,b.disabled=!0,Z.optDisabled=!c.disabled,a=$.createElement("input"),a.value="t",a.type="radio",Z.radioValue="t"===a.value}();var dc,ec,fc=ab.expr.attrHandle;ab.fn.extend({attr:function(a,b){return qb(this,ab.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){ab.removeAttr(this,a)})}}),ab.extend({attr:function(a,b,c){var d,e,f=a.nodeType;return a&&3!==f&&8!==f&&2!==f?typeof a.getAttribute===zb?ab.prop(a,b,c):(1===f&&ab.isXMLDoc(a)||(b=b.toLowerCase(),d=ab.attrHooks[b]||(ab.expr.match.bool.test(b)?ec:dc)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=ab.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 ab.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=ab.propFix[c]||c,ab.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)},attrHooks:{type:{set:function(a,b){if(!Z.radioValue&&"radio"===b&&ab.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?ab.removeAttr(a,c):a.setAttribute(c,c),c}},ab.each(ab.expr.match.bool.source.match(/\w+/g),function(a,b){var c=fc[b]||ab.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;ab.fn.extend({prop:function(a,b){return qb(this,ab.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[ab.propFix[a]||a]})}}),ab.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||!ab.isXMLDoc(a),f&&(b=ab.propFix[b]||b,e=ab.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}}}}),Z.optSelected||(ab.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null}}),ab.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){ab.propFix[this.toLowerCase()]=this});var hc=/[\t\r\n\f]/g;ab.fn.extend({addClass:function(a){var b,c,d,e,f,g,h="string"==typeof a&&a,i=0,j=this.length;if(ab.isFunction(a))return this.each(function(b){ab(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=ab.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.leng
2014-04-01 21:43:03 +00:00
}}}(jQuery);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(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="
2014-04-01 20:57:01 +00:00
})},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),!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("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("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("/");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("n").unbind("u").unbind("s").unbind("backspace"),"public"===a?($("header #button_signin, header #hostedwith").show(),lychee.publicMode=!0):"view"===a&&(Mousetrap.unbind("esc"),$("#button_back, a#next, a#previous").remove(),$(".no_content").remove(),lychee.publicMode=!0,lychee.viewMode=!0)},animate:function(a,b){var c=[["fadeIn","fadeOut"],["contentZoomIn","contentZoomOut"]];a.jQuery||(a=$(a));for(var d=0;d<c.length;d++)for(var e=0;e<c[d].length;e++)if(c[d][e]==b)return a.removeClass(c[d][0]+" "+c[d][1]).addClass(b),!0;return!1},loadDropbox:function(a){if(!lychee.dropbox&&lychee.dropboxKey){loadingBar.show();var b=document.createElement("script"),c=document.getElementsByTagName("script")[0];b.src="https://www.dropbox.com/static/api/1/dropins.js",b.id="dropboxjs",b.type="text/javascript",b.async="true",b.setAttribute("data-app-key",lychee.dropboxKey),b.onload=b.onreadystatechange=function(){var b=this.readyState;b&&"complete"!==b&&"loaded"!==b||(lychee.dropbox=!0,loadingBar.hide(),a())},c.parentNode.insertBefore(b,c)}else lychee.dropbox&&lychee.dropboxKey?a():settings.setDropboxKey(a)},error:function(a,b,c){console.log("Error Description: "+a),console.log("Error Params: "+b),console.log("Server Response: "+c),loadingBar.show("error",a)}};modal={fns:null,show:function(a,b,c,d,e){c||(c=[["",function(){}],["",function(){}]]),modal.f
2014-04-01 20:55:45 +00:00
}},description:function(){$("#infobox .attr_description").html(album.json.description+" "+build.editIcon("edit_description_album"))},content:{init:function(){var a="";$.each(album.json.content,function(){album.parse(this),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_name").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")):($("#button_star a").addClass("icon-star-empty"),$("#button_star").attr("title","Star Photo"))},"public":function(){1==photo.json.public||2==photo.json.public?($("#button_share a").addClass("active"),$("#button_share").attr("title","Share Photo"),photo.json.init&&$("#infobox .attr_visibility").html("Public")):($("#button_share a").removeClass("active"),$("#button_share").attr("title","Make Public"),photo.json.init&&$("#infobox .attr_visibility").html("Private"))},tags:function(){$("#infobox #tags").html(build.tags(photo.json.tags))},photo:function(){lychee.imageview.html(build.imageview(photo.json,photo.isSmall(),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={albums:function(){return"block"===$("#tools_albums").css("display")?!0:!1},album:function(){return"block"===$("#t