You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
7.6 KiB

4 years ago
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).SharedUtils={})}(this,function(e){"use strict";function n(e){console.error("[BScroll warn]: "+e)}var u=function(){return(u=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};var r="undefined"!=typeof window,i=r&&navigator.userAgent.toLowerCase(),t=!(!i||!/wechatdevtools/.test(i)),o=i&&0<i.indexOf("android"),s=function(){if("string"!=typeof i)return!1;var e=/os (\d\d?_\d(_\d)?)/.exec(i);if(!e)return!1;var t=e[1].split("_").map(function(e){return parseInt(e,10)});return!!(13<=t[0]&&4<=t[1])}();var c=function(e,t){for(var n in t)e[n]=t[n];return e};var a=r&&document.createElement("div").style,f=function(){if(!r)return!1;for(var e=0,t=[{key:"standard",value:"transform"},{key:"webkit",value:"webkitTransform"},{key:"Moz",value:"MozTransform"},{key:"O",value:"OTransform"},{key:"ms",value:"msTransform"}];e<t.length;e++){var n=t[e];if(void 0!==a[n.value])return n.key}return!1}();function p(e){return!1===f?e:"standard"===f?"transitionEnd"===e?"transitionend":e:f+e.charAt(0).toUpperCase()+e.substr(1)}function v(e,t,n,r){e.addEventListener(t,n,{passive:!1,capture:!!r})}function h(e,t,n,r){e.removeEventListener(t,n,{capture:!!r})}var l=f&&"standard"!==f?"-"+f.toLowerCase()+"-":"",d=p("transform"),m=p("transition"),y=r&&p("perspective")in a,g=r&&("ontouchstart"in window||t),w=r&&m in a,E={transform:d,transition:m,transitionTimingFunction:p("transitionTimingFunction"),transitionDuration:p("transitionDuration"),transitionDelay:p("transitionDelay"),transformOrigin:p("transformOrigin"),transitionEnd:p("transitionEnd"),transitionProperty:p("transitionProperty")};function b(e,t){for(var n in t)if(t[n].test(e[n]))return!0;return!1}var T=b;function O(e,t){var n;void 0===t&&(t="click"),"mouseup"===e.type?n=e:"touchend"!==e.type&&"touchcancel"!==e.type||(n=e.changedTouches[0]);var r,i={};n&&(i.screenX=n.screenX||0,i.screenY=n.screenY||0,i.clientX=n.clientX||0,i.clientY=n.clientY||0);var o=!0,s=!0,a={ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey};if("undefined"!=typeof MouseEvent)try{r=new MouseEvent(t,c(u({bubbles:o,cancelable:s},a),i))}catch(e){f()}else f();function f(){(r=document.createEvent("Event")).initEvent(t,o,s),c(r,i)}r.forwardedTouchEvent=!0,r._constructed=!0,e.target.dispatchEvent(r)}function k(e,t){t.parentNode.insertBefore(e,t)}function C(e,t){return new RegExp("(^|\\s)"+t+"(\\s|$)").test(e.className)}var D=r&&window;function A(){}function F(e){}var M=r?D.requestAnimationFrame||D.webkitRequestAnimationFrame||D.mozRequestAnimationFrame||D.oRequestAnimationFrame||function(e){return window.setTimeout(e,(e.interval||1e3/60)/2)}:A,x=r?D.cancelAnimationFrame||D.webkitCancelAnimationFrame||D.mozCancelAnimationFrame||D.oCancelAnimationFrame||function(e){window.clearTimeout(e)}:A,B={enumerable:!0,configurable:!0,get:F,set:F};var R=(j.prototype.on=function(e,t,n){return void 0===n&&(n=this),this.hasType(e),this.events[e]||(this.events[e]=[]),this.events[e].push([t,n]),this},j.prototype.once=function(n,r,i){var o=this;void 0===i&&(i=this),this.hasType(n);var s=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];o.off(n,s),r.apply(i,e)};return s.fn=r,this.on(n,s),this},j.prototype.off=function(e,t){if(!e&&!t)return this.events={},this;if(e){if(this.hasType(e),!t)return this.events[e]=[],this;var n=this.events[e];if(!n)return this;for(var r=n.length;r--;)(n[r][0]===t||n[r][0]&&n[r][0].fn===t)&&n.splice(r,1);return this}},j.prototype.trigger=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];this.hasType(e);var r=this.events[e];if(r)for(var i,o=r.length,s=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r}(r),a=0;a<o;a++){var f=s[