mirror of
https://github.com/pikami/tiktok-dl.git
synced 2025-06-05 06:20:04 +01:00
TTDL-20 Wait for error/items beefore quiting
This commit is contained in:
parent
668b050dee
commit
92006d864f
@ -129,9 +129,12 @@ getCurrentVideo = function() {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
scrollBottom = () => window.scrollTo(0, document.body.scrollHeight);
|
||||||
|
|
||||||
scrollWhileNew = function(finishCallback) {
|
scrollWhileNew = function(finishCallback) {
|
||||||
var state = { count: 0 };
|
var state = { count: 0 };
|
||||||
var intervalID = window.setInterval(x => {
|
var intervalID = window.setInterval(x => {
|
||||||
|
scrollBottom();
|
||||||
var oldCount = state.count;
|
var oldCount = state.count;
|
||||||
state.count = document.getElementsByClassName(optStrings.classes.feedVideoItem).length;
|
state.count = document.getElementsByClassName(optStrings.classes.feedVideoItem).length;
|
||||||
if(currentState.limit > 0) {
|
if(currentState.limit > 0) {
|
||||||
@ -143,13 +146,13 @@ scrollWhileNew = function(finishCallback) {
|
|||||||
if(checkForErrors()) {
|
if(checkForErrors()) {
|
||||||
window.clearInterval(intervalID);
|
window.clearInterval(intervalID);
|
||||||
return;
|
return;
|
||||||
|
} else if (state.count == 0) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (oldCount !== state.count) {
|
if (oldCount !== state.count) {
|
||||||
currentState.preloadCount = state.count;
|
currentState.preloadCount = state.count;
|
||||||
window.scrollTo(0, document.body.scrollHeight);
|
|
||||||
} else {
|
} else {
|
||||||
if (document.querySelector(optStrings.selectors.feedLoading)) {
|
if (document.querySelector(optStrings.selectors.feedLoading)) {
|
||||||
window.scrollTo(0, document.body.scrollHeight);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
window.clearInterval(intervalID);
|
window.clearInterval(intervalID);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user