Merge 'Show message when comments are turned off'

From https://github.com/iv-org/invidious/pull/4051
This commit is contained in:
Fijxu
2025-05-09 00:16:07 -04:00
8 changed files with 117 additions and 21 deletions

View File

@@ -58,6 +58,11 @@ body {
justify-content: flex-end;
}
button.simulated_a {
background: none;
border: none;
}
/*
* Channel page
@@ -554,7 +559,9 @@ span > select {
.light-theme a:active,
.light-theme summary:hover,
.light-theme a:focus,
.light-theme summary:focus {
.light-theme summary:focus,
.light-theme .simulated_a:hover,
.light-theme .simulated_a:active {
color: #075A9E !important;
}
@@ -572,7 +579,7 @@ span > select {
background-color: #fff2;
}
.light-theme a {
.light-theme a, .light-theme .simulated_a {
color: #335d7a;
text-decoration: none;
}
@@ -614,7 +621,9 @@ span > select {
.no-theme a:active,
.no-theme summary:hover,
.no-theme a:focus,
.no-theme summary:focus {
.no-theme summary:focus,
.no-theme .simulated_a:hover,
.no-theme .simulated_a:active {
color: #075A9E !important;
}
@@ -632,7 +641,7 @@ span > select {
background-color: #fff2;
}
.no-theme a {
.no-theme a, .no-theme .simulated_a{
color: #335d7a;
text-decoration: none;
}
@@ -679,7 +688,9 @@ span > select {
.dark-theme a:active,
.dark-theme summary:hover,
.dark-theme a:focus,
.dark-theme summary:focus {
.dark-theme summary:focus,
.dark-theme .simulated_a:hover,
.dark-theme .simulated_a:active {
color: rgb(0, 182, 240);
}
@@ -697,7 +708,7 @@ span > select {
color: #ddd;
}
.dark-theme a {
.dark-theme a, .dark-theme .simulated_a {
color: #adadad;
text-decoration: none;
}
@@ -751,7 +762,9 @@ body.dark-theme {
@media (prefers-color-scheme: dark) {
.no-theme a:hover,
.no-theme a:active,
.no-theme a:focus {
.no-theme a:focus,
.no-theme .simulated_a:hover,
.no-theme .simulated_a:active {
color: rgb(0, 182, 240);
}
@@ -769,7 +782,7 @@ body.dark-theme {
color: #ddd;
}
.no-theme a {
.no-theme a, .no-theme .simulated_a{
color: #adadad;
text-decoration: none;
}
@@ -975,4 +988,8 @@ h1, h2, h3, h4, h5, p,
.error-issue-template {
padding: 20px;
background: rgba(0, 0, 0, 0.12345);
}
}
#comments-turned-off-on-video-message > p, #comments-disabled-message > p {
text-align: center;
}

View File

@@ -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) {};

View File

@@ -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;