lychee/dist/main.js

7 lines
188 KiB
JavaScript
Raw Normal View History

2016-01-24 14:21:40 +00:00
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){"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"in e&&e.length,n=ae.type(e);return"function"===n||ae.isWindow(e)?!1:"array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e}function o(e,t,n){if(ae.isFunction(t))return ae.grep(e,function(e,o){return!!t.call(e,o,e)!==n});if(t.nodeType)return ae.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(me.test(t))return ae.filter(t,e,n);t=ae.filter(t,e)}return ae.grep(e,function(e){return J.call(t,e)>-1!==n})}function i(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}function a(e){var t={};return ae.each(e.match(xe)||[],function(e,n){t[n]=!0}),t}function r(){V.removeEventListener("DOMContentLoaded",r),e.removeEventListener("load",r),ae.ready()}function s(){this.expando=ae.expando+s.uid++}function l(e,t,n){var o;if(void 0===n&&1===e.nodeType)if(o="data-"+t.replace($e,"-$&").toLowerCase(),n=e.getAttribute(o),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:Ce.test(n)?ae.parseJSON(n):n}catch(i){}ke.set(e,t,n)}else n=void 0;return n}function u(e,t,n,o){var i,a=1,r=20,s=o?function(){return o.cur()}:function(){return ae.css(e,t,"")},l=s(),u=n&&n[3]||(ae.cssNumber[t]?"":"px"),c=(ae.cssNumber[t]||"px"!==u&&+l)&&Ae.exec(ae.css(e,t));if(c&&c[3]!==u){u=u||c[3],n=n||[],c=+l||1;do a=a||".5",c/=a,ae.style(e,t,c+u);while(a!==(a=s()/l)&&1!==a&&--r)}return n&&(c=+c||+l||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],o&&(o.unit=u,o.start=c,o.end=i)),i}function c(e,t){var n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[];return void 0===t||t&&ae.nodeName(e,t)?ae.merge([e],n):n}function d(e,t){for(var n=0,o=e.length;o>n;n++)Me.set(e[n],"globalEval",!t||Me.get(t[n],"globalEval"))}function p(e,t,n,o,i){for(var a,r,s,l,u,p,h=t.createDocumentFragment(),f=[],m=0,b=e.length;b>m;m++)if(a=e[m],a||0===a)if("object"===ae.type(a))ae.merge(f,a.nodeType?[a]:a);else if(Ne.test(a)){for(r=r||h.appendChild(t.createElement("div")),s=(Pe.exec(a)||["",""])[1].toLowerCase(),l=Oe[s]||Oe._default,r.innerHTML=l[1]+ae.htmlPrefilter(a)+l[2],p=l[0];p--;)r=r.lastChild;ae.merge(f,r.childNodes),r=h.firstChild,r.textContent=""}else f.push(t.createTextNode(a));for(h.textContent="",m=0;a=f[m++];)if(o&&ae.inArray(a,o)>-1)i&&i.push(a);else if(u=ae.contains(a.ownerDocument,a),r=c(h.appendChild(a),"script"),u&&d(r),n)for(p=0;a=r[p++];)Ie.test(a.type||"")&&n.push(a);return h}function h(){return!0}function f(){return!1}function m(){try{return V.activeElement}catch(e){}}function b(e,t,n,o,i,a){var r,s;if("object"==typeof t){"string"!=typeof n&&(o=o||n,n=void 0);for(s in t)b(e,s,n,o,t[s],a);return e}if(null==o&&null==i?(i=n,o=n=void 0):null==i&&("string"==typeof n?(i=o,o=void 0):(i=o,o=n,n=void 0)),i===!1)i=f;else if(!i)return this;return 1===a&&(r=i,i=function(e){return ae().off(e),r.apply(this,arguments)},i.guid=r.guid||(r.guid=ae.guid++)),e.each(function(){ae.event.add(this,t,i,o,n)})}function g(e,t){return ae.nodeName(e,"table")&&ae.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e:e}function v(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function y(e){var t=We.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function w(e,t){var n,o,i,a,r,s,l,u;if(1===t.nodeType){if(Me.hasData(e)&&(a=Me.access(e),r=Me.set(t,a),u=a.events)){delete r.handle,r.events={};for(i in u)for(n=0,o=u[i].length;o>n;n++)ae.event.add(t,i,u[i][n])}ke.hasData(e)&&(s=ke.access(e),l=ae.extend({},s),ke.set(t,l))}}function x(e,t){var n=t.nodeName.toLowerCase();"input"=
},first:u(function(){return[0]}),last:u(function(e,t){return[t-1]}),eq:u(function(e,t,n){return[0>n?n+t:n]}),even:u(function(e,t){for(var n=0;t>n;n+=2)e.push(n);return e}),odd:u(function(e,t){for(var n=1;t>n;n+=2)e.push(n);return e}),lt:u(function(e,t,n){for(var o=0>n?n+t:n;--o>=0;)e.push(o);return e}),gt:u(function(e,t,n){for(var o=0>n?n+t:n;++o<t;)e.push(o);return e})}},_.pseudos.nth=_.pseudos.eq;for(w in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})_.pseudos[w]=s(w);for(w in{submit:!0,reset:!0})_.pseudos[w]=l(w);return d.prototype=_.filters=_.pseudos,_.setFilters=new d,M=t.tokenize=function(e,n){var o,i,a,r,s,l,u,c=W[e+" "];if(c)return n?0:c.slice(0);for(s=e,l=[],u=_.preFilter;s;){(!o||(i=le.exec(s)))&&(i&&(s=s.slice(i[0].length)||s),l.push(a=[])),o=!1,(i=ue.exec(s))&&(o=i.shift(),a.push({value:o,type:i[0].replace(se," ")}),s=s.slice(o.length));for(r in _.filter)!(i=he[r].exec(s))||u[r]&&!(i=u[r](i))||(o=i.shift(),a.push({value:o,type:r,matches:i}),s=s.slice(o.length));if(!o)break}return n?s.length:s?t.error(e):W(e,l).slice(0)},k=t.compile=function(e,t){var n,o=[],i=[],a=X[e+" "];if(!a){for(t||(t=M(e)),n=t.length;n--;)a=v(t[n]),a[H]?o.push(a):i.push(a);a=X(e,y(i,o)),a.selector=e}return a},C=t.select=function(e,t,n,o){var i,a,r,s,l,u="function"==typeof e&&e,d=!o&&M(e=u.selector||e);if(n=n||[],1===d.length){if(a=d[0]=d[0].slice(0),a.length>2&&"ID"===(r=a[0]).type&&x.getById&&9===t.nodeType&&P&&_.relative[a[1].type]){if(t=(_.find.ID(r.matches[0].replace(we,xe),t)||[])[0],!t)return n;u&&(t=t.parentNode),e=e.slice(a.shift().value.length)}for(i=he.needsContext.test(e)?0:a.length;i--&&(r=a[i],!_.relative[s=r.type]);)if((l=_.find[s])&&(o=l(r.matches[0].replace(we,xe),ve.test(a[0].type)&&c(t.parentNode)||t))){if(a.splice(i,1),e=o.length&&p(a),!e)return Q.apply(n,o),n;break}}return(u||k(e,d))(o,t,!P,n,!t||ve.test(e)&&c(t.parentNode)||t),n},x.sortStable=H.split("").sort(z).join("")===H,x.detectDuplicates=!!A,E(),x.sortDetached=i(function(e){return 1&e.compareDocumentPosition(S.createElement("div"))}),i(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||a("type|href|height|width",function(e,t,n){return n?void 0:e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),x.attributes&&i(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||a("value",function(e,t,n){return n||"input"!==e.nodeName.toLowerCase()?void 0:e.defaultValue}),i(function(e){return null==e.getAttribute("disabled")})||a(te,function(e,t,n){var o;return n?void 0:e[t]===!0?t.toLowerCase():(o=e.getAttributeNode(t))&&o.specified?o.value:null}),t}(e);ae.find=ce,ae.expr=ce.selectors,ae.expr[":"]=ae.expr.pseudos,ae.uniqueSort=ae.unique=ce.uniqueSort,ae.text=ce.getText,ae.isXMLDoc=ce.isXML,ae.contains=ce.contains;var de=function(e,t,n){for(var o=[],i=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(i&&ae(e).is(n))break;o.push(e)}return o},pe=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},he=ae.expr.match.needsContext,fe=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,me=/^.[^:#\[\.,]*$/;ae.filter=function(e,t,n){var o=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===o.nodeType?ae.find.matchesSelector(o,e)?[o]:[]:ae.find.matches(e,ae.grep(t,function(e){return 1===e.nodeType}))},ae.fn.extend({find:function(e){var t,n=this.length,o=[],i=this;if("string"!=typeof e)return this.pushStack(ae(e).filter(function(){for(t=0;n>t;t++)if(ae.contains(i[t],this))return!0}));for(t=0;n>t;t++)ae.find(e,i[t],o);return o=this.pushStack(n>1?ae.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&&he.test(e)?ae(e):e||[],!1).length}});var be,ge=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,ve=ae.fn.init=function(e,t,n){var o,i;if(!e)return this;if(n=n||be,"string"==typeof e){if(o="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:ge.exec(e),!o||!o[1]&&t)return!t||t.jquery?(t||n)
}}),ae.timers=[],ae.fx.tick=function(){var e,t=0,n=ae.timers;for(it=ae.now();t<n.length;t++)e=n[t],e()||n[t]!==e||n.splice(t--,1);n.length||ae.fx.stop(),it=void 0},ae.fx.timer=function(e){ae.timers.push(e),e()?ae.fx.start():ae.timers.pop()},ae.fx.interval=13,ae.fx.start=function(){at||(at=e.setInterval(ae.fx.tick,ae.fx.interval))},ae.fx.stop=function(){e.clearInterval(at),at=null},ae.fx.speeds={slow:600,fast:200,_default:400},ae.fn.delay=function(t,n){return t=ae.fx?ae.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=V.createElement("input"),t=V.createElement("select"),n=t.appendChild(V.createElement("option"));e.type="checkbox",oe.checkOn=""!==e.value,oe.optSelected=n.selected,t.disabled=!0,oe.optDisabled=!n.disabled,e=V.createElement("input"),e.value="t",e.type="radio",oe.radioValue="t"===e.value}();var lt,ut=ae.expr.attrHandle;ae.fn.extend({attr:function(e,t){return je(this,ae.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){ae.removeAttr(this,e)})}}),ae.extend({attr:function(e,t,n){var o,i,a=e.nodeType;return 3!==a&&8!==a&&2!==a?"undefined"==typeof e.getAttribute?ae.prop(e,t,n):(1===a&&ae.isXMLDoc(e)||(t=t.toLowerCase(),i=ae.attrHooks[t]||(ae.expr.match.bool.test(t)?lt:void 0)),void 0!==n?null===n?void ae.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=ae.find.attr(e,t),null==o?void 0:o)):void 0},attrHooks:{type:{set:function(e,t){if(!oe.radioValue&&"radio"===t&&ae.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,o,i=0,a=t&&t.match(xe);if(a&&1===e.nodeType)for(;n=a[i++];)o=ae.propFix[n]||n,ae.expr.match.bool.test(n)&&(e[o]=!1),e.removeAttribute(n)}}),lt={set:function(e,t,n){return t===!1?ae.removeAttr(e,n):e.setAttribute(n,n),n}},ae.each(ae.expr.match.bool.source.match(/\w+/g),function(e,t){var n=ut[t]||ae.find.attr;ut[t]=function(e,t,o){var i,a;return o||(a=ut[t],ut[t]=i,i=null!=n(e,t,o)?t.toLowerCase():null,ut[t]=a),i}});var ct=/^(?:input|select|textarea|button)$/i,dt=/^(?:a|area)$/i;ae.fn.extend({prop:function(e,t){return je(this,ae.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[ae.propFix[e]||e]})}}),ae.extend({prop:function(e,t,n){var o,i,a=e.nodeType;return 3!==a&&8!==a&&2!==a?(1===a&&ae.isXMLDoc(e)||(t=ae.propFix[t]||t,i=ae.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){var t=ae.find.attr(e,"tabindex");return t?parseInt(t,10):ct.test(e.nodeName)||dt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),oe.optSelected||(ae.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null}}),ae.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){ae.propFix[this.toLowerCase()]=this});var pt=/[\t\r\n\f]/g;ae.fn.extend({addClass:function(e){var t,n,o,i,a,r,s,l=0;if(ae.isFunction(e))return this.each(function(t){ae(this).addClass(e.call(this,t,R(this)))});if("string"==typeof e&&e)for(t=e.match(xe)||[];n=this[l++];)if(i=R(n),o=1===n.nodeType&&(" "+i+" ").replace(pt," ")){for(r=0;a=t[r++];)o.indexOf(" "+a+" ")<0&&(o+=a+" ");s=ae.trim(o),i!==s&&n.setAttribute("class",s)}return this},removeClass:function(e){var t,n,o,i,a,r,s,l=0;if(ae.isFunction(e))return this.each(function(t){ae(this).removeClass(e.call(this,t,R(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof e&&e)for(t=e.match(xe)||[];n=this[l++];)if(i=R(n),o=1===n.nodeType&&(" "+i+" ").replace(pt," ")){for(r=0;a=t[r++];)for(;o.indexOf(" "+a+" ")>-1;)o=o.replace(" "+a+" "," ");s=ae.trim(o),i!==s&&n.setAttribute("class",s)}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):ae.is
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):!0)},s=function(e){var t='<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>',n="";return n+="\n <div class='basicModalContainer basicModalContainer--fadeIn' data-closable='"+e.closable+"'>\n <div class='basicModal basicModal--fadeIn "+e["class"]+"' role=\"dialog\">\n <div class='basicModal__content'>\n "+e.body+"\n </div>\n <div class='basicModal__buttons'>\n ",null!=e.buttons.cancel&&(n+=-1===e.buttons.cancel["class"].indexOf("basicModal__xclose")?"<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'>"+t+"</div>"),null!=e.buttons.action&&(n+="<a id='basicModal__action' class='basicModal__button "+e.buttons.action["class"]+"'>"+e.buttons.action.title+"</a>"),n+="\n </div>\n </div>\n </div>\n "},l=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},u=function(e){return null!=e.buttons.cancel&&(i("#basicModal__cancel").onclick=function(){return this.classList.contains("basicModal__button--active")===!0?!1:(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?!1:(this.classList.add("basicModal__button--active"),void e.buttons.action.fn(l()))}),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},c=(n.show=function h(e){if(r(e)===!1)return!1;if(null!=i())return p(!0),setTimeout(function(){return h(e)},301),!1;o=document.activeElement;var t=s(e);document.body.insertAdjacentHTML("beforeend",t),u(e);var n=i("input");null!=n&&n.select();var a=i("select");return null==n&&null!=a&&a.focus(),null!=e.callback&&e.callback(e),!0},n.error=function(e){d();var t=i("input[name='"+e+"']")||i("select[name='"+e+"']");return null==t?!1:(t.classList.add("error"),"function"==typeof t.select?t.select():t.focus(),i().classList.remove("basicModal--fadeIn","basicModal--shake"),void setTimeout(function(){return i().classList.add("basicModal--shake")},1))},n.visible=function(){return null!=i()?!0:!1}),d=(n.action=function(){var e=i("#basicModal__action");return null!=e?(e.click(),!0):!1},n.cancel=function(){var e=i("#basicModal__cancel");return null!=e?(e.click(),!0):!1},n.reset=function(){var e=i(".basicModal__button",!0);a(e,function(e){return e.classList.remove("basicModal__button--active")});var t=i("input",!0);a(t,function(e){return e.classList.remove("error")});var n=i("select",!0);return a(n,function(e){return e.classList.remove("error")}),!0}),p=n.close=function(){var e=arguments.length<=0||void 0===arguments[0]?!1:arguments[0];if(c()===!1)return!1;var t=i().parentElement;return"false"===t.getAttribute("dat
var t="";switch(t+="\n <div class='no_content fadeIn'>\n "+build.iconic(e)+"\n ",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),n+=i.supported===!0?"<a class='status'></a>":"<a class='status error'>Not supported</a>",n+="\n <p class='notice'></p>\n </div>\n ",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/check/")}},{title:build.iconic("align-left")+"Show Log",fn:function(){return window.open("plugins/displaylog/")}},{},{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?!0:!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("Album::getAll",{},function(n){var o=[];n.albums&&n.num>1&&($.each(n.albums,function(){var t=this;this.thumbs[0]||(this.thumbs[0]="src/images/no_cover.svg");var n=lychee.html(_templateObject24,this.thumbs[0],this.title);this.id!=e&&o.push({title:n,fn:function(){return lychee["goto"](t.id)}})}),o.unshift({})),o.unshift({title:build.iconic("pencil")+"Rename",fn:function(){return album.setTitle([e])}}),basicContext.show(o,t.originalEvent,contextMenu.close)})},contextMenu.mergeAlbum=function(e,t){api.post("Album::getAll",{},function(n){var o=[];return n.albums&&n.num>1&&$.each(n.albums,function(){var t=this;this.thumbs[0]||(this.thumbs[0]="src/images/no_cover.svg");var n=lychee.html(_templateObject24,this.thumbs[0],this.title);this.id!=e&&o.push({title:
album.json.content[n].previousPhoto=o),delete album.json.content[e],view.album.content["delete"](e)}),albums.refresh();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;e instanceof Array==!1&&(e=[e]),visible.photo()?t=photo.json.tags:visible.album()&&1===e.length?t=album.json.content[e].tags:visible.search()&&1===e.length?t=album.json.content[e].tags:visible.album()&&e.length>1&&!function(){var n=!0;e.forEach(function(t,o,i){n=album.json.content[t].tags===album.json.content[e[0]].tags&&n===!0?!0:!1}),n===!0&&(t=album.json.content[e[0]].tags)}(),t=t.replace(/,/g,", ");var o=function(t){basicModal.close(),photo.setTags(e,t.tags)},i=lychee.html(_templateObject32,t);n=1===e.length?lychee.html(_templateObject33,i):lychee.html(_templateObject34,e.length,i),basicModal.show({body:n,buttons:{action:{title:"Set Tags",fn:o},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="",o=photo.getViewLink(e);switch(t){case"twitter":n="https://twitter.com/share?url="+encodeURI(o);break;case"facebook":n="http://www.facebook.com/sharer.php?u="+encodeURI(o)+"&t="+encodeURI(photo.json.title);break;case"mail":n="mailto:?subject="+encodeURI(photo.json.title)+"&body="+encodeURI(o);break;case"dropbox":lychee.loadDropbox(function(){var e=photo.json.title+"."+photo.getDirectLink().split(".").pop();Dropbox.save(photo.getDirectLink(),e)});break;default:n=""}""!==n.length&&(location.href=n)},photo.getArchive=function(e){var t=void 0,n=api.path+"?function=Photo::getArchive&photoID="+e;t=location.href.indexOf("index.html")>0?location.href.replace(location.hash,"").replace("index.html",n):location.href.replace(location.hash,"")+n,lychee.publicMode===!0&&(t+="&password="+encodeURIComponent(password.value)),location.href=t},photo.getDirectLink=function(){var e="";return photo.json&&photo.json.url&&""!==photo.json.url&&(e=photo.json.url)
visible.sidebar=function(){return sidebar.dom().hasClass("active")===!0?!0:!1},visible.sidebarbutton=function(){return visible.photo()?!0:visible.album()&&$("#button_info_album:visible").length>0?!0:!1},visible.header=function(){return header.dom().hasClass("header--hidden")===!0?!1:!0},visible.contextMenu=function(){return basicContext.visible()},visible.multiselect=function(){return $("#multiselect").length>0?!0:!1};