mirror of https://github.com/acanas/swad-core.git
Version 23.47: Nov 08, 2023 Infinite scroll in timeline.
This commit is contained in:
parent
78a84a22c4
commit
93962fc562
|
@ -1018,27 +1018,18 @@ function moveNewTimelineToTimeline () {
|
|||
/*****************************************************************************/
|
||||
|
||||
// See https://webdesign.tutsplus.com/how-to-implement-infinite-scrolling-with-javascript--cms-37055t
|
||||
// See https://www.educative.io/answers/how-to-implement-infinite-scrolling-in-javascript
|
||||
|
||||
var throttleWait;
|
||||
var refreshingOldTimeline = false;
|
||||
|
||||
const throttle = (callback, time) => {
|
||||
if (throttleWait) return;
|
||||
throttleWait = true;
|
||||
function handleInfiniteScroll () {
|
||||
if (refreshingOldTimeline) return;
|
||||
|
||||
setTimeout(() => {
|
||||
callback();
|
||||
throttleWait = false;
|
||||
}, time);
|
||||
};
|
||||
|
||||
const handleInfiniteScroll = () => {
|
||||
throttle(() => {
|
||||
const endOfPage = window.innerHeight + window.pageYOffset >= document.body.offsetHeight - 320;
|
||||
|
||||
if (endOfPage)
|
||||
refreshOldTimeline ();
|
||||
|
||||
}, 250);
|
||||
const endOfPage = window.scrollY + window.innerHeight >= document.body.scrollHeight - 100;
|
||||
if (endOfPage) {
|
||||
refreshingOldTimeline = true;
|
||||
refreshOldTimeline ();
|
||||
}
|
||||
};
|
||||
|
||||
// This function is called when user clicks in 'See more'
|
||||
|
@ -1097,6 +1088,8 @@ function readOldTimelineData () {
|
|||
// Hide container with link to get old publications
|
||||
document.getElementById("view_old_pubs_container").style.display = 'none';
|
||||
}
|
||||
|
||||
refreshingOldTimeline = false; // Refreshing is finished
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -637,7 +637,7 @@ Me sale este error, no s
|
|||
#define CSS_FILE "swad23.46.1.css"
|
||||
#define JS_FILE "swad23.47.js"
|
||||
/*
|
||||
Version 23.47: Nov 08, 2023 Infinite scroll in timeline. (335565 lines)
|
||||
Version 23.47: Nov 08, 2023 Infinite scroll in timeline. (335561 lines)
|
||||
Version 23.46.1: Nov 07, 2023 Improvements in responsive design. (? lines)
|
||||
Version 23.46: Nov 07, 2023 Code refactoring and layout changes in lists of my courses, forums and chat. (335525 lines)
|
||||
Version 23.45: Nov 07, 2023 Improvements in responsive design. (335468 lines)
|
||||
|
|
Loading…
Reference in New Issue