mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-04 02:09:22 +02:00
Moving to node_modules folder to make easier to upgrade
trying to move from Bootstrap 3 to Bootstrap 5
This commit is contained in:
parent
047e363a16
commit
d4d042e041
8460 changed files with 1355889 additions and 547977 deletions
97
node_modules/infinite-scroll/js/scroll-watch.js
generated
vendored
Normal file
97
node_modules/infinite-scroll/js/scroll-watch.js
generated
vendored
Normal file
|
@ -0,0 +1,97 @@
|
|||
// scroll-watch
|
||||
( function( window, factory ) {
|
||||
// universal module definition
|
||||
if ( typeof module == 'object' && module.exports ) {
|
||||
// CommonJS
|
||||
module.exports = factory(
|
||||
window,
|
||||
require('./core'),
|
||||
require('fizzy-ui-utils'),
|
||||
);
|
||||
} else {
|
||||
// browser global
|
||||
factory(
|
||||
window,
|
||||
window.InfiniteScroll,
|
||||
window.fizzyUIUtils,
|
||||
);
|
||||
}
|
||||
|
||||
}( window, function factory( window, InfiniteScroll, utils ) {
|
||||
|
||||
let proto = InfiniteScroll.prototype;
|
||||
|
||||
// default options
|
||||
Object.assign( InfiniteScroll.defaults, {
|
||||
scrollThreshold: 400,
|
||||
// elementScroll: null,
|
||||
} );
|
||||
|
||||
InfiniteScroll.create.scrollWatch = function() {
|
||||
// events
|
||||
this.pageScrollHandler = this.onPageScroll.bind( this );
|
||||
this.resizeHandler = this.onResize.bind( this );
|
||||
|
||||
let scrollThreshold = this.options.scrollThreshold;
|
||||
let isEnable = scrollThreshold || scrollThreshold === 0;
|
||||
if ( isEnable ) this.enableScrollWatch();
|
||||
};
|
||||
|
||||
InfiniteScroll.destroy.scrollWatch = function() {
|
||||
this.disableScrollWatch();
|
||||
};
|
||||
|
||||
proto.enableScrollWatch = function() {
|
||||
if ( this.isScrollWatching ) return;
|
||||
|
||||
this.isScrollWatching = true;
|
||||
this.updateMeasurements();
|
||||
this.updateScroller();
|
||||
// TODO disable after error?
|
||||
this.on( 'last', this.disableScrollWatch );
|
||||
this.bindScrollWatchEvents( true );
|
||||
};
|
||||
|
||||
proto.disableScrollWatch = function() {
|
||||
if ( !this.isScrollWatching ) return;
|
||||
|
||||
this.bindScrollWatchEvents( false );
|
||||
delete this.isScrollWatching;
|
||||
};
|
||||
|
||||
proto.bindScrollWatchEvents = function( isBind ) {
|
||||
let addRemove = isBind ? 'addEventListener' : 'removeEventListener';
|
||||
this.scroller[ addRemove ]( 'scroll', this.pageScrollHandler );
|
||||
window[ addRemove ]( 'resize', this.resizeHandler );
|
||||
};
|
||||
|
||||
proto.onPageScroll = InfiniteScroll.throttle( function() {
|
||||
let distance = this.getBottomDistance();
|
||||
if ( distance <= this.options.scrollThreshold ) {
|
||||
this.dispatchEvent('scrollThreshold');
|
||||
}
|
||||
} );
|
||||
|
||||
proto.getBottomDistance = function() {
|
||||
let bottom, scrollY;
|
||||
if ( this.options.elementScroll ) {
|
||||
bottom = this.scroller.scrollHeight;
|
||||
scrollY = this.scroller.scrollTop + this.scroller.clientHeight;
|
||||
} else {
|
||||
bottom = this.top + this.element.clientHeight;
|
||||
scrollY = window.scrollY + this.windowHeight;
|
||||
}
|
||||
return bottom - scrollY;
|
||||
};
|
||||
|
||||
proto.onResize = function() {
|
||||
this.updateMeasurements();
|
||||
};
|
||||
|
||||
utils.debounceMethod( InfiniteScroll, 'onResize', 150 );
|
||||
|
||||
// -------------------------- -------------------------- //
|
||||
|
||||
return InfiniteScroll;
|
||||
|
||||
} ) );
|
Loading…
Add table
Add a link
Reference in a new issue