mirror of
https://git.nadeko.net/Fijxu/invidious.git
synced 2025-12-14 17:15:09 +00:00
Merge 'Show message when comments are turned off'
From https://github.com/iv-org/invidious/pull/4051
This commit is contained in:
@@ -68,7 +68,24 @@ function get_youtube_comments() {
|
||||
url += '&ucid=' + video_data.ucid
|
||||
}
|
||||
|
||||
var onNon200 = function (xhr) { comments.innerHTML = fallback; };
|
||||
var onNon200 = function (xhr) {
|
||||
if (!video_data.comments_enabled) {
|
||||
comments.innerHTML = `
|
||||
<div id="comments-turned-off-on-video-message" class="h-box v-box">
|
||||
<p><b>${video_data.comments_youtube_disabled_text}</b></p>
|
||||
|
||||
<p><b><button href="javascript:void(0)" data-comments="reddit" id="try-reddit-comments-link" class="simulated_a">
|
||||
${video_data.comments_youtube_disabled_try_reddit}
|
||||
</button></b></p>
|
||||
</div>`;
|
||||
|
||||
document.getElementById("try-reddit-comments-link").onclick = swap_comments;
|
||||
} else {
|
||||
comments.innerHTML = fallback;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
if (video_data.params.comments[1] === 'youtube')
|
||||
onNon200 = function (xhr) {};
|
||||
|
||||
|
||||
@@ -182,6 +182,10 @@ addEventListener('load', function (e) {
|
||||
if (video_data.plid)
|
||||
get_playlist(video_data.plid);
|
||||
|
||||
if (!video_data.comments_enabled && video_data.params.comments.includes("youtube")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (video_data.params.comments[0] === 'youtube') {
|
||||
get_youtube_comments();
|
||||
} else if (video_data.params.comments[0] === 'reddit') {
|
||||
@@ -190,8 +194,7 @@ addEventListener('load', function (e) {
|
||||
get_youtube_comments();
|
||||
} else if (video_data.params.comments[1] === 'reddit') {
|
||||
get_reddit_comments();
|
||||
} else {
|
||||
var comments = document.getElementById('comments');
|
||||
comments.innerHTML = '';
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementById("try-reddit-comments-link").onclick = swap_comments;
|
||||
|
||||
Reference in New Issue
Block a user