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.
1 line
5.6 KiB
1 line
5.6 KiB
6 years ago
|
define(["exports","jquery","./util"],function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{"default":a}}function e(a){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a})(a)}function f(){return f=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a},f.apply(this,arguments)}function g(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function h(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}function i(a,b,c){return b&&h(a.prototype,b),c&&h(a,c),a}Object.defineProperty(a,"__esModule",{value:!0});var j=d(b),k=d(c),l=function(a){var b="scrollspy",c="4.0.0",d="bs.scrollspy",h=".".concat(d),j=".data-api",l=a.fn[b],m={offset:10,method:"auto",target:""},n={offset:"number",method:"string",target:"(string|element)"},o={ACTIVATE:"activate".concat(h),SCROLL:"scroll".concat(h),LOAD_DATA_API:"load".concat(h).concat(j)},p={DROPDOWN_ITEM:"dropdown-item",DROPDOWN_MENU:"dropdown-menu",ACTIVE:"active"},q={DATA_SPY:'[data-spy="scroll"]',ACTIVE:".active",NAV_LIST_GROUP:".nav, .list-group",NAV_LINKS:".nav-link",NAV_ITEMS:".nav-item",LIST_ITEMS:".list-group-item",DROPDOWN:".dropdown",DROPDOWN_ITEMS:".dropdown-item",DROPDOWN_TOGGLE:".dropdown-toggle"},r={OFFSET:"offset",POSITION:"position"},s=function(){function j(b,c){var d=this;g(this,j),this._element=b,this._scrollElement="BODY"===b.tagName?window:b,this._config=this._getConfig(c),this._selector="".concat(this._config.target," ").concat(q.NAV_LINKS,",")+"".concat(this._config.target," ").concat(q.LIST_ITEMS,",")+"".concat(this._config.target," ").concat(q.DROPDOWN_ITEMS),this._offsets=[],this._targets=[],this._activeTarget=null,this._scrollHeight=0,a(this._scrollElement).on(o.SCROLL,function(a){return d._process(a)}),this.refresh(),this._process()}return i(j,[{key:"refresh",value:function(){var b=this,c=this._scrollElement===this._scrollElement.window?r.OFFSET:r.POSITION,d="auto"===this._config.method?c:this._config.method,e=d===r.POSITION?this._getScrollTop():0;this._offsets=[],this._targets=[],this._scrollHeight=this._getScrollHeight();var f=a.makeArray(a(this._selector));f.map(function(b){var c,f=k["default"].getSelectorFromElement(b);if(f&&(c=a(f)[0]),c){var g=c.getBoundingClientRect();if(g.width||g.height)return[a(c)[d]().top+e,f]}return null}).filter(function(a){return a}).sort(function(a,b){return a[0]-b[0]}).forEach(function(a){b._offsets.push(a[0]),b._targets.push(a[1])})}},{key:"dispose",value:function(){a.removeData(this._element,d),a(this._scrollElement).off(h),this._element=null,this._scrollElement=null,this._config=null,this._selector=null,this._offsets=null,this._targets=null,this._activeTarget=null,this._scrollHeight=null}},{key:"_getConfig",value:function(c){if(c=f({},m,c),"string"!=typeof c.target){var d=a(c.target).attr("id");d||(d=k["default"].getUID(b),a(c.target).attr("id",d)),c.target="#".concat(d)}return k["default"].typeCheckConfig(b,c,n),c}},{key:"_getScrollTop",value:function(){return this._scrollElement===window?this._scrollElement.pageYOffset:this._scrollElement.scrollTop}},{key:"_getScrollHeight",value:function(){return this._scrollElement.scrollHeight||Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)}},{key:"_getOffsetHeight",value:function(){return this._scrollElement===window?window.innerHeight:this._scrollElement.getBoundingClientRect().height}},{key:"_process",value:function(){var a=this._getScrollTop()+this._config.offset,b=this._getScrollHeight(),c=this._config.offset+b-this._getOffsetHeight();if(this._scrollHeight!==b&&this.refresh(),a>=c){var d=this._targets[this._targets.length-1];return void(this._activeTarget!==d&&this._activate(d))}if(this._activeTarget&&a<this._offsets[0]&&this._offsets[0]>0)return this._ac
|