mirror of
https://github.com/iv-org/invidious.git
synced 2025-07-31 02:28:47 -04:00
Add btn to try reddit comments when yt is disabled
This commit is contained in:
parent
d0fecd2bc0
commit
a025645f06
4 changed files with 46 additions and 2 deletions
|
@ -72,7 +72,28 @@ 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.youtube_comments_disabled_text}</b></p>
|
||||
|
||||
<p>
|
||||
<b>
|
||||
<a href="javascript:void(0)" data-comments="reddit" id="try-reddit-comments-link">
|
||||
${video_data.youtube_comments_disabled_try_reddit}
|
||||
</a>
|
||||
</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) {};
|
||||
|
||||
|
|
|
@ -178,6 +178,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') {
|
||||
|
@ -188,3 +192,5 @@ addEventListener('load', function (e) {
|
|||
get_reddit_comments();
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementById("try-reddit-comments-link").onclick = swap_comments
|
Loading…
Add table
Add a link
Reference in a new issue