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

11 lines
86 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 i(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 a(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 a=r(this).constructor;n=Reflect.construct(o,arguments,a)}else n=o.apply(this,arguments);return i(this,n)}}var l="getAuthStatus",s="requestLame",u="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",_="json",P="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,_,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,_,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]:_,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=this;return new Promise((function(t,a){var l=new XMLHttpRequest;if(l.upload.onprogress=i.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);a(n)}},"PUT"==n||n==x)switch(r){case _:l.setRequestHeader("Content-type","application/"+r),l.send(JSON.stringify(o));break;case P: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",M="editPage",A="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===u&&(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 i="";switch(e){case"avatar-upload":i="/api/v1/settings/add-avatar";break;case"background-upload":i="/api/v1/settings/add-feature-background";break;default:i="/api/v1/page/add-entry-image"}for(var a=
s.reversePlayback=v<s.currentTime,t&&function(e){if(s.reversePlayback)for(var n=i;n--;)f(e,t[n]);else for(var r=0;r<i;r++)f(e,t[r])}(v),!s.began&&s.currentTime>0&&(s.began=!0,p("begin")),!s.loopBegan&&s.currentTime>0&&(s.loopBegan=!0,p("loopBegin")),v<=g&&0!==s.currentTime&&h(0),(v>=m&&s.currentTime!==d||!d)&&h(d),v>g&&v<m?(s.changeBegan||(s.changeBegan=!0,s.changeCompleted=!1,p("changeBegin")),p("change"),h(v)):s.changeBegan&&(s.changeCompleted=!0,s.changeBegan=!1,p("changeComplete")),s.currentTime=oe(v,0,d),s.began&&p("update"),e>=d&&(r=0,s.remaining&&!0!==s.remaining&&s.remaining--,s.remaining?(n=o,p("loopComplete"),s.loopBegan=!1,"alternate"===s.direction&&u()):(s.paused=!0,s.completed||(s.completed=!0,p("loopComplete"),p("complete"),!s.passThrough&&"Promise"in window&&(a(),l(s)))))}return l(s),s.reset=function(){var e=s.direction;s.passThrough=!1,s.currentTime=0,s.progress=0,s.paused=!0,s.began=!1,s.loopBegan=!1,s.changeBegan=!1,s.completed=!1,s.changeCompleted=!1,s.reversePlayback=!1,s.reversed="reverse"===e,s.remaining=s.loop,t=s.children;for(var n=i=t.length;n--;)s.children[n].reset();(s.reversed&&!0!==s.loop||"alternate"===e&&1===s.loop)&&s.remaining++,h(s.reversed?s.duration:0)},s._onDocumentVisibility=d,s.set=function(e,t){return Qe(e,t),s},s.tick=function(e){o=e,n||(n=o),g((o+(r-n))*tt.speed)},s.seek=function(e){g(c(e))},s.pause=function(){s.paused=!0,d()},s.play=function(){s.paused&&(s.completed&&s.reset(),s.paused=!1,Ze.push(s),d(),Ke())},s.reverse=function(){u(),s.completed=!s.reversed,d()},s.restart=function(){s.reset(),s.play()},s.remove=function(e){rt(Ue(e),s)},s.reset(),s.autoplay&&s.play(),s}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 i=r[o],a=i.animations;nt(e,a),a.length||i.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=Me,tt.set=Qe,tt.convertPx=_e,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,i=t.axis,a=t.from||0,l="first"===a,s="center"===a,u="last"===a,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&&(a=0),s&&(a=(v-1)/2),u&&(a=v-1),!g.length){for(var y=0;y<v;y++){if(o){var b=s?(o[0]-1)/2:a%o[0],w=s?(o[1]-1)/2:Math.floor(a/o[0]),E=b-y%o[0],I=w-Math.floor(y/o[0]),k=Math.sqrt(E*E+I*I);"x"===i&&(k=-E),"y"===i&&(k=-I),g.push(k)}else g.push(Math.abs(a-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 i?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),i=t.children;function a(e){e.passThrough=!0}o>-1&&Ze.splice(o,1);for(var l=0;l<i.length;l++)a(i[l]);var s=ke(n,Ie(te,e));s.targets=s.targets||e.targets;var u=t.duration;s.autoplay=!1,s.direction=t.direction,s.timelineOffset=le.und(r)?u:Ae(r,u),a(t),t.seek(s.timelineOffset);var c=tt(s);a(c),i.push(c);var d=Je(i,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"),it=document.getElementById("notifyMessage"),at=document.getElementById("message-text"),lt=document.getElementById("notify-good"),st=document.getElementById("notify-lame"),ut=document.getElementById("notify-working"),ct=function(){function t(){e(this,t)}return n(t,[{key:"alert",value:function(e,t){ut.style.displa
/**!
* Sortable 1.13.0
* @author RubaXa <trash@rubaxa.org>
* @author owenm <owen23355@gmail.com>
* @license MIT
*/
function wt(e){return(wt="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 Et(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function It(){return(It=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 kt(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){Et(e,t,n[t])}))}return e}function St(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function Tt(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var xt=Tt(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Dt=Tt(/Edge/i),_t=Tt(/firefox/i),Pt=Tt(/safari/i)&&!Tt(/chrome/i)&&!Tt(/android/i),Bt=Tt(/iP(ad|od|hone)/i),Ot=Tt(/chrome/i)&&Tt(/android/i),Ct={capture:!1,passive:!1};function Mt(e,t,n){e.addEventListener(t,n,!xt&&Ct)}function At(e,t,n){e.removeEventListener(t,n,!xt&&Ct)}function Nt(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 Lt(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function Rt(e,t,n,r){if(e){n=n||document;do{if(null!=t&&(">"===t[0]?e.parentNode===n&&Nt(e,t):Nt(e,t))||r&&e===n)return e;if(e===n)break}while(e=Lt(e))}return null}var Ht,Ft=/\s+/g;function Xt(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var r=(" "+e.className+" ").replace(Ft," ").replace(" "+t+" "," ");e.className=(r+(n?" "+t:"")).replace(Ft," ")}}function qt(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 Ut(e,t){var n="";if("string"==typeof e)n=e;else do{var r=qt(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 Yt(e,t,n){if(e){var r=e.getElementsByTagName(t),o=0,i=r.length;if(n)for(;o<i;o++)n(r[o],o);return r}return[]}function jt(){var e=document.scrollingElement;return e||document.documentElement}function Wt(e,t,n,r,o){if(e.getBoundingClientRect||e===window){var i,a,l,s,u,c,d;if(e!==window&&e.parentNode&&e!==jt()?(a=(i=e.getBoundingClientRect()).top,l=i.left,s=i.bottom,u=i.right,c=i.height,d=i.width):(a=0,l=0,s=window.innerHeight,u=window.innerWidth,c=window.innerHeight,d=window.innerWidth),(t||n)&&e!==window&&(o=o||e.parentNode,!xt))do{if(o&&o.getBoundingClientRect&&("none"!==qt(o,"transform")||n&&"static"!==qt(o,"position"))){var f=o.getBoundingClientRect();a-=f.top+parseInt(qt(o,"border-top-width")),l-=f.left+parseInt(qt(o,"border-left-width")),s=a+i.height,u=l+i.width;break}}while(o=o.parentNode);if(r&&e!==window){var h=Ut(o||e),p=h&&h.a,g=h&&h.d;h&&(s=(a/=g)+(c/=g),u=(l/=p)+(d/=p))}return{top:a,left:l,bottom:s,right:u,width:d,height:c}}}function zt(e,t,n){for(var r=$t(e,!0),o=Wt(e)[t];r;){var i=Wt(r)[n];if(!("top"===n||"left"===n?o>=i:o<=i))return r;if(r===jt())break;r=$t(r,!1)}return!1}function Gt(e,t,n){for(var r=0,o=0
;var _=E&&(Math.abs(y-i)<=l&&x+b<k)-(Math.abs(v-i)<=l&&!!x),P=I&&(Math.abs(m-a)<=l&&D+w<S)-(Math.abs(g-a)<=l&&!!D);if(!hr[d])for(var B=0;B<=d;B++)hr[B]||(hr[B]={});hr[d].vx==_&&hr[d].vy==P&&hr[d].el===h||(hr[d].el=h,hr[d].vx=_,hr[d].vy=P,clearInterval(hr[d].pid),0==_&&0==P||(c=!0,hr[d].pid=setInterval(function(){r&&0===this.layer&&er.active._onTouchMove(dr);var t=hr[this.layer].vy?hr[this.layer].vy*s:0,n=hr[this.layer].vx?hr[this.layer].vx*s:0;"function"==typeof o&&"continue"!==o.call(er.dragged.parentNode[nn],n,t,e,dr,hr[this.layer].el)||en(hr[this.layer].el,n,t)}.bind({layer:d}),24))),d++}while(t.bubbleScroll&&f!==u&&(f=$t(f,!1)));pr=c}}),30),yr=function(e){var t=e.originalEvent,n=e.putSortable,r=e.dragEl,o=e.activeSortable,i=e.dispatchSortableEvent,a=e.hideGhostForTarget,l=e.unhideGhostForTarget;if(t){var s=n||o;a();var u=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t,c=document.elementFromPoint(u.clientX,u.clientY);l(),s&&!s.el.contains(c)&&(i("spill"),this.onSpill({dragEl:r,putSortable:n}))}};function br(){}function wr(){}br.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=Gt(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:yr},It(br,{pluginName:"revertOnSpill"}),wr.prototype={onSpill:function(e){var t=e.dragEl,n=e.putSortable||this.sortable;n.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),n.animateAll()},drop:yr},It(wr,{pluginName:"removeOnSpill"}),er.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?Mt(document,"dragover",this._handleAutoScroll):this.options.supportPointer?Mt(document,"pointermove",this._handleFallbackAutoScroll):t.touches?Mt(document,"touchmove",this._handleFallbackAutoScroll):Mt(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){var t=e.originalEvent;this.options.dragOverBubble||t.rootEl||this._handleAutoScroll(t)},drop:function(){this.sortable.nativeDraggable?At(document,"dragover",this._handleAutoScroll):(At(document,"pointermove",this._handleFallbackAutoScroll),At(document,"touchmove",this._handleFallbackAutoScroll),At(document,"mousemove",this._handleFallbackAutoScroll)),mr(),gr(),clearTimeout(Ht),Ht=void 0},nulling:function(){dr=sr=lr=pr=fr=ur=cr=null,hr.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,i=document.elementFromPoint(r,o);if(dr=e,t||Dt||xt||Pt){vr(e,this.options,i,t);var a=$t(i,!0);!pr||fr&&r===ur&&o===cr||(fr&&mr(),fr=setInterval((function(){var i=$t(document.elementFromPoint(r,o),!0);i!==a&&(a=i,gr()),vr(e,n.options,i,t)}),10),ur=r,cr=o)}else{if(!this.options.bubbleScroll||$t(i,!0)===jt())return void gr();vr(e,this.options,$t(i,!1),!1)}}},It(e,{pluginName:"scroll",initializeByDefault:!0})}),er.mount(wr,br);var Er=new ct,Ir=function(){function t(){e(this,t),this.processing=!1,this.admin=new R,this.start()}return n(t,[{key:"start",value:function(){var e=this,t=this;er.create(document.getElementById("nav-pages"),{onUpdate:function(){(new bt).syncMenu().then((function(e){Er.alert("Updating Menu",null),t.admin.syncNav(e).then((function(e){e.type,Er.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){if(!this.processing){var t="",n=this;switch(e.target.id){case"remove-item":t=e.target.getAttribute("data-id"),(new bt).removeItem(t),(new bt).syncMenu().then((function(t){t.remove
//# sourceMappingURL=dash.min.js.map