lychee/dist/view.js

4 lines
109 KiB
JavaScript
Raw Normal View History

2016-10-25 16:34:25 +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),r=n.exec(window.location.href);return null===r?"":r[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||te;var n=t.createElement("script");n.text=e,t.head.appendChild(n).parentNode.removeChild(n)}function r(e){var t=!!e&&"length"in e&&e.length,n=he.type(e);return"function"!==n&&!he.isWindow(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}function i(e,t,n){return he.isFunction(t)?he.grep(e,function(e,r){return!!t.call(e,r,e)!==n}):t.nodeType?he.grep(e,function(e){return e===t!==n}):"string"!=typeof t?he.grep(e,function(e){return ae.call(t,e)>-1!==n}):_e.test(t)?he.filter(t,e,n):(t=he.filter(t,e),he.grep(e,function(e){return ae.call(t,e)>-1!==n&&1===e.nodeType}))}function o(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}function a(e){var t={};return he.each(e.match($e)||[],function(e,n){t[n]=!0}),t}function s(e){return e}function l(e){throw e}function u(e,t,n){var r;try{e&&he.isFunction(r=e.promise)?r.call(e).done(t).fail(n):e&&he.isFunction(r=e.then)?r.call(e,t,n):t.call(void 0,e)}catch(e){n.call(void 0,e)}}function c(){te.removeEventListener("DOMContentLoaded",c),e.removeEventListener("load",c),he.ready()}function d(){this.expando=he.expando+d.uid++}function f(e){return"true"===e||"false"!==e&&("null"===e?null:e===+e+""?+e:He.test(e)?JSON.parse(e):e)}function p(e,t,n){var r;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(Fe,"-$&").toLowerCase(),n=e.getAttribute(r),"string"==typeof n){try{n=f(n)}catch(e){}Pe.set(e,t,n)}else n=void 0;return n}function h(e,t,n,r){var i,o=1,a=20,s=r?function(){return r.cur()}:function(){return he.css(e,t,"")},l=s(),u=n&&n[3]||(he.cssNumber[t]?"":"px"),c=(he.cssNumber[t]||"px"!==u&&+l)&&Me.exec(he.css(e,t));if(c&&c[3]!==u){u=u||c[3],n=n||[],c=+l||1;do o=o||".5",c/=o,he.style(e,t,c+u);while(o!==(o=s()/l)&&1!==o&&--a)}return n&&(c=+c||+l||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=u,r.start=c,r.end=i)),i}function m(e){var t,n=e.ownerDocument,r=e.nodeName,i=Ue[r];return i?i:(t=n.body.appendChild(n.createElement(r)),i=he.css(t,"display"),t.parentNode.removeChild(t),"none"===i&&(i="block"),Ue[r]=i,i)}function g(e,t){for(var n,r,i=[],o=0,a=e.length;o<a;o++)r=e[o],r.style&&(n=r.style.display,t?("none"===n&&(i[o]=qe.get(r,"display")||null,i[o]||(r.style.display="")),""===r.style.display&&We(r)&&(i[o]=m(r))):"none"!==n&&(i[o]="none",qe.set(r,"display",n)));for(o=0;o<a;o++)null!=i[o]&&(e[o].style.display=i[o]);return e}function v(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&he.nodeName(e,t)?he.merge([e],n):n}function b(e,t){for(var n=0,r=e.length;n<r;n++)qe.set(e[n],"globalEval",!t||qe.get(t[n],"globalEval"))}function y(e,t,n,r,i){for(var o,a,s,l,u,c,d=t.createDocumentFragment(),f=[],p=0,h=e.length;p<h;p++)if(o=e[p],o||0===o)if("object"===he.type(o))he.merge(f,o.nodeType?[o]:o);else if(Ge.test(o)){for(a=a||d.appendChild(t.createElement("div")),s=(Xe.exec(o)||["",""])[1].toLowerCase(),l=Ve[s]||Ve._default,a.innerHTML=l[1]+he.htmlPrefilter(o)+l[2],c=l[0];c--;)a=a.lastChild;he.merge(f,a.childNodes),a=d.firstChild,a.textContent=""}else f.push(t.createTextNode(o));for(d.textContent="",p=0;o=f[p++];)if(r&&he.inArray(o,r)>-1)i&&i.push(o);else if(u=he.contains(o.ownerDocument,o),a=v(d.appendChild(o),"script"),u&&b(a),n)for(c=0;o=a[c++];)Ye.test(o.type||"")&&n.push(o);return d}function x(){return!0}function w(){return!1}function T(){try{return te.activeElement}catch(e){}}function C(e,t,n,r,i,o){var a,s;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(s in t)C(e,s,n,r,t[
return fe.test(e||"")||t.error("unsupported lang: "+e),e=e.replace(ye,xe).toLowerCase(),function(t){var n;do if(n=q?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===O},focus:function(e){return e===L.activeElement&&(!L.hasFocus||L.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:u(!1),disabled:u(!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!C.pseudos.empty(e)},header:function(e){return me.test(e.nodeName)},input:function(e){return he.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:c(function(){return[0]}),last:c(function(e,t){return[t-1]}),eq:c(function(e,t,n){return[n<0?n+t:n]}),even:c(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:c(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:c(function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e}),gt:c(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}},C.pseudos.nth=C.pseudos.eq;for(w in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})C.pseudos[w]=s(w);for(w in{submit:!0,reset:!0})C.pseudos[w]=l(w);return f.prototype=C.filters=C.pseudos,C.setFilters=new f,j=t.tokenize=function(e,n){var r,i,o,a,s,l,u,c=z[e+" "];if(c)return n?0:c.slice(0);for(s=e,l=[],u=C.preFilter;s;){r&&!(i=le.exec(s))||(i&&(s=s.slice(i[0].length)||s),l.push(o=[])),r=!1,(i=ue.exec(s))&&(r=i.shift(),o.push({value:r,type:i[0].replace(se," ")}),s=s.slice(r.length));for(a in C.filter)!(i=pe[a].exec(s))||u[a]&&!(i=u[a](i))||(r=i.shift(),o.push({value:r,type:a,matches:i}),s=s.slice(r.length));if(!r)break}return n?s.length:s?t.error(e):z(e,l).slice(0)},E=t.compile=function(e,t){var n,r=[],i=[],o=X[e+" "];if(!o){for(t||(t=j(e)),n=t.length;n--;)o=y(t[n]),o[M]?r.push(o):i.push(o);o=X(e,x(i,r)),o.selector=e}return o},D=t.select=function(e,t,n,r){var i,o,a,s,l,u="function"==typeof e&&e,c=!r&&j(e=u.selector||e);if(n=n||[],1===c.length){if(o=c[0]=c[0].slice(0),o.length>2&&"ID"===(a=o[0]).type&&9===t.nodeType&&q&&C.relative[o[1].type]){if(t=(C.find.ID(a.matches[0].replace(ye,xe),t)||[])[0],!t)return n;u&&(t=t.parentNode),e=e.slice(o.shift().value.length)}for(i=pe.needsContext.test(e)?0:o.length;i--&&(a=o[i],!C.relative[s=a.type]);)if((l=C.find[s])&&(r=l(a.matches[0].replace(ye,xe),be.test(o[0].type)&&d(t.parentNode)||t))){if(o.splice(i,1),e=r.length&&p(o),!e)return K.apply(n,r),n;break}}return(u||E(e,c))(r,t,!q,n,!t||be.test(e)&&d(t.parentNode)||t),n},T.sortStable=M.split("").sort(Y).join("")===M,T.detectDuplicates=!!N,A(),T.sortDetached=i(function(e){return 1&e.compareDocumentPosition(L.createElement("fieldset"))}),i(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||o("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),T.attributes&&i(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||o("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),i(function(e){return null==e.getAttribute("disabled")})||o(te,function(e,t,n){var r;if(!n)return e[t]===!0?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),t}(e);he.find=ye,he.expr=ye.selectors,he.expr[":"]=he.expr.pseudos,he.uniqueSort=he.unique=ye.uniqueSort,he.text=ye.getText,he.isXMLDoc=ye.isXML,he.contains=ye.contains,he.escapeSelector=ye.escape;var xe=function(e,t,n){for(var r=[],i=void 0!==n;(e=e[t])&&9!==e.
i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=t,t=e,e=void 0),t&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,i=null!=e&&e+"queueHooks",o=he.timers,a=qe.get(this);if(i)a[i]&&a[i].stop&&r(a[i]);else for(i in a)a[i]&&a[i].stop&&gt.test(i)&&r(a[i]);for(i=o.length;i--;)o[i].elem!==this||null!=e&&o[i].queue!==e||(o[i].anim.stop(n),t=!1,o.splice(i,1));!t&&n||he.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=qe.get(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=he.timers,a=r?r.length:0;for(n.finish=!0,he.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;t<a;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}}),he.each(["toggle","show","hide"],function(e,t){var n=he.fn[t];he.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(M(t,!0),e,r,i)}}),he.each({slideDown:M("show"),slideUp:M("hide"),slideToggle:M("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){he.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),he.timers=[],he.fx.tick=function(){var e,t=0,n=he.timers;for(pt=he.now();t<n.length;t++)e=n[t],e()||n[t]!==e||n.splice(t--,1);n.length||he.fx.stop(),pt=void 0},he.fx.timer=function(e){he.timers.push(e),e()?he.fx.start():he.timers.pop()},he.fx.interval=13,he.fx.start=function(){ht||(ht=e.requestAnimationFrame?e.requestAnimationFrame(F):e.setInterval(he.fx.tick,he.fx.interval))},he.fx.stop=function(){e.cancelAnimationFrame?e.cancelAnimationFrame(ht):e.clearInterval(ht),ht=null},he.fx.speeds={slow:600,fast:200,_default:400},he.fn.delay=function(t,n){return t=he.fx?he.fx.speeds[t]||t:t,n=n||"fx",this.queue(n,function(n,r){var i=e.setTimeout(n,t);r.stop=function(){e.clearTimeout(i)}})},function(){var e=te.createElement("input"),t=te.createElement("select"),n=t.appendChild(te.createElement("option"));e.type="checkbox",fe.checkOn=""!==e.value,fe.optSelected=n.selected,e=te.createElement("input"),e.value="t",e.type="radio",fe.radioValue="t"===e.value}();var vt,bt=he.expr.attrHandle;he.fn.extend({attr:function(e,t){return Le(this,he.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){he.removeAttr(this,e)})}}),he.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?he.prop(e,t,n):(1===o&&he.isXMLDoc(e)||(i=he.attrHooks[t.toLowerCase()]||(he.expr.match.bool.test(t)?vt:void 0)),void 0!==n?null===n?void he.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:(r=he.find.attr(e,t),null==r?void 0:r))},attrHooks:{type:{set:function(e,t){if(!fe.radioValue&&"radio"===t&&he.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match($e);if(i&&1===e.nodeType)for(;n=i[r++];)e.removeAttribute(n)}}),vt={set:function(e,t,n){return t===!1?he.removeAttr(e,n):e.setAttribute(n,n),n}},he.each(he.expr.match.bool.source.match(/\w+/g),function(e,t){var n=bt[t]||he.find.attr;bt[t]=function(e,t,r){var i,o,a=t.toLowerCase();return r||(o=bt[a],bt[a]=i,i=null!=n(e,t,r)?a:null,bt[a]=o),i}});var yt=/^(?:input|select|textarea|button)$/i,xt=/^(?:a|area)$/i;he.fn.extend({prop:function(e,t){return Le(this,he.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[he.propFix[e]||e]})}}),he.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&he.isXMLDoc(e)||(t=he.propFix[t]||t,i=he.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=he.find.attr(e,"tabindex");return t?parseInt(t,10):yt.test(e.nodeName)||xt.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),fe.optSelected||
build={},build.iconic=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n="";return n+=lychee.html(_templateObject,t,e)},build.divider=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n="";return n+=lychee.html(_templateObject2,t,e)},build.editIcon=function(e){var t="";return t+=lychee.html(_templateObject3,e,build.iconic("pencil"))},build.multiselect=function(e,t){return lychee.html(_templateObject4,e,t)},build.album=function(e){var t="",n=lychee.retinize(e.thumbs[0]),r=n.path,i=n.isPhoto;return t+=lychee.html(_templateObject5,e.id,e.thumbs[2],e.thumbs[1],e.thumbs[0],r,i,e.title,e.title,e.sysdate),lychee.publicMode===!1&&(t+=lychee.html(_templateObject6,"1"===e.star?"badge--visible":"",build.iconic("star"),"1"===e.public?"badge--visible":"",build.iconic("eye"),"1"===e.unsorted?"badge--visible":"",build.iconic("list"),"1"===e.recent?"badge--visible":"",build.iconic("clock"),"1"===e.password?"badge--visible":"",build.iconic("lock-locked"))),t+="</div>"},build.photo=function(e){var t="",n=lychee.retinize(e.thumbUrl),r=n.path;return t+=lychee.html(_templateObject7,e.album,e.id,e.thumbUrl,r,e.title,e.title),t+="1"===e.cameraDate?lychee.html(_templateObject8,build.iconic("camera-slr"),e.sysdate):lychee.html(_templateObject9,e.sysdate),t+="</div>",lychee.publicMode===!1&&(t+=lychee.html(_templateObject10,"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="",r=""!==e.medium;return n+=r===!1?lychee.html(_templateObject11,t===!0?"":"full",e.url):lychee.html(_templateObject12,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(_templateObject13,e);for(var r=0;r<t.length;){var i=t[r];i.name.length>40&&(i.name=i.name.substr(0,17)+"..."+i.name.substr(i.name.length-20,20)),n+=lychee.html(_templateObject14,i.name),r++}return n+="</div>"},build.tags=function(e){var t="";return""!==e?(e=e.split(","),e.forEach(function(e,n,r){t+=lychee.html(_templateObject15,e,n,build.iconic("x"))})):t="<div class='empty'>No Tags</div>",t},api={path:"php/index.php",onError:null},api.post=function(e,t,n){loadingBar.show(),t=$.extend({function:e},t);var r=function(e){return setTimeout(loadingBar.hide,100),"string"==typeof e&&"Error: "===e.substring(0,7)?(api.onError(e.substring(7,e.length),t,e),!1):void n(e)},i=function(e,n,r){api.onError("Server error or API not found.",t,r)};$.ajax({type:"POST",url:api.path,data:t,dataType:"json",success:r,error:i})},header={_dom:$(".header")},header.dom=function(e){return null==e||""===e?header._dom:header._dom.find(e)},header.bind=function(){var e=lychee.getEventName();return header.dom(".header__title").on(e,function(e){return $(this).hasClass("header__title--editable")!==!1&&void(visible.photo()?contextMenu.photoTitle(album.getID(),photo.getID(),e):contextMenu.albumTitle(album.getID(),e))}),header.dom("#button_share").on(e,function(e){"1"===photo.json.public||"2"===photo.json.public?contextMenu.sharePhoto(photo.getID(),e):photo.setPublic(photo.getID(),e)}),header.dom("#button_share_album").on(e,function(e){"1"===album.json.public?contextMenu.shareAlbum(album.getID(),e):album.setPublic(album.getID(),!0,e)}),header.dom("#button_signin").on(e,lychee.loginDialog),header.dom("#button_settings").on(e,contextMenu.settings),header.dom("#button_info_album").on(e,sidebar.toggle),header.dom("#button_