mybuddy/static/babybuddy/js/vendor.c796c6355a2c.js

1 line
194 KiB
JavaScript
Raw Normal View History

2023-09-27 12:18:01 +00:00
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).PullToRefresh=t()}(this,function(){"use strict";var e={pullStartY:null,pullMoveY:null,handlers:[],styleEl:null,events:null,dist:0,state:"pending",timeout:null,distResisted:0,supportsPassive:!1,supportsPointerEvents:"undefined"!=typeof window&&!!window.PointerEvent};try{window.addEventListener("test",null,{get passive(){e.supportsPassive=!0}})}catch(e){}var t,n={setupDOM:function(t){if(!t.ptrElement){var n=document.createElement("div");t.mainElement!==document.body?t.mainElement.parentNode.insertBefore(n,t.mainElement):document.body.insertBefore(n,document.body.firstChild),n.classList.add(t.classPrefix+"ptr"),n.innerHTML=t.getMarkup().replace(/__PREFIX__/g,t.classPrefix),t.ptrElement=n,"function"==typeof t.onInit&&t.onInit(t),e.styleEl||(e.styleEl=document.createElement("style"),e.styleEl.setAttribute("id","pull-to-refresh-js-style"),document.head.appendChild(e.styleEl)),e.styleEl.textContent=t.getStyles().replace(/__PREFIX__/g,t.classPrefix).replace(/\s+/g," ")}return t},onReset:function(t){t.ptrElement&&(t.ptrElement.classList.remove(t.classPrefix+"refresh"),t.ptrElement.style[t.cssProp]="0px",setTimeout(function(){t.ptrElement&&t.ptrElement.parentNode&&(t.ptrElement.parentNode.removeChild(t.ptrElement),t.ptrElement=null),e.state="pending"},t.refreshTimeout))},update:function(t){var n=t.ptrElement.querySelector("."+t.classPrefix+"icon"),i=t.ptrElement.querySelector("."+t.classPrefix+"text");n&&("refreshing"===e.state?n.innerHTML=t.iconRefreshing:n.innerHTML=t.iconArrow),i&&("releasing"===e.state&&(i.innerHTML=t.instructionsReleaseToRefresh),"pulling"!==e.state&&"pending"!==e.state||(i.innerHTML=t.instructionsPullToRefresh),"refreshing"===e.state&&(i.innerHTML=t.instructionsRefreshing))}},i=function(t){return e.pointerEventsEnabled&&e.supportsPointerEvents?t.screenY:t.touches[0].screenY},r=function(){var r;function o(t){var o=e.handlers.filter(function(e){return e.contains(t.target)})[0];e.enable=!!o,o&&"pending"===e.state&&(r=n.setupDOM(o),o.shouldPullToRefresh()&&(e.pullStartY=i(t)),clearTimeout(e.timeout),n.update(o))}function s(t){r&&r.ptrElement&&e.enable&&(e.pullStartY?e.pullMoveY=i(t):r.shouldPullToRefresh()&&(e.pullStartY=i(t)),"refreshing"!==e.state?("pending"===e.state&&(r.ptrElement.classList.add(r.classPrefix+"pull"),e.state="pulling",n.update(r)),e.pullStartY&&e.pullMoveY&&(e.dist=e.pullMoveY-e.pullStartY),e.distExtra=e.dist-r.distIgnore,e.distExtra>0&&(t.cancelable&&t.preventDefault(),r.ptrElement.style[r.cssProp]=e.distResisted+"px",e.distResisted=r.resistanceFunction(e.distExtra/r.distThreshold)*Math.min(r.distMax,e.distExtra),"pulling"===e.state&&e.distResisted>r.distThreshold&&(r.ptrElement.classList.add(r.classPrefix+"release"),e.state="releasing",n.update(r)),"releasing"===e.state&&e.distResisted<r.distThreshold&&(r.ptrElement.classList.remove(r.classPrefix+"release"),e.state="pulling",n.update(r)))):t.cancelable&&r.shouldPullToRefresh()&&e.pullStartY<e.pullMoveY&&t.preventDefault())}function a(){if(r&&r.ptrElement&&e.enable){if(clearTimeout(t),t=setTimeout(function(){r&&r.ptrElement&&"pending"===e.state&&n.onReset(r)},500),"releasing"===e.state&&e.distResisted>r.distThreshold)e.state="refreshing",r.ptrElement.style[r.cssProp]=r.distReload+"px",r.ptrElement.classList.add(r.classPrefix+"refresh"),e.timeout=setTimeout(function(){var e=r.onRefresh(function(){return n.onReset(r)});e&&"function"==typeof e.then&&e.then(function(){return n.onReset(r)}),e||r.onRefresh.length||n.onReset(r)},r.refreshTimeout);else{if("refreshing"===e.state)return;r.ptrElement.style[r.cssProp]="0px",e.state="pending"}n.update(r),r.ptrElement.classList.remove(r.classPrefix+"release"),r.ptrElement.classList.remove(r.classPrefix+"pull"),e.pullStartY=e.pullMoveY=null,e.dist=e.distResisted=0}}function l(){r&&r.mainElement.classList.toggle(r.classPrefix+"top",r.shouldPullToRefresh())}var c=e.supportsPassive?{passive:e.passive||!1}:void 0;return e.pointerEventsEnabled&&e.supportsPointerEven