You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lychee/dist/main.js

7 lines
188 KiB

7 years ago
function _taggedTemplateLiteral(e,t){return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}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){"use strict";"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){"use strict";function n(e,t){t=t||ne;var n=t.createElement("script");n.text=e,t.head.appendChild(n).parentNode.removeChild(n)}function o(e){var t=!!e&&"length"in e&&e.length,n=be.type(e);return"function"!==n&&!be.isWindow(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}function i(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}function a(e,t,n){return be.isFunction(t)?be.grep(e,function(e,o){return!!t.call(e,o,e)!==n}):t.nodeType?be.grep(e,function(e){return e===t!==n}):"string"!=typeof t?be.grep(e,function(e){return le.call(t,e)>-1!==n}):je.test(t)?be.filter(t,e,n):(t=be.filter(t,e),be.grep(e,function(e){return le.call(t,e)>-1!==n&&1===e.nodeType}))}function r(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}function l(e){var t={};return be.each(e.match(Ce)||[],function(e,n){t[n]=!0}),t}function s(e){return e}function c(e){throw e}function u(e,t,n,o){var i;try{e&&be.isFunction(i=e.promise)?i.call(e).done(t).fail(n):e&&be.isFunction(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(o))}catch(e){n.apply(void 0,[e])}}function d(){ne.removeEventListener("DOMContentLoaded",d),e.removeEventListener("load",d),be.ready()}function p(){this.expando=be.expando+p.uid++}function h(e){return"true"===e||"false"!==e&&("null"===e?null:e===+e+""?+e:Pe.test(e)?JSON.parse(e):e)}function f(e,t,n){var o;if(void 0===n&&1===e.nodeType)if(o="data-"+t.replace(Ie,"-$&").toLowerCase(),"string"==typeof(n=e.getAttribute(o))){try{n=h(n)}catch(e){}Le.set(e,t,n)}else n=void 0;return n}function b(e,t,n,o){var i,a=1,r=20,l=o?function(){return o.cur()}:function(){return be.css(e,t,"")},s=l(),c=n&&n[3]||(be.cssNumber[t]?"":"px"),u=(be.cssNumber[t]||"px"!==c&&+s)&&Ne.exec(be.css(e,t));if(u&&u[3]!==c){c=c||u[3],n=n||[],u=+s||1;do{a=a||".5",u/=a,be.style(e,t,u+c)}while(a!==(a=l()/s)&&1!==a&&--r)}return n&&(u=+u||+s||0,i=n[1]?u+(n[1]+1)*n[2]:+n[2],o&&(o.unit=c,o.start=u,o.end=i)),i}function m(e){var t,n=e.ownerDocument,o=e.nodeName,i=He[o];return i?i:(t=n.body.appendChild(n.createElement(o)),i=be.css(t,"display"),t.parentNode.removeChild(t),"none"===i&&(i="block"),He[o]=i,i)}function g(e,t){for(var n,o,i=[],a=0,r=e.length;a<r;a++)o=e[a],o.style&&(n=o.style.display,t?("none"===n&&(i[a]=Se.get(o,"display")||null,i[a]||(o.style.display="")),""===o.style.display&&Fe(o)&&(i[a]=m(o))):"none"!==n&&(i[a]="none",Se.set(o,"display",n)));for(a=0;a<r;a++)null!=i[a]&&(e[a].style.display=i[a]);return e}function v(e,t){var n;return n=void 0!==e.getElementsByTagName?e.getElementsByTagName(t||"*"):void 0!==e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&i(e,t)?be.merge([e],n):n}function y(e,t){for(var n=0,o=e.length;n<o;n++)Se.set(e[n],"globalEval",!t||Se.get(t[n],"globalEval"))}function w(e,t,n,o,i){for(var a,r,l,s,c,u,d=t.createDocumentFragment(),p=[],h=0,f=e.length;h<f;h++)if((a=e[h])||0===a)if("object"===be.type(a))be.merge(p,a.nodeType?[a]:a);else if(ze.test(a)){for(r=r||d.appendChild(t.createElement("div")),l=(Be.exec(a)||["",""])[1].toLowerCase(),s=Xe[l]||Xe._default,r.innerHTML=s[1]+be.htmlPrefilter(a)+s[2],u=s[0];u--;)r=r.lastChild;be.merge(p,r.childNodes),r=d.firstChild,r.textContent=""}else p.push(t.createTextNode(a));for(d.textContent="",h=0;a=p[h++];)if(o&&be.inArray(a,o)>-1)i&&i.push(a);else if(c=be.contains(a.ownerDocument,a),r=v(d.appendChild(a),"script"),c&&y(r),n)for(u=0;a=r[u++];)We.test(a.type||"")&&n.push(a);return d}function x(){return!0}function j(){return!1}function _(){try{return ne.activeElement}catch(e){}}function T(e,t,n,o,i,a){var r,l;if("object"==typeof t)
focus:function(e){return e===E.activeElement&&(!E.hasFocus||E.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:l(!1),disabled:l(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!x.pseudos.empty(e)},header:function(e){return he.test(e.nodeName)},input:function(e){return pe.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:s(function(){return[0]}),last:s(function(e,t){return[t-1]}),eq:s(function(e,t,n){return[n<0?n+t:n]}),even:s(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:s(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:s(function(e,t,n){for(var o=n<0?n+t:n;--o>=0;)e.push(o);return e}),gt:s(function(e,t,n){for(var o=n<0?n+t:n;++o<t;)e.push(o);return e})}},x.pseudos.nth=x.pseudos.eq;for(y in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})x.pseudos[y]=function(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}(y);for(y in{submit:!0,reset:!0})x.pseudos[y]=function(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}(y);return u.prototype=x.filters=x.pseudos,x.setFilters=new u,T=t.tokenize=function(e,n){var o,i,a,r,l,s,c,u=B[e+" "];if(u)return n?0:u.slice(0);for(l=e,s=[],c=x.preFilter;l;){o&&!(i=re.exec(l))||(i&&(l=l.slice(i[0].length)||l),s.push(a=[])),o=!1,(i=le.exec(l))&&(o=i.shift(),a.push({value:o,type:i[0].replace(ae," ")}),l=l.slice(o.length));for(r in x.filter)!(i=de[r].exec(l))||c[r]&&!(i=c[r](i))||(o=i.shift(),a.push({value:o,type:r,matches:i}),l=l.slice(o.length));if(!o)break}return n?l.length:l?t.error(e):B(e,s).slice(0)},M=t.compile=function(e,t){var n,o=[],i=[],a=W[e+" "];if(!a){for(t||(t=T(e)),n=t.length;n--;)a=g(t[n]),a[q]?o.push(a):i.push(a);a=W(e,v(i,o)),a.selector=e}return a},k=t.select=function(e,t,n,o){var i,a,r,l,s,u="function"==typeof e&&e,p=!o&&T(e=u.selector||e);if(n=n||[],1===p.length){if(a=p[0]=p[0].slice(0),a.length>2&&"ID"===(r=a[0]).type&&9===t.nodeType&&L&&x.relative[a[1].type]){if(!(t=(x.find.ID(r.matches[0].replace(ge,ve),t)||[])[0]))return n;u&&(t=t.parentNode),e=e.slice(a.shift().value.length)}for(i=de.needsContext.test(e)?0:a.length;i--&&(r=a[i],!x.relative[l=r.type]);)if((s=x.find[l])&&(o=s(r.matches[0].replace(ge,ve),me.test(a[0].type)&&c(t.parentNode)||t))){if(a.splice(i,1),!(e=o.length&&d(a)))return G.apply(n,o),n;break}}return(u||M(e,p))(o,t,!L,n,!t||me.test(e)&&c(t.parentNode)||t),n},w.sortStable=q.split("").sort(X).join("")===q,w.detectDuplicates=!!D,A(),w.sortDetached=i(function(e){return 1&e.compareDocumentPosition(E.createElement("fieldset"))}),i(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||a("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),w.attributes&&i(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||a("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),i(function(e){return null==e.getAttribute("disabled")})||a(J,function(e,t,n){var o;if(!n)return e[t]===!0?t.toLowerCase():(o=e.getAttributeNode(t))&&o.specified?o.value:null}),t}(e);be.find=ge,be.expr=ge.selectors,be.expr[":"]=be.expr.pseudos,be.uniqueSort=be.unique=ge.uniqueSort,be.text=ge.getText,be.isXMLDoc=ge.isXML,be.contains=ge.contains,be.escapeSelector=ge.escape;var ve=function(e,t,n){for(var o=[],i=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(i&&be(e).is(n))break;o.push(e)}return o},ye=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},we=be.expr.match.needsContext,xe=/^<(
var t=!0,i=null!=e&&e+"queueHooks",a=be.timers,r=Se.get(this);if(i)r[i]&&r[i].stop&&o(r[i]);else for(i in r)r[i]&&r[i].stop&&ht.test(i)&&o(r[i]);for(i=a.length;i--;)a[i].elem!==this||null!=e&&a[i].queue!==e||(a[i].anim.stop(n),t=!1,a.splice(i,1));!t&&n||be.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=Se.get(this),o=n[e+"queue"],i=n[e+"queueHooks"],a=be.timers,r=o?o.length:0;for(n.finish=!0,be.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;t<r;t++)o[t]&&o[t].finish&&o[t].finish.call(this);delete n.finish})}}),be.each(["toggle","show","hide"],function(e,t){var n=be.fn[t];be.fn[t]=function(e,o,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(U(t,!0),e,o,i)}}),be.each({slideDown:U("show"),slideUp:U("hide"),slideToggle:U("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){be.fn[e]=function(e,n,o){return this.animate(t,e,n,o)}}),be.timers=[],be.fx.tick=function(){var e,t=0,n=be.timers;for(ut=be.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||be.fx.stop(),ut=void 0},be.fx.timer=function(e){be.timers.push(e),be.fx.start()},be.fx.interval=13,be.fx.start=function(){dt||(dt=!0,R())},be.fx.stop=function(){dt=null},be.fx.speeds={slow:600,fast:200,_default:400},be.fn.delay=function(t,n){return t=be.fx?be.fx.speeds[t]||t:t,n=n||"fx",this.queue(n,function(n,o){var i=e.setTimeout(n,t);o.stop=function(){e.clearTimeout(i)}})},function(){var e=ne.createElement("input"),t=ne.createElement("select"),n=t.appendChild(ne.createElement("option"));e.type="checkbox",he.checkOn=""!==e.value,he.optSelected=n.selected,e=ne.createElement("input"),e.value="t",e.type="radio",he.radioValue="t"===e.value}();var ft,bt=be.expr.attrHandle;be.fn.extend({attr:function(e,t){return Ae(this,be.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){be.removeAttr(this,e)})}}),be.extend({attr:function(e,t,n){var o,i,a=e.nodeType;if(3!==a&&8!==a&&2!==a)return void 0===e.getAttribute?be.prop(e,t,n):(1===a&&be.isXMLDoc(e)||(i=be.attrHooks[t.toLowerCase()]||(be.expr.match.bool.test(t)?ft:void 0)),void 0!==n?null===n?void be.removeAttr(e,t):i&&"set"in i&&void 0!==(o=i.set(e,n,t))?o:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(o=i.get(e,t))?o:(o=be.find.attr(e,t),null==o?void 0:o))},attrHooks:{type:{set:function(e,t){if(!he.radioValue&&"radio"===t&&i(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,o=0,i=t&&t.match(Ce);if(i&&1===e.nodeType)for(;n=i[o++];)e.removeAttribute(n)}}),ft={set:function(e,t,n){return t===!1?be.removeAttr(e,n):e.setAttribute(n,n),n}},be.each(be.expr.match.bool.source.match(/\w+/g),function(e,t){var n=bt[t]||be.find.attr;bt[t]=function(e,t,o){var i,a,r=t.toLowerCase();return o||(a=bt[r],bt[r]=i,i=null!=n(e,t,o)?r:null,bt[r]=a),i}});var mt=/^(?:input|select|textarea|button)$/i,gt=/^(?:a|area)$/i;be.fn.extend({prop:function(e,t){return Ae(this,be.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[be.propFix[e]||e]})}}),be.extend({prop:function(e,t,n){var o,i,a=e.nodeType;if(3!==a&&8!==a&&2!==a)return 1===a&&be.isXMLDoc(e)||(t=be.propFix[t]||t,i=be.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]},propHooks:{tabIndex:{get:function(e){var t=be.find.attr(e,"tabindex");return t?parseInt(t,10):mt.test(e.nodeName)||gt.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),he.optSelected||(be.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),be.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){be.propFix[this.toLowerCase()]=this}),be.fn.extend({addClas
exports:{}};t[r][0].call(u.exports,function(e){var n=t[r][1][e];return i(n?n:e)},u,u.exports,e,t,n,o)}return n[r].exports}for(var a="function"==typeof require&&require,r=0;r<o.length;r++)i(o[r]);return i}({1:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var o=null,i=(n.THEME={small:"basicModal__small",xclose:"basicModal__xclose"},function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return(arguments.length>1&&void 0!==arguments[1]&&arguments[1])===!0?document.querySelectorAll(".basicModal "+e):document.querySelector(".basicModal "+e)}),a=function(e,t){return null!=e&&(e.constructor===Object?Array.prototype.forEach.call(Object.keys(e),function(n){return t(e[n],n,e)}):Array.prototype.forEach.call(e,function(n,o){return t(n,o,e)}))},r=function(e){return null==e||0===Object.keys(e).length?(console.error("Missing or empty modal configuration object"),!1):(null==e.body&&(e.body=""),null==e.class&&(e.class=""),e.closable!==!1&&(e.closable=!0),null==e.buttons?(console.error("basicModal requires at least one button"),!1):null!=e.buttons.action&&(null==e.buttons.action.class&&(e.buttons.action.class=""),null==e.buttons.action.title&&(e.buttons.action.title="OK"),null==e.buttons.action.fn)?(console.error("Missing fn for action-button"),!1):null==e.buttons.cancel||(null==e.buttons.cancel.class&&(e.buttons.cancel.class=""),null==e.buttons.cancel.title&&(e.buttons.cancel.title="Cancel"),null!=e.buttons.cancel.fn)||(console.error("Missing fn for cancel-button"),!1))},l=function(e){var t="";return t+="\n\t <div class='basicModalContainer basicModalContainer--fadeIn' data-closable='"+e.closable+"'>\n\t <div class='basicModal basicModal--fadeIn "+e.class+"' role=\"dialog\">\n\t <div class='basicModal__content'>\n\t "+e.body+"\n\t </div>\n\t <div class='basicModal__buttons'>\n\t ",null!=e.buttons.cancel&&(t+=e.buttons.cancel.class.indexOf("basicModal__xclose")===-1?"<a id='basicModal__cancel' class='basicModal__button "+e.buttons.cancel.class+"'>"+e.buttons.cancel.title+"</a>":"<div id='basicModal__cancel' class='basicModal__button "+e.buttons.cancel.class+'\' aria-label=\'close\'><svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512"><path d="M405 136.798l-29.798-29.798-119.202 119.202-119.202-119.202-29.798 29.798 119.202 119.202-119.202 119.202 29.798 29.798 119.202-119.202 119.202 119.202 29.798-29.798-119.202-119.202z"/></svg></div>'),null!=e.buttons.action&&(t+="<a id='basicModal__action' class='basicModal__button "+e.buttons.action.class+"'>"+e.buttons.action.title+"</a>"),t+="\n\t </div>\n\t </div>\n\t </div>\n\t "},s=n.getValues=function(){var e={},t=i("input[name]",!0),n=i("select[name]",!0);return a(t,function(t){var n=t.getAttribute("name"),o=t.value;e[n]=o}),a(n,function(t){var n=t.getAttribute("name"),o=t.options[t.selectedIndex].value;e[n]=o}),0===Object.keys(e).length?null:e},c=function(e){return null!=e.buttons.cancel&&(i("#basicModal__cancel").onclick=function(){return this.classList.contains("basicModal__button--active")!==!0&&(this.classList.add("basicModal__button--active"),void e.buttons.cancel.fn())}),null!=e.buttons.action&&(i("#basicModal__action").onclick=function(){return this.classList.contains("basicModal__button--active")!==!0&&(this.classList.add("basicModal__button--active"),void e.buttons.action.fn(s()))}),a(i("input",!0),function(e){e.oninput=e.onblur=function(){this.classList.remove("error")}}),a(i("select",!0),function(e){e.onchange=e.onblur=function(){this.classList.remove("error")}}),!0},u=(n.show=function e(t){if(r(t)===!1)return!1;if(null!=i())return p(!0),setTimeout(function(){return e(t)},301),!1;o=document.activeElement;var n=l(t);document.body.insertAdjacentHTML("beforeend",n),c(t);var a=i("input");null!=a&&a.select();var s=i("select");return null==a&&null!=s&&s.focus(),null!=t.callback&&t.callback(t),!0},n.error=function(e){d();var t=i("input[name='"+e+"']")||i("select[name='"+e+"']"
7 years ago
t+="1"===e.cameraDate?lychee.html(_templateObject16,build.iconic("camera-slr"),e.sysdate):lychee.html(_templateObject17,e.sysdate),t+="</div>",lychee.publicMode===!1&&(t+=lychee.html(_templateObject18,"1"===e.star?"badge--visible":"",build.iconic("star"),"1"===e.public&&"1"!==album.json.public?"badge--visible":"",build.iconic("eye"))),t+="</div>"},build.imageview=function(e,t){var n="";return n+=""!==e.medium==!1?lychee.html(_templateObject19,t===!0?"":"full",e.url):lychee.html(_templateObject20,t===!0?"":"full",e.url,e.medium,e.url,e.width),n+="\n\t <div class='arrow_wrapper arrow_wrapper--previous'><a id='previous'>"+build.iconic("caret-left")+"</a></div>\n\t <div class='arrow_wrapper arrow_wrapper--next'><a id='next'>"+build.iconic("caret-right")+"</a></div>\n\t "},build.no_content=function(e){var t="";switch(t+="\n\t <div class='no_content fadeIn'>\n\t "+build.iconic(e)+"\n\t ",e){case"magnifying-glass":t+="<p>No results</p>";break;case"eye":t+="<p>No public albums</p>";break;case"cog":t+="<p>No configuration</p>";break;case"question-mark":t+="<p>Photo not found</p>"}return t+="</div>"},build.uploadModal=function(e,t){var n="";n+=lychee.html(_templateObject21,e);for(var o=0;o<t.length;){var i=t[o];i.name.length>40&&(i.name=i.name.substr(0,17)+"..."+i.name.substr(i.name.length-20,20)),n+=lychee.html(_templateObject22,i.name),o++}return n+="</div>"},build.tags=function(e){var t="";return""!==e?(e=e.split(","),e.forEach(function(e,n,o){t+=lychee.html(_templateObject23,e,n,build.iconic("x"))})):t="<div class='empty'>No Tags</div>",t},contextMenu={},contextMenu.add=function(e){var t=[{title:build.iconic("image")+"Upload Photo",fn:function(){return $("#upload_files").click()}},{},{title:build.iconic("link-intact")+"Import from Link",fn:upload.start.url},{title:build.iconic("dropbox","ionicons")+"Import from Dropbox",fn:upload.start.dropbox},{title:build.iconic("terminal")+"Import from Server",fn:upload.start.server},{},{title:build.iconic("folder")+"New Album",fn:album.add}];basicContext.show(t,e.originalEvent),upload.notify()},contextMenu.settings=function(e){var t=[{title:build.iconic("person")+"Change Login",fn:settings.setLogin},{title:build.iconic("sort-ascending")+"Change Sorting",fn:settings.setSorting},{title:build.iconic("dropbox","ionicons")+"Set Dropbox",fn:settings.setDropboxKey},{},{title:build.iconic("info")+"About Lychee",fn:function(){return window.open(lychee.website)}},{title:build.iconic("wrench")+"Diagnostics",fn:function(){return window.open("plugins/Diagnostics/")}},{title:build.iconic("align-left")+"Show Log",fn:function(){return window.open("plugins/Log/")}},{},{title:build.iconic("account-logout")+"Sign Out",fn:lychee.logout}];basicContext.show(t,e.originalEvent)},contextMenu.album=function(e,t){if("0"===e||"f"===e||"s"===e||"r"===e)return!1;var n=albums.json&&albums.json.albums&&Object.keys(albums.json.albums).length>1,o=[{title:build.iconic("pencil")+"Rename",fn:function(){return album.setTitle([e])}},{title:build.iconic("collapse-left")+"Merge",visible:n,fn:function(){basicContext.close(),contextMenu.mergeAlbum(e,t)}},{title:build.iconic("trash")+"Delete",fn:function(){return album.delete([e])}}];$('.album[data-id="'+e+'"]').addClass("active"),basicContext.show(o,t.originalEvent,contextMenu.close)},contextMenu.albumMulti=function(e,t){multiselect.stopResize();var n=e.length>1,o=albums.json&&albums.json.albums&&Object.keys(albums.json.albums).length>1,i=[{title:build.iconic("pencil")+"Rename All",fn:function(){return album.setTitle(e)}},{title:build.iconic("collapse-left")+"Merge All",visible:o&&n,fn:function(){return album.merge(e)}},{title:build.iconic("collapse-left")+"Merge",visible:o&&!n,fn:function(){basicContext.close(),contextMenu.mergeAlbum(e[0],t)}},{title:build.iconic("trash")+"Delete All",fn:function(){return album.delete(e)}}];i.push(),basicContext.show(i,t.originalEvent,contextMenu.close)},contextMenu.albumTitle=function(e,t){api.post("Albums::get",{},function(n){var o=[];n.albums&&n.num>1&&($.each(n.albums,function(){var t=this;this.th
7 years ago
;visible.photo()&&(photo.json.title=""===n?"Untitled":n,view.photo.title()),e.forEach(function(e,t,o){album.json.content[e].title=n,view.album.content.title(e)});var o={photoIDs:e.join(),title:n};api.post("Photo::setTitle",o,function(e){e!==!0&&lychee.error(null,o,e)})},i=lychee.html(_templateObject3,t);n=1===e.length?lychee.html(_templateObject29,i):lychee.html(_templateObject30,e.length,i),basicModal.show({body:n,buttons:{action:{title:"Set title",fn:o},cancel:{title:"Cancel",fn:basicModal.close}}})},photo.setAlbum=function(e,t){var n=null,o=null;if(!e)return!1;e instanceof Array==!1&&(e=[e]),e.forEach(function(e,t,i){""===album.json.content[e].nextPhoto&&""===album.json.content[e].previousPhoto||(n=album.json.content[e].nextPhoto,o=album.json.content[e].previousPhoto,album.json.content[o].nextPhoto=n,album.json.content[n].previousPhoto=o),delete album.json.content[e],view.album.content.delete(e)}),albums.refresh(),visible.photo()&&null!=n&&n!==photo.getID()?lychee.goto(album.getID()+"/"+n):visible.albums()||lychee.goto(album.getID());var i={photoIDs:e.join(),albumID:t};api.post("Photo::setAlbum",i,function(e){e!==!0&&lychee.error(null,i,e)})},photo.setStar=function(e){if(!e)return!1;visible.photo()&&(photo.json.star="0"===photo.json.star?"1":"0",view.photo.star()),e.forEach(function(e,t,n){album.json.content[e].star="0"===album.json.content[e].star?"1":"0",view.album.content.star(e)}),albums.refresh();var t={photoIDs:e.join()};api.post("Photo::setStar",t,function(e){e!==!0&&lychee.error(null,t,e)})},photo.setPublic=function(e,t){if("2"===photo.json.public){var n=function(){basicModal.close(),lychee.goto(photo.json.original_album)};return basicModal.show({body:"<p>This photo is located in a public album. To make this photo private or public, edit the visibility of the associated album.</p>",buttons:{action:{title:"Show Album",fn:n},cancel:{title:"Cancel",fn:basicModal.close}}}),!1}visible.photo()&&(photo.json.public="0"===photo.json.public?"1":"0",view.photo.public(),"1"===photo.json.public&&contextMenu.sharePhoto(e,t)),album.json.content[e].public="0"===album.json.content[e].public?"1":"0",view.album.content.public(e),albums.refresh(),api.post("Photo::setPublic",{photoID:e},function(e){e!==!0&&lychee.error(null,params,e)})},photo.setDescription=function(e){var t=photo.json.description,n=function(t){basicModal.close();var n=t.description;visible.photo()&&(photo.json.description=n,view.photo.description());var o={photoID:e,description:n};api.post("Photo::setDescription",o,function(e){e!==!0&&lychee.error(null,o,e)})};basicModal.show({body:lychee.html(_templateObject31,t),buttons:{action:{title:"Set Description",fn:n},cancel:{title:"Cancel",fn:basicModal.close}}})},photo.editTags=function(e){var t="",n="";if(!e)return!1;if(e instanceof Array==!1&&(e=[e]),visible.photo())t=photo.json.tags;else if(visible.album()&&1===e.length)t=album.json.content[e].tags;else if(visible.search()&&1===e.length)t=album.json.content[e].tags;else if(visible.album()&&e.length>1){var o=!0;e.forEach(function(t,n,i){o=album.json.content[t].tags===album.json.content[e[0]].tags&&o===!0}),o===!0&&(t=album.json.content[e[0]].tags)}t=t.replace(/,/g,", ");var i=function(t){basicModal.close(),photo.setTags(e,t.tags)},a=lychee.html(_templateObject32,t);n=1===e.length?lychee.html(_templateObject33,a):lychee.html(_templateObject34,e.length,a),basicModal.show({body:n,buttons:{action:{title:"Set Tags",fn:i},cancel:{title:"Cancel",fn:basicModal.close}}})},photo.setTags=function(e,t){if(!e)return!1;e instanceof Array==!1&&(e=[e]),t=t.replace(/(\ ,\ )|(\ ,)|(,\ )|(,{1,}\ {0,})|(,$|^,)/g,","),t=t.replace(/,$|^,|(\ ){0,}$/g,""),visible.photo()&&(photo.json.tags=t,view.photo.tags()),e.forEach(function(e,n,o){album.json.content[e].tags=t});var n={photoIDs:e.join(),tags:t};api.post("Photo::setTags",n,function(e){e!==!0&&lychee.error(null,n,e)})},photo.deleteTag=function(e,t){var n=void 0;n=photo.json.tags.split(","),n.splice(t,1),photo.json.tags=n.toString(),photo.setTags([e],photo.json.tags)},photo.share=function(e,t){var n=photo.getViewLink(e);switch(t){case"twit
var e=sidebar.createStructure.photo(photo.json),t=sidebar.render(e);sidebar.dom(".sidebar__wrapper").html(t),sidebar.bind()})},visible={},visible.albums=function(){return!!header.dom(".header__toolbar--public").hasClass("header__toolbar--visible")||!!header.dom(".header__toolbar--albums").hasClass("header__toolbar--visible")},visible.album=function(){return!!header.dom(".header__toolbar--album").hasClass("header__toolbar--visible")},visible.photo=function(){return $("#imageview.fadeIn").length>0},visible.search=function(){return null!=search.hash},visible.sidebar=function(){return sidebar.dom().hasClass("active")===!0},visible.sidebarbutton=function(){return!!visible.photo()||!!(visible.album()&&$("#button_info_album:visible").length>0)},visible.header=function(){return header.dom().hasClass("header--hidden")!==!0},visible.contextMenu=function(){return basicContext.visible()},visible.multiselect=function(){return $("#multiselect").length>0};