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

6 lines
186 KiB

9 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){"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="length"in e&&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(se.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=fe[e]={};return J.each(e.match(he)||[],function(e,n){t[n]=!0}),t}function r(){Z.removeEventListener("DOMContentLoaded",r,!1),e.removeEventListener("load",r,!1),J.ready()}function s(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=J.expando+s.uid++}function l(e,t,n){var o;if(void 0===n&&1===e.nodeType)if(o="data-"+t.replace(we,"-$1").toLowerCase(),n=e.getAttribute(o),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:ye.test(n)?J.parseJSON(n):n}catch(i){}ve.set(e,t,n)}else n=void 0;return n}function c(){return!0}function u(){return!1}function d(){try{return Z.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=Ie.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++)ge.set(e[n],"globalEval",!t||ge.get(t[n],"globalEval"))}function b(e,t){var n,o,i,a,r,s,l,c;if(1===t.nodeType){if(ge.hasData(e)&&(a=ge.access(e),r=ge.set(t,a),c=a.events)){delete r.handle,r.events={};for(i in c)for(n=0,o=c[i].length;o>n;n++)J.event.add(t,i,c[i][n])}ve.hasData(e)&&(s=ve.access(e),l=J.extend({},s),ve.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&&Te.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=Z,n=Re[e];return n||(n=y(e,t),"none"!==n&&n||(Fe=(Fe||J("<iframe frameborder='0' width='0' height='0'/>")).appendTo(t.documentElement),t=Fe[0].contentDocument,t.write(),t.close(),n=y(e,t),Fe.detach()),Re[e]=n),n}function x(e,t,n){var o,i,a,r,s=e.style;return n=n||Be(e),n&&(r=n.getPropertyValue(t)||n[t]),n&&(""!==r||J.contains(e.ownerDocument,e)||(r=J.style(e,t)),Ue.test(r)&&He.test(t)&&(o=s.width,i=s.minWidth,a=s.maxWidth,s.minWidth=s.maxWidth=s.width=r,r=n.width,s.width=o,s.minWidth=i,s.maxWidth=a)),void 0!==r?r+"":r}function _(e,t){return{get:function(){return e()?void delete this.get:(this.get=t).apply(this,arguments)}}}function j(e,t){if(t in e)return t;for(var n=t[0].toUpperCase()+t.slice(1),o=t,i=Ve.length;i--;)if(t=Ve[i]+n,t in e)return t;return o}function T(e,t,n){var o=Xe.exec(t);return o?Math.max(0,o[1]-(n||0))+(o[2]||"px"):t}function M(e,t,n,o,i){for(var a=n===(o?"border":"content")?4:"width"===t?1:0,r=0;4>a;a+=2)"margin"===n&&(r+=J.css(e,n+_e[a],!0,i)),o?("content"===n&&(r-=J.css(e,"padding"+_e[a],!0,i)),"margin"!==n&&(r-=J.css(e,"border"+_e[a]+"Width",!0,i))):(r+=J.css(e,"
J.filter=function(e,t,n){var o=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===o.nodeType?J.find.matchesSelector(o,e)?[o]:[]:J.find.matches(e,J.grep(t,function(e){return 1===e.nodeType}))},J.fn.extend({find:function(e){var t,n=this.length,o=[],i=this;if("string"!=typeof e)return this.pushStack(J(e).filter(function(){for(t=0;n>t;t++)if(J.contains(i[t],this))return!0}));for(t=0;n>t;t++)J.find(e,i[t],o);return o=this.pushStack(n>1?J.unique(o):o),o.selector=this.selector?this.selector+" "+e:e,o},filter:function(e){return this.pushStack(o(this,e||[],!1))},not:function(e){return this.pushStack(o(this,e||[],!0))},is:function(e){return!!o(this,"string"==typeof e&&ae.test(e)?J(e):e||[],!1).length}});var le,ce=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,ue=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]:ce.exec(e),!n||!n[1]&&t)return!t||t.jquery?(t||le).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:Z,!0)),re.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=Z.getElementById(n[2]),o&&o.parentNode&&(this.length=1,this[0]=o),this.context=Z,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):J.isFunction(e)?"undefined"!=typeof le.ready?le.ready(e):e(J):(void 0!==e.selector&&(this.selector=e.selector,this.context=e.context),J.makeArray(e,this))};ue.prototype=J.fn,le=J(Z);var de=/^(?:parents|prev(?:Until|All))/,pe={children:!0,contents:!0,next:!0,prev:!0};J.extend({dir:function(e,t,n){for(var o=[],i=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(i&&J(e).is(n))break;o.push(e)}return o},sibling:function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}}),J.fn.extend({has:function(e){var t=J(e,this),n=t.length;return this.filter(function(){for(var e=0;n>e;e++)if(J.contains(this,t[e]))return!0})},closest:function(e,t){for(var n,o=0,i=this.length,a=[],r=ae.test(e)||"string"!=typeof e?J(e,t||this.context):0;i>o;o++)for(n=this[o];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(r?r.index(n)>-1:1===n.nodeType&&J.find.matchesSelector(n,e))){a.push(n);break}return this.pushStack(a.length>1?J.unique(a):a)},index:function(e){return e?"string"==typeof e?z.call(J(e),this[0]):z.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(J.unique(J.merge(this.get(),J(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),J.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return J.dir(e,"parentNode")},parentsUntil:function(e,t,n){return J.dir(e,"parentNode",n)},next:function(e){return i(e,"nextSibling")},prev:function(e){return i(e,"previousSibling")},nextAll:function(e){return J.dir(e,"nextSibling")},prevAll:function(e){return J.dir(e,"previousSibling")},nextUntil:function(e,t,n){return J.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return J.dir(e,"previousSibling",n)},siblings:function(e){return J.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return J.sibling(e.firstChild)},contents:function(e){return e.contentDocument||J.merge([],e.childNodes)}},function(e,t){J.fn[e]=function(n,o){var i=J.map(this,t,n);return"Until"!==e.slice(-5)&&(o=n),o&&"string"==typeof o&&(i=J.filter(o,i)),this.length>1&&(pe[e]||J.unique(i),de.test(e)&&i.reverse()),this.pushStack(i)}});var he=/\S+/g,fe={};J.Callbacks=function(e){e="string"==typeof e?fe[e]||a(e):J.extend({},e);var t,n,o,i,r,s,l=[],c=!e.once&&[],u=function(a){for(t=e.memory&&a,n=!0,s=i||0,i=0,r=l.length,o=!0;l&&r>s;s++)if(l[s].apply(a[0],a[1])===!1&&e.stopOnFalse){t=!1;break}o=!1,l&&(c?c.length&&u(c.shift()):t?l=[]:d.disable())},d={add:function(){if(l){var n=l.length;!function a(t){J.each(t,function(t,n){var o=J.type(n);"function"===o?e.unique&&d.has(n)||l.push(n):n&&n.length&&"string"!==o&&a(n)})}(arguments),o?r=l.length:t&&(i=n,u
t=!1,a.splice(i,1));(t||!n)&&J.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=ge.get(this),o=n[e+"queue"],i=n[e+"queueHooks"],a=J.timers,r=o?o.length:0;for(n.finish=!0,J.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=a.length;t--;)a[t].elem===this&&a[t].queue===e&&(a[t].anim.stop(!0),a.splice(t,1));for(t=0;r>t;t++)o[t]&&o[t].finish&&o[t].finish.call(this);delete n.finish})}}),J.each(["toggle","show","hide"],function(e,t){var n=J.fn[t];J.fn[t]=function(e,o,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(A(t,!0),e,o,i)}}),J.each({slideDown:A("show"),slideUp:A("hide"),slideToggle:A("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(Ge=J.now();t<n.length;t++)e=n[t],e()||n[t]!==e||n.splice(t--,1);n.length||J.fx.stop(),Ge=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(){Ze||(Ze=setInterval(J.fx.tick,J.fx.interval))},J.fx.stop=function(){clearInterval(Ze),Ze=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=Z.createElement("input"),t=Z.createElement("select"),n=t.appendChild(Z.createElement("option"));e.type="checkbox",G.checkOn=""!==e.value,G.optSelected=n.selected,t.disabled=!0,G.optDisabled=!n.disabled,e=Z.createElement("input"),e.value="t",e.type="radio",G.radioValue="t"===e.value}();var ot,it,at=J.expr.attrHandle;J.fn.extend({attr:function(e,t){return be(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===Me?J.prop(e,t,n):(1===a&&J.isXMLDoc(e)||(t=t.toLowerCase(),o=J.attrHooks[t]||(J.expr.match.bool.test(t)?it:ot)),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(he);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}}}}}),it={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=at[t]||J.find.attr;at[t]=function(e,t,o){var i,a;return o||(a=at[t],at[t]=i,i=null!=n(e,t,o)?t.toLowerCase():null,at[t]=a),i}});var rt=/^(?:input|select|textarea|button)$/i;J.fn.extend({prop:function(e,t){return be(this,J.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[J.propFix[e]||e]})}}),J.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(e,t,n){var o,i,a,r=e.nodeType;return e&&3!==r&&8!==r&&2!==r?(a=1!==r||!J.isXMLDoc(e),a&&(t=J.propFix[t]||t,i=J.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(o=i.set(e,n,t))?o:e[t]=n:i&&"get"in i&&null!==(o=i.get(e,t))?o:e[t]):void 0},propHooks:{tabIndex:{get:function(e){return e.hasAttribute("tabindex")||rt.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 st=/[\t\r\n\f]/g;J.fn.extend({addClass:function(e){var t,n,o,i,a,r,s="string"==typeof e&&e,l=0,c=this.length;if(J.isFunction(e))return this.each(function(t){J(this).addClass(e.call(this,t,this.className))});if(s)for(t=(e||"").match(he)||[];c>l;l++)if(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},c=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},u=(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),c(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(u()===!1)return!1;var t=i().parentElement;return"false"===t.getAttribute("data-closable")&&e===!1?!1:(t.classList.remove("basicModalContainer--fadeIn"),t.classList.add("basicModalContainer--fadeOut"),setTimeout(function(){return null==t?!1:null==t.parentElement?!1:void t.parentElement.removeChild(t)},300),null!=o&&(o.focus(),o=null),!0)}},{}]},{},[1])(1)});var _templateObject=_taggedTemplateLiteral(["<p>Are you sure you want to delete the album '$","' and all of the photos it contains? This action can't be undone!</p>"],["<p>Are you sure you want to delete the album '$","' and all of the photos it contains? This action can't be undone!</p>"]),_templateObject2=_taggedTemplateLiteral(["<p>Are you sure you want to delete all $"," selected albums and all of the photos they contain? This action can't be undone!</p>"],["<p>Are you sure you want to delete all $"," selected albums and all of the photos they contain? This action can't be undone!</p>"]),_templateObject3=_taggedTemplateLiteral(["<input class='text' name='title' type='text' maxlength='50' placeholder='Title' value='$","'>"],["<input class='text' name='title' type='text' maxlength='50' placeholder='Title' value='$","'>"]),_templateObject4=_taggedTemplateLiteral(["<p>Enter a new title for this album: ","</p>"],["<p>Enter a new title for this album: ","</p>"]),_templateObject5=_taggedTemplateLiteral(["<p>Enter a title for all $"," selected albums: ","</p>"],["<p>Enter a title for all $"," selected albums: ","</p>"]),_templateObject6=_taggedTemplateLiteral(["<p>Please enter a description for this album: <input class='text' name='description' type='text' maxlength='800' placeholder='Description' value='$","'></p>"],["<p>Please enter a description for this album: <input class='text' name='description' type='text' maxlength='800' placeholder='Description' value='$","'></p>"]),_templateObject7=_taggedTemplateLiteral(["<p>Are you sure you want to mer
9 years ago
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:n,fn:function(){return album.merge([e,t.id])}})}),0===o.length?!1:void basicContext.show(o,t.originalEvent,contextMenu.close)})},contextMenu.photo=function(e,t){var n=[{title:build.iconic("star")+"Star",fn:function(){return photo.setStar([e])}},{title:build.iconic("tag")+"Tags",fn:function(){return photo.editTags([e])}},{},{title:build.iconic("pencil")+"Rename",fn:function(){return photo.setTitle([e])}},{title:build.iconic("layers")+"Duplicate",fn:function(){return photo.duplicate([e])}},{title:build.iconic("folder")+"Move",fn:function(){basicContext.close(),contextMenu.move([e],t)}},{title:build.iconic("trash")+"Delete",fn:function(){return photo["delete"]([e])}}];$('.photo[data-id="'+e+'"]').addClass("active"),basicContext.show(n,t.originalEvent,contextMenu.close)},contextMenu.photoMulti=function(e,t){multiselect.stopResize();var n=[{title:build.iconic("star")+"Star All",fn:function(){return photo.setStar(e)}},{title:build.iconic("tag")+"Tag All",fn:function(){return photo.editTags(e)}},{},{title:build.iconic("pencil")+"Rename All",fn:function(){return photo.setTitle(e)}},{title:build.iconic("layers")+"Duplicate All",fn:function(){return photo.duplicate(e)}},{title:build.iconic("folder")+"Move All",fn:function(){basicContext.close(),contextMenu.move(e,t)}},{title:build.iconic("trash")+"Delete All",fn:function(){return photo["delete"](e)}}];basicContext.show(n,t.originalEvent,contextMenu.close)},contextMenu.photoTitle=function(e,t,n){var o=[{title:build.iconic("pencil")+"Rename",fn:function(){return photo.setTitle([t])}}],i=album.json;i.content!==!1&&i.num>1&&(o.push({}),$.each(i.content,function(n){var i=this,a=lychee.html(_templateObject24,this.thumbUrl,this.title);this.id!=t&&o.push({title:a,fn:function(){return lychee["goto"](e+"/"+i.id)}})})),basicContext.show(o,n.originalEvent,contextMenu.close)},contextMenu.ph
9 years ago
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),e},photo.getViewLink=function(e){var t="view.php?p="+e;return location.href.indexOf("index.html")>0?location.href.replace("index.html"+location.hash,t):location.href.replace(location.hash,t)},search={hash:null},search.find=function(e){clearTimeout($(window).data("timeout")),$(window).data("timeout",setTimeout(function(){0!==header.dom(".header__search").val().length?api.post("search",{term:e},function(e){var t="",n="",o="";e&&e.albums&&(albums.json={albums:e.albums},$.each(albums.json.albums,function(){albums.parse(this),n+=build.album(this)})),e&&e.photos&&(album.json={content:e.photos},$.each(album.json.content,function(){o+=build.photo(this)})),t=""===n&&""===o?"error":""===n?build.divider("Photos")+o:""===o?build.divider("Albums")+n:build.divider("Photos")+o+build.divider("Albums")+n,search.hash!==e.hash&&($(".no_content").remove(),lychee.animate(".content","contentZoomOut"),search.hash=e.hash,setTimeout(function(){"error"===t?(lychee.content.html(""),$("body").append(build.no_content("magnifying-glass"))):(lychee.content.html(t),lychee.animate(lychee.content,"contentZoomIn"))},300))}):search.reset()},250))},search.reset=function(){header.dom(".header__search").val(""),$(".no_content").remove(),null!=search.hash&&(albums.json=null,album.json=null,photo.json=null,search.hash=null,lychee.animate(".divider","fadeOut"),albums.load())},settings={},settings.createConfig=function(){var e=function(e){var t=e.dbName||"",n=e.dbUser||"",o=e.dbPassword||"",i=e.dbHost||"",a=e.dbTablePrefix||"";if(n.length<1)return basicModal.error("dbUser"),!1;i.length<1&&(i="localhost"),t.length<1&&(t="lychee");var r={dbName:t,dbUser:n,dbPassword:o,dbHost:i,dbTablePrefix:a};api.post("Database::createConfig",r,function(e){return e!==!0?-1!==e.indexOf("Warning: Connection failed!")?(basicModal.show({body:"<p>Unable to connect to