@better-scroll/scroll-bar
Advanced tools
Comparing version 2.0.7 to 2.1.0
/*! | ||
* better-scroll / scroll-bar | ||
* (c) 2016-2020 ustbhuangyi | ||
* (c) 2016-2021 ustbhuangyi | ||
* Released under the MIT License. | ||
@@ -49,3 +49,3 @@ */ | ||
// ios version >= 13.4 issue 982 | ||
return !!(parts[0] >= 13 && parts[1] >= 4); | ||
return !!(parts[0] === 13 && parts[1] >= 4); | ||
} | ||
@@ -157,3 +157,6 @@ return false; | ||
_this.off(type, magic); | ||
fn.apply(context, args); | ||
var ret = fn.apply(context, args); | ||
if (ret === true) { | ||
return ret; | ||
} | ||
}; | ||
@@ -160,0 +163,0 @@ magic.fn = fn; |
/*! | ||
* better-scroll / scroll-bar | ||
* (c) 2016-2020 ustbhuangyi | ||
* (c) 2016-2021 ustbhuangyi | ||
* Released under the MIT License. | ||
@@ -55,3 +55,3 @@ */ | ||
// ios version >= 13.4 issue 982 | ||
return !!(parts[0] >= 13 && parts[1] >= 4); | ||
return !!(parts[0] === 13 && parts[1] >= 4); | ||
} | ||
@@ -163,3 +163,6 @@ return false; | ||
_this.off(type, magic); | ||
fn.apply(context, args); | ||
var ret = fn.apply(context, args); | ||
if (ret === true) { | ||
return ret; | ||
} | ||
}; | ||
@@ -166,0 +169,0 @@ magic.fn = fn; |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).ScrollBar=e()}(this,function(){"use strict";var i="undefined"!=typeof window,s=i&&navigator.userAgent.toLowerCase(),o=(s&&/wechatdevtools/.test(s),s&&s.indexOf("android"),function(){if("string"!=typeof s)return;var t=/os (\d\d?_\d(_\d)?)/.exec(s);if(!t)return;var e=t[1].split("_").map(function(t){return parseInt(t,10)});13<=e[0]&&e[1]}(),i&&document.createElement("div").style),e=function(){if(!i)return!1;for(var t=0,e=[{key:"standard",value:"transform"},{key:"webkit",value:"webkitTransform"},{key:"Moz",value:"MozTransform"},{key:"O",value:"OTransform"},{key:"ms",value:"msTransform"}];t<e.length;t++){var s=e[t];if(void 0!==o[s.value])return s.key}return!1}();function t(t){return!1===e?t:"standard"===e?"transitionEnd"===t?"transitionend":t:e+t.charAt(0).toUpperCase()+t.substr(1)}function r(t,e,s,i){t.addEventListener(e,s,{passive:!1,capture:!!i})}function n(t,e,s,i){t.removeEventListener(e,s,{capture:!!i})}e&&"standard"!==e&&e.toLowerCase();var a=t("transform"),h=(t("transition"),i&&t("perspective")in o,a),l=t("transitionTimingFunction"),p=t("transitionDuration"),c=(t("transitionDelay"),t("transformOrigin"),t("transitionEnd"),t("transitionProperty"),d.prototype.on=function(t,e,s){return void 0===s&&(s=this),this.hasType(t),this.events[t]||(this.events[t]=[]),this.events[t].push([e,s]),this},d.prototype.once=function(s,i,o){var r=this;void 0===o&&(o=this),this.hasType(s);var n=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];r.off(s,n),i.apply(o,t)};return n.fn=i,this.on(s,n),this},d.prototype.off=function(t,e){if(!t&&!e)return this.events={},this;if(t){if(this.hasType(t),!e)return this.events[t]=[],this;var s=this.events[t];if(!s)return this;for(var i=s.length;i--;)(s[i][0]===e||s[i][0]&&s[i][0].fn===e)&&s.splice(i,1);return this}},d.prototype.trigger=function(t){for(var e=[],s=1;s<arguments.length;s++)e[s-1]=arguments[s];this.hasType(t);var i=this.events[t];if(i)for(var o,r=i.length,n=function(){for(var t=0,e=0,s=arguments.length;e<s;e++)t+=arguments[e].length;for(var i=Array(t),o=0,e=0;e<s;e++)for(var r=arguments[e],n=0,a=r.length;n<a;n++,o++)i[o]=r[n];return i}(i),a=0;a<r;a++){var h=n[a],l=h[0],p=h[1];if(l&&!0===(o=l.apply(p,e)))return o}},d.prototype.registerType=function(t){var e=this;t.forEach(function(t){e.eventTypes[t]=t})},d.prototype.destroy=function(){this.events={},this.eventTypes={}},d.prototype.hasType=function(t){var e,s=this.eventTypes;s[t]===t||(e='EventEmitter has used unknown event type: "'+t+'", should be oneof ['+Object.keys(s).map(function(t){return JSON.stringify(t)})+"]",console.error("[BScroll warn]: "+e))},d);function d(t){this.events={},this.eventTypes={},this.registerType(t)}var u=(v.prototype.destroy=function(){this.removeDOMEvents(),this.events=[]},v.prototype.addDOMEvents=function(){this.handleDOMEvents(r)},v.prototype.removeDOMEvents=function(){this.handleDOMEvents(n)},v.prototype.handleDOMEvents=function(e){var s=this,i=this.wrapper;this.events.forEach(function(t){e(i,t.name,s,!!t.capture)})},v.prototype.handleEvent=function(e){var s=e.type;this.events.some(function(t){return t.name===s&&(t.handler(e),!0)})},v);function v(t,e){this.wrapper=t,this.events=e,this.addDOMEvents()}var f=(y.prototype._start=function(t){var e,s;this.bscroll.scroller.actions.enabled&&(e=t.touches?t.touches[0]:t,t.preventDefault(),t.stopPropagation(),this.initiated=!0,this.moved=!1,this.lastPoint=e[this.indicator.keysMap.pointPos],s=this.bscroll.options.disableMouse,this.moveEventRegister=new u(window,[{name:s?"touchmove":"mousemove",handler:this._move.bind(this)}]),this.hooks.trigger("touchStart"))},y.prototype._move=function(t){var e=(t.touches?t.touches[0]:t)[this.indicator.keysMap.pointPos];t.preventDefault(),t.stopPropagation();var s=e-this.lastPoint;if(this.lastPoint=e,!this.moved)return this.hooks.trigger("touchMove",this.moved,s),void(this.moved=!0);this.hooks.trigger("touchMove",this.moved,s)},y.prototype._end=function(t){this.initiated&&(this.initiated=!1,t.preventDefault(),t.stopPropagation(),this.moveEventRegister.destroy(),this.hooks.trigger("touchEnd",this.moved))},y.prototype.destroy=function(){this.startEventRegister.destroy(),this.moveEventRegister&&this.moveEventRegister.destroy(),this.endEventRegister.destroy()},y);function y(t,e){this.indicator=t,this.options=e,this.bscroll=t.bscroll,this.startEventRegister=new u(this.indicator.el,[{name:e.disableMouse?"touchstart":"mousedown",handler:this._start.bind(this)}]),this.endEventRegister=new u(window,[{name:e.disableMouse?"touchend":"mouseup",handler:this._end.bind(this)}]),this.hooks=new c(["touchStart","touchMove","touchEnd"])}var m=(g.prototype._listenHooks=function(t,e){var s,i,o=this,r=this.bscroll,n=r,a=r.scroller.translater.hooks,h=r.scroller.animater.hooks;this._listen(n,"refresh",this.refresh),this._listen(a,"translate",this.updatePosAndSize),this._listen(h,"time",function(t){o.setTransitionTime(t)}),this._listen(h,"timeFunction",function(t){o.setTransitionTimingFunction(t)}),t&&(this._listen(n,"scrollEnd",function(){o.fade()}),this._listen(n,"scrollStart",function(){o.fade(!0)}),r.eventTypes.mousewheelStart&&r.eventTypes.mousewheelEnd&&(this._listen(n,"mousewheelStart",function(){o.fade(!0)}),this._listen(n,"mousewheelEnd",function(){o.fade()}))),e&&(s=this.bscroll.options.disableMouse,this.eventHandler=new f(this,{disableMouse:s}),i=this.eventHandler.hooks,this._listen(i,"touchStart",this.startHandler),this._listen(i,"touchMove",this.moveHandler),this._listen(i,"touchEnd",this.endHandler))},g.prototype._getKeysMap=function(){return"vertical"===this.direction?{hasScroll:"hasVerticalScroll",size:"height",wrapperSize:"clientHeight",scrollerSize:"scrollerHeight",maxScroll:"maxScrollY",pos:"y",pointPos:"pageY",translate:"translateY"}:{hasScroll:"hasHorizontalScroll",size:"width",wrapperSize:"clientWidth",scrollerSize:"scrollerWidth",maxScroll:"maxScrollX",pos:"x",pointPos:"pageX",translate:"translateX"}},g.prototype.fade=function(t){var e=t?250:500;this.wrapperStyle[p]=e+"ms",this.wrapperStyle.opacity=t?"1":"0",this.visible=t?1:0},g.prototype.refresh=function(){var t,e,s,i,o=this.keysMap.hasScroll;this._setShowBy(this.bscroll[o])&&(e=(t=this.keysMap).wrapperSize,s=t.scrollerSize,i=t.maxScroll,this.keyVals=this._refreshKeyValues(this.wrapper[e],this.bscroll[s],this.bscroll[i]),this.updatePosAndSize({x:this.bscroll.x,y:this.bscroll.y}))},g.prototype._setShowBy=function(t){return t?!(this.wrapper.style.display=""):!(this.wrapper.style.display="none")},g.prototype._refreshKeyValues=function(t,e,s){var i=Math.max(Math.round(t*t/(e||t||1)),8),o=t-i;return{initialSize:i,maxPos:o,sizeRatio:o/s}},g.prototype.updatePosAndSize=function(t){var e=this._refreshPosAndSizeValue(t,this.keyVals),s=e.pos,i=e.size;this.curPos=s,this._refreshPosAndSizeStyle(i,s)},g.prototype._refreshPosAndSizeValue=function(t,e){var s,i=this.keysMap.pos,o=e.sizeRatio,r=e.initialSize,n=e.maxPos,a=Math.round(o*t[i]);return a<0?(s=Math.max(r+3*a,8),a=0):n<a?a=n+r-(s=Math.max(r-3*(a-n),8)):s=r,{pos:a,size:s}},g.prototype._refreshPosAndSizeStyle=function(t,e){var s=this.keysMap,i=s.translate,o=s.size;this.elStyle[o]=t+"px",this.elStyle[h]=i+"("+e+"px)"+this.bscroll.options.translateZ},g.prototype.setTransitionTime=function(t){void 0===t&&(t=0),this.elStyle[p]=t+"ms"},g.prototype.setTransitionTimingFunction=function(t){this.elStyle[l]=t},g.prototype.startHandler=function(){this.setTransitionTime(),this.bscroll.trigger("beforeScrollStart")},g.prototype.moveHandler=function(t,e){t||this.bscroll.trigger("scrollStart");var s=this._calScrollDesPos(this.curPos,e,this.keyVals);"vertical"===this.direction?this.bscroll.scrollTo(this.bscroll.x,s):this.bscroll.scrollTo(s,this.bscroll.y),this.bscroll.trigger("scroll",{x:this.bscroll.x,y:this.bscroll.y})},g.prototype._calScrollDesPos=function(t,e,s){var i=s.maxPos,o=s.sizeRatio,r=t+e;return r<0?r=0:i<r&&(r=i),Math.round(r/o)},g.prototype.endHandler=function(t){t&&this.bscroll.trigger("scrollEnd",{x:this.bscroll.x,y:this.bscroll.y})},g.prototype.destroy=function(){this.options.interactive&&this.eventHandler.destroy(),this.wrapper.parentNode.removeChild(this.wrapper),this.hooksHandlers.forEach(function(t){var e=t[0],s=t[1],i=t[2];e.off(s,i)}),this.hooksHandlers.length=0},g.prototype._listen=function(t,e,s){t.on(e,s,this),this.hooksHandlers.push([t,e,s])},g);function g(t,e){this.bscroll=t,this.options=e,this.keyVals={sizeRatio:1,maxPos:0,initialSize:0},this.curPos=0,this.hooksHandlers=[],this.wrapper=e.wrapper,this.wrapperStyle=this.wrapper.style,this.el=this.wrapper.children[0],this.elStyle=this.el.style,this.direction=e.direction,this.keysMap=this._getKeysMap(),e.fade?(this.visible=0,this.wrapperStyle.opacity="0"):this.visible=1,this._listenHooks(e.fade,e.interactive),this.refresh()}function b(t){this.indicators=[],this.indicators=this.createIndicators(t),t.on(t.eventTypes.destroy,this.destroy,this)}return b.prototype.createIndicators=function(s){var i,o=this,t=s.options.scrollbar,e=t.fade,r=void 0===e||e,n=t.interactive,a=void 0!==n&&n,h={scrollX:"horizontal",scrollY:"vertical"},l=[];return Object.keys(h).forEach(function(t){var e=h[t];s.options[t]&&(i={wrapper:o.createIndicatorElement(e),direction:e,fade:r,interactive:a},s.wrapper.appendChild(i.wrapper),l.push(new m(s,i)))}),l},b.prototype.createIndicatorElement=function(t){var e=document.createElement("div"),s=document.createElement("div");return e.style.cssText="position:absolute;z-index:9999;pointerEvents:none",s.style.cssText="box-sizing:border-box;position:absolute;background:rgba(0,0,0,0.5);border:1px solid rgba(255,255,255,0.9);border-radius:3px;",s.className="bscroll-indicator","horizontal"===t?(e.style.cssText+=";height:7px;left:2px;right:2px;bottom:0",s.style.height="100%",e.className="bscroll-horizontal-scrollbar"):(e.style.cssText+=";width:7px;bottom:2px;top:2px;right:1px",s.style.width="100%",e.className="bscroll-vertical-scrollbar"),e.style.cssText+=";overflow:hidden",e.appendChild(s),e},b.prototype.destroy=function(){for(var t=0,e=this.indicators;t<e.length;t++){e[t].destroy()}},b.pluginName="scrollbar",b}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).ScrollBar=e()}(this,function(){"use strict";var i="undefined"!=typeof window,s=i&&navigator.userAgent.toLowerCase(),o=(s&&/wechatdevtools/.test(s),s&&s.indexOf("android"),function(){if("string"!=typeof s)return;var t=/os (\d\d?_\d(_\d)?)/.exec(s);if(!t)return;var e=t[1].split("_").map(function(t){return parseInt(t,10)});13===e[0]&&e[1]}(),i&&document.createElement("div").style),e=function(){if(!i)return!1;for(var t=0,e=[{key:"standard",value:"transform"},{key:"webkit",value:"webkitTransform"},{key:"Moz",value:"MozTransform"},{key:"O",value:"OTransform"},{key:"ms",value:"msTransform"}];t<e.length;t++){var s=e[t];if(void 0!==o[s.value])return s.key}return!1}();function t(t){return!1===e?t:"standard"===e?"transitionEnd"===t?"transitionend":t:e+t.charAt(0).toUpperCase()+t.substr(1)}function r(t,e,s,i){t.addEventListener(e,s,{passive:!1,capture:!!i})}function n(t,e,s,i){t.removeEventListener(e,s,{capture:!!i})}e&&"standard"!==e&&e.toLowerCase();var a=t("transform"),h=(t("transition"),i&&t("perspective")in o,a),l=t("transitionTimingFunction"),p=t("transitionDuration"),c=(t("transitionDelay"),t("transformOrigin"),t("transitionEnd"),t("transitionProperty"),d.prototype.on=function(t,e,s){return void 0===s&&(s=this),this.hasType(t),this.events[t]||(this.events[t]=[]),this.events[t].push([e,s]),this},d.prototype.once=function(i,o,r){var n=this;void 0===r&&(r=this),this.hasType(i);var a=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];n.off(i,a);var s=o.apply(r,t);if(!0===s)return s};return a.fn=o,this.on(i,a),this},d.prototype.off=function(t,e){if(!t&&!e)return this.events={},this;if(t){if(this.hasType(t),!e)return this.events[t]=[],this;var s=this.events[t];if(!s)return this;for(var i=s.length;i--;)(s[i][0]===e||s[i][0]&&s[i][0].fn===e)&&s.splice(i,1);return this}},d.prototype.trigger=function(t){for(var e=[],s=1;s<arguments.length;s++)e[s-1]=arguments[s];this.hasType(t);var i=this.events[t];if(i)for(var o,r=i.length,n=function(){for(var t=0,e=0,s=arguments.length;e<s;e++)t+=arguments[e].length;for(var i=Array(t),o=0,e=0;e<s;e++)for(var r=arguments[e],n=0,a=r.length;n<a;n++,o++)i[o]=r[n];return i}(i),a=0;a<r;a++){var h=n[a],l=h[0],p=h[1];if(l&&!0===(o=l.apply(p,e)))return o}},d.prototype.registerType=function(t){var e=this;t.forEach(function(t){e.eventTypes[t]=t})},d.prototype.destroy=function(){this.events={},this.eventTypes={}},d.prototype.hasType=function(t){var e,s=this.eventTypes;s[t]===t||(e='EventEmitter has used unknown event type: "'+t+'", should be oneof ['+Object.keys(s).map(function(t){return JSON.stringify(t)})+"]",console.error("[BScroll warn]: "+e))},d);function d(t){this.events={},this.eventTypes={},this.registerType(t)}var u=(v.prototype.destroy=function(){this.removeDOMEvents(),this.events=[]},v.prototype.addDOMEvents=function(){this.handleDOMEvents(r)},v.prototype.removeDOMEvents=function(){this.handleDOMEvents(n)},v.prototype.handleDOMEvents=function(e){var s=this,i=this.wrapper;this.events.forEach(function(t){e(i,t.name,s,!!t.capture)})},v.prototype.handleEvent=function(e){var s=e.type;this.events.some(function(t){return t.name===s&&(t.handler(e),!0)})},v);function v(t,e){this.wrapper=t,this.events=e,this.addDOMEvents()}var f=(y.prototype._start=function(t){var e,s;this.bscroll.scroller.actions.enabled&&(e=t.touches?t.touches[0]:t,t.preventDefault(),t.stopPropagation(),this.initiated=!0,this.moved=!1,this.lastPoint=e[this.indicator.keysMap.pointPos],s=this.bscroll.options.disableMouse,this.moveEventRegister=new u(window,[{name:s?"touchmove":"mousemove",handler:this._move.bind(this)}]),this.hooks.trigger("touchStart"))},y.prototype._move=function(t){var e=(t.touches?t.touches[0]:t)[this.indicator.keysMap.pointPos];t.preventDefault(),t.stopPropagation();var s=e-this.lastPoint;if(this.lastPoint=e,!this.moved)return this.hooks.trigger("touchMove",this.moved,s),void(this.moved=!0);this.hooks.trigger("touchMove",this.moved,s)},y.prototype._end=function(t){this.initiated&&(this.initiated=!1,t.preventDefault(),t.stopPropagation(),this.moveEventRegister.destroy(),this.hooks.trigger("touchEnd",this.moved))},y.prototype.destroy=function(){this.startEventRegister.destroy(),this.moveEventRegister&&this.moveEventRegister.destroy(),this.endEventRegister.destroy()},y);function y(t,e){this.indicator=t,this.options=e,this.bscroll=t.bscroll,this.startEventRegister=new u(this.indicator.el,[{name:e.disableMouse?"touchstart":"mousedown",handler:this._start.bind(this)}]),this.endEventRegister=new u(window,[{name:e.disableMouse?"touchend":"mouseup",handler:this._end.bind(this)}]),this.hooks=new c(["touchStart","touchMove","touchEnd"])}var m=(g.prototype._listenHooks=function(t,e){var s,i,o=this,r=this.bscroll,n=r,a=r.scroller.translater.hooks,h=r.scroller.animater.hooks;this._listen(n,"refresh",this.refresh),this._listen(a,"translate",this.updatePosAndSize),this._listen(h,"time",function(t){o.setTransitionTime(t)}),this._listen(h,"timeFunction",function(t){o.setTransitionTimingFunction(t)}),t&&(this._listen(n,"scrollEnd",function(){o.fade()}),this._listen(n,"scrollStart",function(){o.fade(!0)}),r.eventTypes.mousewheelStart&&r.eventTypes.mousewheelEnd&&(this._listen(n,"mousewheelStart",function(){o.fade(!0)}),this._listen(n,"mousewheelEnd",function(){o.fade()}))),e&&(s=this.bscroll.options.disableMouse,this.eventHandler=new f(this,{disableMouse:s}),i=this.eventHandler.hooks,this._listen(i,"touchStart",this.startHandler),this._listen(i,"touchMove",this.moveHandler),this._listen(i,"touchEnd",this.endHandler))},g.prototype._getKeysMap=function(){return"vertical"===this.direction?{hasScroll:"hasVerticalScroll",size:"height",wrapperSize:"clientHeight",scrollerSize:"scrollerHeight",maxScroll:"maxScrollY",pos:"y",pointPos:"pageY",translate:"translateY"}:{hasScroll:"hasHorizontalScroll",size:"width",wrapperSize:"clientWidth",scrollerSize:"scrollerWidth",maxScroll:"maxScrollX",pos:"x",pointPos:"pageX",translate:"translateX"}},g.prototype.fade=function(t){var e=t?250:500;this.wrapperStyle[p]=e+"ms",this.wrapperStyle.opacity=t?"1":"0",this.visible=t?1:0},g.prototype.refresh=function(){var t,e,s,i,o=this.keysMap.hasScroll;this._setShowBy(this.bscroll[o])&&(e=(t=this.keysMap).wrapperSize,s=t.scrollerSize,i=t.maxScroll,this.keyVals=this._refreshKeyValues(this.wrapper[e],this.bscroll[s],this.bscroll[i]),this.updatePosAndSize({x:this.bscroll.x,y:this.bscroll.y}))},g.prototype._setShowBy=function(t){return t?!(this.wrapper.style.display=""):!(this.wrapper.style.display="none")},g.prototype._refreshKeyValues=function(t,e,s){var i=Math.max(Math.round(t*t/(e||t||1)),8),o=t-i;return{initialSize:i,maxPos:o,sizeRatio:o/s}},g.prototype.updatePosAndSize=function(t){var e=this._refreshPosAndSizeValue(t,this.keyVals),s=e.pos,i=e.size;this.curPos=s,this._refreshPosAndSizeStyle(i,s)},g.prototype._refreshPosAndSizeValue=function(t,e){var s,i=this.keysMap.pos,o=e.sizeRatio,r=e.initialSize,n=e.maxPos,a=Math.round(o*t[i]);return a<0?(s=Math.max(r+3*a,8),a=0):n<a?a=n+r-(s=Math.max(r-3*(a-n),8)):s=r,{pos:a,size:s}},g.prototype._refreshPosAndSizeStyle=function(t,e){var s=this.keysMap,i=s.translate,o=s.size;this.elStyle[o]=t+"px",this.elStyle[h]=i+"("+e+"px)"+this.bscroll.options.translateZ},g.prototype.setTransitionTime=function(t){void 0===t&&(t=0),this.elStyle[p]=t+"ms"},g.prototype.setTransitionTimingFunction=function(t){this.elStyle[l]=t},g.prototype.startHandler=function(){this.setTransitionTime(),this.bscroll.trigger("beforeScrollStart")},g.prototype.moveHandler=function(t,e){t||this.bscroll.trigger("scrollStart");var s=this._calScrollDesPos(this.curPos,e,this.keyVals);"vertical"===this.direction?this.bscroll.scrollTo(this.bscroll.x,s):this.bscroll.scrollTo(s,this.bscroll.y),this.bscroll.trigger("scroll",{x:this.bscroll.x,y:this.bscroll.y})},g.prototype._calScrollDesPos=function(t,e,s){var i=s.maxPos,o=s.sizeRatio,r=t+e;return r<0?r=0:i<r&&(r=i),Math.round(r/o)},g.prototype.endHandler=function(t){t&&this.bscroll.trigger("scrollEnd",{x:this.bscroll.x,y:this.bscroll.y})},g.prototype.destroy=function(){this.options.interactive&&this.eventHandler.destroy(),this.wrapper.parentNode.removeChild(this.wrapper),this.hooksHandlers.forEach(function(t){var e=t[0],s=t[1],i=t[2];e.off(s,i)}),this.hooksHandlers.length=0},g.prototype._listen=function(t,e,s){t.on(e,s,this),this.hooksHandlers.push([t,e,s])},g);function g(t,e){this.bscroll=t,this.options=e,this.keyVals={sizeRatio:1,maxPos:0,initialSize:0},this.curPos=0,this.hooksHandlers=[],this.wrapper=e.wrapper,this.wrapperStyle=this.wrapper.style,this.el=this.wrapper.children[0],this.elStyle=this.el.style,this.direction=e.direction,this.keysMap=this._getKeysMap(),e.fade?(this.visible=0,this.wrapperStyle.opacity="0"):this.visible=1,this._listenHooks(e.fade,e.interactive),this.refresh()}function b(t){this.indicators=[],this.indicators=this.createIndicators(t),t.on(t.eventTypes.destroy,this.destroy,this)}return b.prototype.createIndicators=function(s){var i,o=this,t=s.options.scrollbar,e=t.fade,r=void 0===e||e,n=t.interactive,a=void 0!==n&&n,h={scrollX:"horizontal",scrollY:"vertical"},l=[];return Object.keys(h).forEach(function(t){var e=h[t];s.options[t]&&(i={wrapper:o.createIndicatorElement(e),direction:e,fade:r,interactive:a},s.wrapper.appendChild(i.wrapper),l.push(new m(s,i)))}),l},b.prototype.createIndicatorElement=function(t){var e=document.createElement("div"),s=document.createElement("div");return e.style.cssText="position:absolute;z-index:9999;pointerEvents:none",s.style.cssText="box-sizing:border-box;position:absolute;background:rgba(0,0,0,0.5);border:1px solid rgba(255,255,255,0.9);border-radius:3px;",s.className="bscroll-indicator","horizontal"===t?(e.style.cssText+=";height:7px;left:2px;right:2px;bottom:0",s.style.height="100%",e.className="bscroll-horizontal-scrollbar"):(e.style.cssText+=";width:7px;bottom:2px;top:2px;right:1px",s.style.width="100%",e.className="bscroll-vertical-scrollbar"),e.style.cssText+=";overflow:hidden",e.appendChild(s),e},b.prototype.destroy=function(){for(var t=0,e=this.indicators;t<e.length;t++){e[t].destroy()}},b.pluginName="scrollbar",b}); |
{ | ||
"name": "@better-scroll/scroll-bar", | ||
"version": "2.0.7", | ||
"version": "2.1.0", | ||
"description": "scrollbar is used to BetterScroll, which behaves like browser scrollbar", | ||
@@ -30,5 +30,5 @@ "author": "huangyi <ustbhuangyi@gmail.com>", | ||
"dependencies": { | ||
"@better-scroll/core": "^2.0.7" | ||
"@better-scroll/core": "^2.1.0" | ||
}, | ||
"gitHead": "6f3a78b8563219def89c836421a6bb55229a4794" | ||
"gitHead": "29312b14a1762be5656419c9d7e9b498ec8cb34d" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
88777
2132
Updated@better-scroll/core@^2.1.0