fipamo/public/assets/scripts/dash.min.js

11 lines
84 KiB
JavaScript
Raw Normal View History

!function(){"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function n(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}function r(e){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function i(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=r(e);if(t){var i=r(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return a(this,n)}}var l="getAuthStatus",u="requestLame",s="apiUseAuthorized",c="apiUseNotAuthorized",d="postImageAdded",f="postError",h="postUpdated",p="avatarUploaded",g="writingItDown",m="erasingPage",v="savingSettings",y="createBackup",b="downloadBackup",w="uploadProfileImages",E="renderPages",I="reindexPages",k="blogInit",S="blogInitLame",T="sendMail",x=(new function t(){e(this,t)},"POST"),D="GET",P="json",_="x-www-form-urlencoded",B=function(){function t(){e(this,t)}return n(t,[{key:"login",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/login",l,x,P,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"init",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/init",k,x,P,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"handleInitRestore",value:function(e){var t=this;return new Promise((function(n,r){var o;o=new FormData(e),t._request("/api/v1/restore","downloadBackup","POST","x-www-form-urlencoded",o).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"getPages",value:function(e){var t=this,n=e;return null!==n&&""!==n&&n||(n=1),new Promise((function(e,r){t._request("/api/v1/page/published/"+n,void 0,D).then((function(t){e(t)})).catch((function(e){r(e)}))}))}},{key:"getPage",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/page/single/"+e,void 0,D).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"_request",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:D,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:P,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=this;return new Promise((function(t,i){var l=new XMLHttpRequest;if(l.upload.onprogress=a.handleLoadProgress,l.open(n,e,!0),l.onload=function(){if(200==l.status){var e=JSON.parse(l.response);t(e)}else{var n=JSON.parse(l.response);i(n)}},"PUT"==n||n==x)switch(r){case P:l.setRequestHeader("Content-type","application/"+r),l.send(JSON.stringify(o));break;case _:l.send(o)}else l.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),O="POST",C="createNewPage",A="editPage",M="deletePage",N="json",L="x-www-form-urlencoded",R=function(){function t(){var n=this;e(this,t),this.percentComplete=0,this.token=null,this._request("/api/v1/status").then((function(e){e.type===s&&(n.token=e.token)}))}return n(t,[{key:"syncSettings",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/settings/sync",v,O,N,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"imageUpload",value:function(e,t){var n=this;return new Promise((function(r,o){var a="";switch(e){case"avatar-upload":a="/api/v1/settings/add-avatar";break;case"background-upload":a="/api/v1/settings/add-feature-background";break;default:a="/api/v1/page/add-entry-image"}for(var i=
u.reversePlayback=v<u.currentTime,t&&function(e){if(u.reversePlayback)for(var n=a;n--;)f(e,t[n]);else for(var r=0;r<a;r++)f(e,t[r])}(v),!u.began&&u.currentTime>0&&(u.began=!0,p("begin")),!u.loopBegan&&u.currentTime>0&&(u.loopBegan=!0,p("loopBegin")),v<=g&&0!==u.currentTime&&h(0),(v>=m&&u.currentTime!==d||!d)&&h(d),v>g&&v<m?(u.changeBegan||(u.changeBegan=!0,u.changeCompleted=!1,p("changeBegin")),p("change"),h(v)):u.changeBegan&&(u.changeCompleted=!0,u.changeBegan=!1,p("changeComplete")),u.currentTime=oe(v,0,d),u.began&&p("update"),e>=d&&(r=0,u.remaining&&!0!==u.remaining&&u.remaining--,u.remaining?(n=o,p("loopComplete"),u.loopBegan=!1,"alternate"===u.direction&&s()):(u.paused=!0,u.completed||(u.completed=!0,p("loopComplete"),p("complete"),!u.passThrough&&"Promise"in window&&(i(),l(u)))))}return l(u),u.reset=function(){var e=u.direction;u.passThrough=!1,u.currentTime=0,u.progress=0,u.paused=!0,u.began=!1,u.loopBegan=!1,u.changeBegan=!1,u.completed=!1,u.changeCompleted=!1,u.reversePlayback=!1,u.reversed="reverse"===e,u.remaining=u.loop,t=u.children;for(var n=a=t.length;n--;)u.children[n].reset();(u.reversed&&!0!==u.loop||"alternate"===e&&1===u.loop)&&u.remaining++,h(u.reversed?u.duration:0)},u._onDocumentVisibility=d,u.set=function(e,t){return Qe(e,t),u},u.tick=function(e){o=e,n||(n=o),g((o+(r-n))*tt.speed)},u.seek=function(e){g(c(e))},u.pause=function(){u.paused=!0,d()},u.play=function(){u.paused&&(u.completed&&u.reset(),u.paused=!1,Ze.push(u),d(),Ke())},u.reverse=function(){s(),u.completed=!u.reversed,d()},u.restart=function(){u.reset(),u.play()},u.remove=function(e){rt(Ue(e),u)},u.reset(),u.autoplay&&u.play(),u}function nt(e,t){for(var n=t.length;n--;)we(e,t[n].animatable.target)&&t.splice(n,1)}function rt(e,t){var n=t.animations,r=t.children;nt(e,n);for(var o=r.length;o--;){var a=r[o],i=a.animations;nt(e,i),i.length||a.children.length||r.splice(o,1)}n.length||r.length||t.pause()}tt.version="3.2.1",tt.speed=1,tt.suspendWhenDocumentHidden=!0,tt.running=Ze,tt.remove=function(e){for(var t=Ue(e),n=Ze.length;n--;){rt(t,Ze[n])}},tt.get=Ae,tt.set=Qe,tt.convertPx=Pe,tt.path=function(e,t){var n=le.str(e)?me(e)[0]:e,r=t||100;return function(e){return{property:e,el:n,svg:Fe(n),totalLength:He(n)*(r/100)}}},tt.setDashoffset=function(e){var t=He(e);return e.setAttribute("stroke-dasharray",t),t},tt.stagger=function(e,t){void 0===t&&(t={});var n=t.direction||"normal",r=t.easing?ge(t.easing):null,o=t.grid,a=t.axis,i=t.from||0,l="first"===i,u="center"===i,s="last"===i,c=le.arr(e),d=c?parseFloat(e[0]):parseFloat(e),f=c?parseFloat(e[1]):0,h=Te(c?e[1]:e)||0,p=t.start||0+(c?d:0),g=[],m=0;return function(e,t,v){if(l&&(i=0),u&&(i=(v-1)/2),s&&(i=v-1),!g.length){for(var y=0;y<v;y++){if(o){var b=u?(o[0]-1)/2:i%o[0],w=u?(o[1]-1)/2:Math.floor(i/o[0]),E=b-y%o[0],I=w-Math.floor(y/o[0]),k=Math.sqrt(E*E+I*I);"x"===a&&(k=-E),"y"===a&&(k=-I),g.push(k)}else g.push(Math.abs(i-y));m=Math.max.apply(Math,g)}r&&(g=g.map((function(e){return r(e/m)*m}))),"reverse"===n&&(g=g.map((function(e){return a?e<0?-1*e:-e:Math.abs(m-e)})))}return p+(c?(f-d)/m:d)*(Math.round(100*g[t])/100)+h}},tt.timeline=function(e){void 0===e&&(e={});var t=tt(e);return t.duration=0,t.add=function(n,r){var o=Ze.indexOf(t),a=t.children;function i(e){e.passThrough=!0}o>-1&&Ze.splice(o,1);for(var l=0;l<a.length;l++)i(a[l]);var u=ke(n,Ie(te,e));u.targets=u.targets||e.targets;var s=t.duration;u.autoplay=!1,u.direction=t.direction,u.timelineOffset=le.und(r)?s:Me(r,s),i(t),t.seek(u.timelineOffset);var c=tt(u);i(c),a.push(c);var d=Je(a,e);return t.delay=d.delay,t.endDelay=d.endDelay,t.duration=d.duration,t.seek(0),t.reset(),t.autoplay&&t.play(),t},t},tt.easing=ge,tt.penner=pe,tt.random=function(e,t){return Math.floor(Math.random()*(t-e+1))+e};var ot=document.getElementById("notifications"),at=document.getElementById("notifyMessage"),it=document.getElementById("message-text"),lt=document.getElementById("notify-good"),ut=document.getElementById("notify-lame"),st=document.getElementById("notify-working"),ct=function(){function t(){e(this,t)}return n(t,[{key:"alert",value:function(e,t){st.style.displa
/**!
* Sortable 1.13.0
* @author RubaXa <trash@rubaxa.org>
* @author owenm <owen23355@gmail.com>
* @license MIT
*/
function yt(e){return(yt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function bt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function wt(){return(wt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function Et(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){bt(e,t,n[t])}))}return e}function It(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function kt(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var St=kt(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Tt=kt(/Edge/i),xt=kt(/firefox/i),Dt=kt(/safari/i)&&!kt(/chrome/i)&&!kt(/android/i),Pt=kt(/iP(ad|od|hone)/i),_t=kt(/chrome/i)&&kt(/android/i),Bt={capture:!1,passive:!1};function Ot(e,t,n){e.addEventListener(t,n,!St&&Bt)}function Ct(e,t,n){e.removeEventListener(t,n,!St&&Bt)}function At(e,t){if(t){if(">"===t[0]&&(t=t.substring(1)),e)try{if(e.matches)return e.matches(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t)}catch(e){return!1}return!1}}function Mt(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function Nt(e,t,n,r){if(e){n=n||document;do{if(null!=t&&(">"===t[0]?e.parentNode===n&&At(e,t):At(e,t))||r&&e===n)return e;if(e===n)break}while(e=Mt(e))}return null}var Lt,Rt=/\s+/g;function Ht(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var r=(" "+e.className+" ").replace(Rt," ").replace(" "+t+" "," ");e.className=(r+(n?" "+t:"")).replace(Rt," ")}}function Ft(e,t,n){var r=e&&e.style;if(r){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(n=e.currentStyle),void 0===t?n:n[t];t in r||-1!==t.indexOf("webkit")||(t="-webkit-"+t),r[t]=n+("string"==typeof n?"":"px")}}function Xt(e,t){var n="";if("string"==typeof e)n=e;else do{var r=Ft(e,"transform");r&&"none"!==r&&(n=r+" "+n)}while(!t&&(e=e.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(n)}function qt(e,t,n){if(e){var r=e.getElementsByTagName(t),o=0,a=r.length;if(n)for(;o<a;o++)n(r[o],o);return r}return[]}function Ut(){var e=document.scrollingElement;return e||document.documentElement}function Yt(e,t,n,r,o){if(e.getBoundingClientRect||e===window){var a,i,l,u,s,c,d;if(e!==window&&e.parentNode&&e!==Ut()?(i=(a=e.getBoundingClientRect()).top,l=a.left,u=a.bottom,s=a.right,c=a.height,d=a.width):(i=0,l=0,u=window.innerHeight,s=window.innerWidth,c=window.innerHeight,d=window.innerWidth),(t||n)&&e!==window&&(o=o||e.parentNode,!St))do{if(o&&o.getBoundingClientRect&&("none"!==Ft(o,"transform")||n&&"static"!==Ft(o,"position"))){var f=o.getBoundingClientRect();i-=f.top+parseInt(Ft(o,"border-top-width")),l-=f.left+parseInt(Ft(o,"border-left-width")),u=i+a.height,s=l+a.width;break}}while(o=o.parentNode);if(r&&e!==window){var h=Xt(o||e),p=h&&h.a,g=h&&h.d;h&&(u=(i/=g)+(c/=g),s=(l/=p)+(d/=p))}return{top:i,left:l,bottom:u,right:s,width:d,height:c}}}function jt(e,t,n){for(var r=Vt(e,!0),o=Yt(e)[t];r;){var a=Yt(r)[n];if(!("top"===n||"left"===n?o>=a:o<=a))return r;if(r===Ut())break;r=Vt(r,!1)}return!1}function Wt(e,t,n){for(var r=0,o=0
;var P=E&&(Math.abs(y-a)<=l&&x+b<k)-(Math.abs(v-a)<=l&&!!x),_=I&&(Math.abs(m-i)<=l&&D+w<S)-(Math.abs(g-i)<=l&&!!D);if(!dr[d])for(var B=0;B<=d;B++)dr[B]||(dr[B]={});dr[d].vx==P&&dr[d].vy==_&&dr[d].el===h||(dr[d].el=h,dr[d].vx=P,dr[d].vy=_,clearInterval(dr[d].pid),0==P&&0==_||(c=!0,dr[d].pid=setInterval(function(){r&&0===this.layer&&Zn.active._onTouchMove(sr);var t=dr[this.layer].vy?dr[this.layer].vy*u:0,n=dr[this.layer].vx?dr[this.layer].vx*u:0;"function"==typeof o&&"continue"!==o.call(Zn.dragged.parentNode[en],n,t,e,sr,dr[this.layer].el)||Zt(dr[this.layer].el,n,t)}.bind({layer:d}),24))),d++}while(t.bubbleScroll&&f!==s&&(f=Vt(f,!1)));fr=c}}),30),mr=function(e){var t=e.originalEvent,n=e.putSortable,r=e.dragEl,o=e.activeSortable,a=e.dispatchSortableEvent,i=e.hideGhostForTarget,l=e.unhideGhostForTarget;if(t){var u=n||o;i();var s=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t,c=document.elementFromPoint(s.clientX,s.clientY);l(),u&&!u.el.contains(c)&&(a("spill"),this.onSpill({dragEl:r,putSortable:n}))}};function vr(){}function yr(){}vr.prototype={startIndex:null,dragStart:function(e){var t=e.oldDraggableIndex;this.startIndex=t},onSpill:function(e){var t=e.dragEl,n=e.putSortable;this.sortable.captureAnimationState(),n&&n.captureAnimationState();var r=Wt(this.sortable.el,this.startIndex,this.options);r?this.sortable.el.insertBefore(t,r):this.sortable.el.appendChild(t),this.sortable.animateAll(),n&&n.animateAll()},drop:mr},wt(vr,{pluginName:"revertOnSpill"}),yr.prototype={onSpill:function(e){var t=e.dragEl,n=e.putSortable||this.sortable;n.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),n.animateAll()},drop:mr},wt(yr,{pluginName:"removeOnSpill"}),Zn.mount(new function(){function e(){for(var e in this.defaults={scroll:!0,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0},this)"_"===e.charAt(0)&&"function"==typeof this[e]&&(this[e]=this[e].bind(this))}return e.prototype={dragStarted:function(e){var t=e.originalEvent;this.sortable.nativeDraggable?Ot(document,"dragover",this._handleAutoScroll):this.options.supportPointer?Ot(document,"pointermove",this._handleFallbackAutoScroll):t.touches?Ot(document,"touchmove",this._handleFallbackAutoScroll):Ot(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){var t=e.originalEvent;this.options.dragOverBubble||t.rootEl||this._handleAutoScroll(t)},drop:function(){this.sortable.nativeDraggable?Ct(document,"dragover",this._handleAutoScroll):(Ct(document,"pointermove",this._handleFallbackAutoScroll),Ct(document,"touchmove",this._handleFallbackAutoScroll),Ct(document,"mousemove",this._handleFallbackAutoScroll)),pr(),hr(),clearTimeout(Lt),Lt=void 0},nulling:function(){sr=ir=ar=fr=cr=lr=ur=null,dr.length=0},_handleFallbackAutoScroll:function(e){this._handleAutoScroll(e,!0)},_handleAutoScroll:function(e,t){var n=this,r=(e.touches?e.touches[0]:e).clientX,o=(e.touches?e.touches[0]:e).clientY,a=document.elementFromPoint(r,o);if(sr=e,t||Tt||St||Dt){gr(e,this.options,a,t);var i=Vt(a,!0);!fr||cr&&r===lr&&o===ur||(cr&&pr(),cr=setInterval((function(){var a=Vt(document.elementFromPoint(r,o),!0);a!==i&&(i=a,hr()),gr(e,n.options,a,t)}),10),lr=r,ur=o)}else{if(!this.options.bubbleScroll||Vt(a,!0)===Ut())return void hr();gr(e,this.options,Vt(a,!1),!1)}}},wt(e,{pluginName:"scroll",initializeByDefault:!0})}),Zn.mount(yr,vr);var br=new ct,wr=function(){function t(){e(this,t),this.admin=new R,this.start()}return n(t,[{key:"start",value:function(){var e=this,t=this;Zn.create(document.getElementById("nav-pages"),{onUpdate:function(){(new vt).syncMenu().then((function(e){br.alert("Updating Menu",null),t.admin.syncNav(e).then((function(e){e.type,br.alert(e.message,!0)}))}))}});for(var n=document.querySelectorAll(".nav-btn"),r=0,o=n.length;r<o;r++)n[r].addEventListener("click",(function(t){return e.handleNavButton(t)}),!1)}},{key:"handleNavButton",value:function(e){var t="",n=this;switch(e.target.id){case"remove-item":t=e.target.getAttribute("data-id"),(new vt).removeItem(t),(new vt).syncMenu().then((function(t){t.remove=e.target.getAttribute("data-uuid"),br.a
//# sourceMappingURL=dash.min.js.map