mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-02 03:31:20 +05:30
Stop trying to pull comments after 10 timeouts
This commit is contained in:
parent
7a6a0f364c
commit
15efac520e
@ -268,8 +268,15 @@ function unsubscribe() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
<% if plid %>
|
<% if plid %>
|
||||||
function get_playlist() {
|
function get_playlist(timeouts = 0) {
|
||||||
playlist = document.getElementById("playlist");
|
playlist = document.getElementById("playlist");
|
||||||
|
|
||||||
|
if (timeouts > 10) {
|
||||||
|
console.log("Failed to pull playlist");
|
||||||
|
playlist.innerHTML = "";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
playlist.innerHTML = ' \
|
playlist.innerHTML = ' \
|
||||||
<h3><center class="loading"><i class="icon ion-ios-refresh"></i></center></h3> \
|
<h3><center class="loading"><i class="icon ion-ios-refresh"></i></center></h3> \
|
||||||
<hr>'
|
<hr>'
|
||||||
@ -323,15 +330,22 @@ function get_playlist() {
|
|||||||
comments = document.getElementById("playlist");
|
comments = document.getElementById("playlist");
|
||||||
comments.innerHTML =
|
comments.innerHTML =
|
||||||
'<h3><center class="loading"><i class="icon ion-ios-refresh"></i></center></h3><hr>';
|
'<h3><center class="loading"><i class="icon ion-ios-refresh"></i></center></h3><hr>';
|
||||||
get_playlist();
|
get_playlist(timeouts + 1);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
get_playlist();
|
get_playlist();
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
function get_reddit_comments() {
|
function get_reddit_comments(timeouts = 0) {
|
||||||
comments = document.getElementById("comments");
|
comments = document.getElementById("comments");
|
||||||
|
|
||||||
|
if (timeouts > 10) {
|
||||||
|
console.log("Failed to pull comments");
|
||||||
|
comments.innerHTML = "";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var fallback = comments.innerHTML;
|
var fallback = comments.innerHTML;
|
||||||
comments.innerHTML =
|
comments.innerHTML =
|
||||||
'<h3><center class="loading"><i class="icon ion-ios-refresh"></i></center></h3>';
|
'<h3><center class="loading"><i class="icon ion-ios-refresh"></i></center></h3>';
|
||||||
@ -382,12 +396,19 @@ function get_reddit_comments() {
|
|||||||
xhr.ontimeout = function() {
|
xhr.ontimeout = function() {
|
||||||
console.log("Pulling comments timed out.");
|
console.log("Pulling comments timed out.");
|
||||||
|
|
||||||
get_reddit_comments();
|
get_reddit_comments(timeouts + 1);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_youtube_comments() {
|
function get_youtube_comments(timeouts = 0) {
|
||||||
comments = document.getElementById("comments");
|
comments = document.getElementById("comments");
|
||||||
|
|
||||||
|
if (timeouts > 10) {
|
||||||
|
console.log("Failed to pull comments");
|
||||||
|
comments.innerHTML = "";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var fallback = comments.innerHTML;
|
var fallback = comments.innerHTML;
|
||||||
comments.innerHTML =
|
comments.innerHTML =
|
||||||
'<h3><center class="loading"><i class="icon ion-ios-refresh"></i></center></h3>';
|
'<h3><center class="loading"><i class="icon ion-ios-refresh"></i></center></h3>';
|
||||||
@ -438,7 +459,7 @@ function get_youtube_comments() {
|
|||||||
|
|
||||||
comments.innerHTML =
|
comments.innerHTML =
|
||||||
'<h3><center class="loading"><i class="icon ion-ios-refresh"></i></center></h3>';
|
'<h3><center class="loading"><i class="icon ion-ios-refresh"></i></center></h3>';
|
||||||
get_youtube_comments();
|
get_youtube_comments(timeouts + 1);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user