lychee/dist/view.js

4 lines
109 KiB
JavaScript
Raw Normal View History

2016-06-25 10:30:24 +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||Z;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=fe.type(e);return"function"!==n&&!fe.isWindow(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}function i(e,t,n){if(fe.isFunction(t))return fe.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return fe.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(Te.test(t))return fe.filter(t,e,n);t=fe.filter(t,e)}return fe.grep(e,function(e){return ie.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 fe.each(e.match(De)||[],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&&fe.isFunction(r=e.promise)?r.call(e).done(t).fail(n):e&&fe.isFunction(r=e.then)?r.call(e,t,n):t.call(void 0,e)}catch(e){n.call(void 0,e)}}function c(){Z.removeEventListener("DOMContentLoaded",c),e.removeEventListener("load",c),fe.ready()}function d(){this.expando=fe.expando+d.uid++}function f(e,t,n){var r;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(Pe,"-$&").toLowerCase(),n=e.getAttribute(r),"string"==typeof n){try{n="true"===n||"false"!==n&&("null"===n?null:+n+""===n?+n:qe.test(n)?JSON.parse(n):n)}catch(i){}Oe.set(e,t,n)}else n=void 0;return n}function p(e,t,n,r){var i,o=1,a=20,s=r?function(){return r.cur()}:function(){return fe.css(e,t,"")},l=s(),u=n&&n[3]||(fe.cssNumber[t]?"":"px"),c=(fe.cssNumber[t]||"px"!==u&&+l)&&Fe.exec(fe.css(e,t));if(c&&c[3]!==u){u=u||c[3],n=n||[],c=+l||1;do o=o||".5",c/=o,fe.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 h(e){var t,n=e.ownerDocument,r=e.nodeName,i=We[r];return i?i:(t=n.body.appendChild(n.createElement(r)),i=fe.css(t,"display"),t.parentNode.removeChild(t),"none"===i&&(i="block"),We[r]=i,i)}function m(e,t){for(var n,r,i=[],o=0,a=e.length;a>o;o++)r=e[o],r.style&&(n=r.style.display,t?("none"===n&&(i[o]=Le.get(r,"display")||null,i[o]||(r.style.display="")),""===r.style.display&&Me(r)&&(i[o]=h(r))):"none"!==n&&(i[o]="none",Le.set(r,"display",n)));for(o=0;a>o;o++)null!=i[o]&&(e[o].style.display=i[o]);return e}function g(e,t){var n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[];return void 0===t||t&&fe.nodeName(e,t)?fe.merge([e],n):n}function v(e,t){for(var n=0,r=e.length;r>n;n++)Le.set(e[n],"globalEval",!t||Le.get(t[n],"globalEval"))}function b(e,t,n,r,i){for(var o,a,s,l,u,c,d=t.createDocumentFragment(),f=[],p=0,h=e.length;h>p;p++)if(o=e[p],o||0===o)if("object"===fe.type(o))fe.merge(f,o.nodeType?[o]:o);else if(Ye.test(o)){for(a=a||d.appendChild(t.createElement("div")),s=(Ue.exec(o)||["",""])[1].toLowerCase(),l=Xe[s]||Xe._default,a.innerHTML=l[1]+fe.htmlPrefilter(o)+l[2],c=l[0];c--;)a=a.lastChild;fe.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&&fe.inArray(o,r)>-1)i&&i.push(o);else if(u=fe.contains(o.ownerDocument,o),a=g(d.appendChild(o),"script"),u&&v(a),n)for(c=0;o=a[c++];)ze.test(o.type||"")&&n.push(o);return d}function y(){return!0}function x(){return!1}function w(){try{return Z.activeElement}catch(e){}}function T(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)T(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void
},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[0>n?n+t:n]}),even:c(function(e,t){for(var n=0;t>n;n+=2)e.push(n);return e}),odd:c(function(e,t){for(var n=1;t>n;n+=2)e.push(n);return e}),lt:c(function(e,t,n){for(var r=0>n?n+t:n;--r>=0;)e.push(r);return e}),gt:c(function(e,t,n){for(var r=0>n?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&&T.getById&&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){return n?void 0: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){return n||"input"!==e.nodeName.toLowerCase()?void 0:e.defaultValue}),i(function(e){return null==e.getAttribute("disabled")})||o(te,function(e,t,n){var r;return n?void 0:e[t]===!0?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),t}(e);fe.find=ve,fe.expr=ve.selectors,fe.expr[":"]=fe.expr.pseudos,fe.uniqueSort=fe.unique=ve.uniqueSort,fe.text=ve.getText,fe.isXMLDoc=ve.isXML,fe.contains=ve.contains,fe.escapeSelector=ve.escape;var be=function(e,t,n){for(var r=[],i=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(i&&fe(e).is(n))break;r.push(e)}return r},ye=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},xe=fe.expr.match.needsContext,we=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,Te=/^.[^:#\[\.,]*$/;fe.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?fe.find.matchesSelector(r,e)?[r]:[]:fe.find.matches(e,fe.grep(t,function(e){return 1===e.nodeType}))}
var t,n=Le.get(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=fe.timers,a=r?r.length:0;for(n.finish=!0,fe.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;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}}),fe.each(["toggle","show","hide"],function(e,t){var n=fe.fn[t];fe.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(I(t,!0),e,r,i)}}),fe.each({slideDown:I("show"),slideUp:I("hide"),slideToggle:I("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){fe.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),fe.timers=[],fe.fx.tick=function(){var e,t=0,n=fe.timers;for(dt=fe.now();t<n.length;t++)e=n[t],e()||n[t]!==e||n.splice(t--,1);n.length||fe.fx.stop(),dt=void 0},fe.fx.timer=function(e){fe.timers.push(e),e()?fe.fx.start():fe.timers.pop()},fe.fx.interval=13,fe.fx.start=function(){ft||(ft=e.requestAnimationFrame?e.requestAnimationFrame(H):e.setInterval(fe.fx.tick,fe.fx.interval))},fe.fx.stop=function(){e.cancelAnimationFrame?e.cancelAnimationFrame(ft):e.clearInterval(ft),ft=null},fe.fx.speeds={slow:600,fast:200,_default:400},fe.fn.delay=function(t,n){return t=fe.fx?fe.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=Z.createElement("input"),t=Z.createElement("select"),n=t.appendChild(Z.createElement("option"));e.type="checkbox",ce.checkOn=""!==e.value,ce.optSelected=n.selected,e=Z.createElement("input"),e.value="t",e.type="radio",ce.radioValue="t"===e.value}();var mt,gt=fe.expr.attrHandle;fe.fn.extend({attr:function(e,t){return Ne(this,fe.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){fe.removeAttr(this,e)})}}),fe.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?fe.prop(e,t,n):(1===o&&fe.isXMLDoc(e)||(i=fe.attrHooks[t.toLowerCase()]||(fe.expr.match.bool.test(t)?mt:void 0)),void 0!==n?null===n?void fe.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=fe.find.attr(e,t),null==r?void 0:r))},attrHooks:{type:{set:function(e,t){if(!ce.radioValue&&"radio"===t&&fe.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(De);if(i&&1===e.nodeType)for(;n=i[r++];)e.removeAttribute(n)}}),mt={set:function(e,t,n){return t===!1?fe.removeAttr(e,n):e.setAttribute(n,n),n}},fe.each(fe.expr.match.bool.source.match(/\w+/g),function(e,t){var n=gt[t]||fe.find.attr;gt[t]=function(e,t,r){var i,o,a=t.toLowerCase();return r||(o=gt[a],gt[a]=i,i=null!=n(e,t,r)?a:null,gt[a]=o),i}});var vt=/^(?:input|select|textarea|button)$/i,bt=/^(?:a|area)$/i;fe.fn.extend({prop:function(e,t){return Ne(this,fe.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[fe.propFix[e]||e]})}}),fe.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&fe.isXMLDoc(e)||(t=fe.propFix[t]||t,i=fe.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=fe.find.attr(e,"tabindex");return t?parseInt(t,10):vt.test(e.nodeName)||bt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),ce.optSelected||(fe.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)}}),fe.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){fe.propFix[this.toLowerCase()]=this});var yt=/[\t\r\n\f]/g;fe.fn.extend({addClass:function(e){var t,n,r,i,o,a,s,l=0;if(fe.isFunction(e))return this.each(function(t){fe(this).addClass(e.call(this,t,U(this)))}
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="";return t+=lychee.html(_templateObject2,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_info").on(e,sidebar.toggle),header.dom(".