mirror of
https://github.com/iv-org/invidious.git
synced 2024-11-08 13:42:27 +05:30
Add btn to try reddit comments when yt is disabled
This commit is contained in:
parent
ab2e7a0600
commit
2e590ee67c
@ -72,7 +72,28 @@ function get_youtube_comments() {
|
|||||||
url += '&ucid=' + video_data.ucid
|
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')
|
if (video_data.params.comments[1] === 'youtube')
|
||||||
onNon200 = function (xhr) {};
|
onNon200 = function (xhr) {};
|
||||||
|
|
||||||
|
@ -178,6 +178,10 @@ addEventListener('load', function (e) {
|
|||||||
if (video_data.plid)
|
if (video_data.plid)
|
||||||
get_playlist(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') {
|
if (video_data.params.comments[0] === 'youtube') {
|
||||||
get_youtube_comments();
|
get_youtube_comments();
|
||||||
} else if (video_data.params.comments[0] === 'reddit') {
|
} else if (video_data.params.comments[0] === 'reddit') {
|
||||||
@ -188,3 +192,5 @@ addEventListener('load', function (e) {
|
|||||||
get_reddit_comments();
|
get_reddit_comments();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
document.getElementById("try-reddit-comments-link").onclick = swap_comments
|
@ -214,6 +214,7 @@
|
|||||||
"Hide replies": "Hide replies",
|
"Hide replies": "Hide replies",
|
||||||
"Show replies": "Show replies",
|
"Show replies": "Show replies",
|
||||||
"youtube_comments_disabled_text": "Comments are turned off on this video",
|
"youtube_comments_disabled_text": "Comments are turned off on this video",
|
||||||
|
"youtube_comments_disabled_try_reddit": "Try reddit comments?",
|
||||||
"invidious_comments_disabled_text": "Comments are hidden as per configuration",
|
"invidious_comments_disabled_text": "Comments are hidden as per configuration",
|
||||||
"Incorrect password": "Incorrect password",
|
"Incorrect password": "Incorrect password",
|
||||||
"Wrong answer": "Wrong answer",
|
"Wrong answer": "Wrong answer",
|
||||||
|
@ -42,6 +42,12 @@ we're going to need to do it here in order to allow for translations.
|
|||||||
content: "<%= translate(locale, "Show less") %>"
|
content: "<%= translate(locale, "Show less") %>"
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<%
|
||||||
|
# Disable the try reddit link if javascript is disabled
|
||||||
|
%>
|
||||||
|
<noscript><style> #try-reddit-comments-link { display: none } </style></noscript>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<script id="video_data" type="application/json">
|
<script id="video_data" type="application/json">
|
||||||
@ -56,6 +62,8 @@ we're going to need to do it here in order to allow for translations.
|
|||||||
"youtube_comments_text" => HTML.escape(translate(locale, "View YouTube comments")),
|
"youtube_comments_text" => HTML.escape(translate(locale, "View YouTube comments")),
|
||||||
"reddit_comments_text" => HTML.escape(translate(locale, "View Reddit comments")),
|
"reddit_comments_text" => HTML.escape(translate(locale, "View Reddit comments")),
|
||||||
"reddit_permalink_text" => HTML.escape(translate(locale, "View more comments on Reddit")),
|
"reddit_permalink_text" => HTML.escape(translate(locale, "View more comments on Reddit")),
|
||||||
|
"youtube_comments_disabled_text" => HTML.escape(translate(locale, "youtube_comments_disabled_text")),
|
||||||
|
"youtube_comments_disabled_try_reddit" => HTML.escape(translate(locale, "youtube_comments_disabled_try_reddit")),
|
||||||
"comments_text" => HTML.escape(translate(locale, "View `x` comments", "{commentCount}")),
|
"comments_text" => HTML.escape(translate(locale, "View `x` comments", "{commentCount}")),
|
||||||
"hide_replies_text" => HTML.escape(translate(locale, "Hide replies")),
|
"hide_replies_text" => HTML.escape(translate(locale, "Hide replies")),
|
||||||
"show_replies_text" => HTML.escape(translate(locale, "Show replies")),
|
"show_replies_text" => HTML.escape(translate(locale, "Show replies")),
|
||||||
@ -307,7 +315,15 @@ we're going to need to do it here in order to allow for translations.
|
|||||||
<% end %>
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div id="comments-turned-off-on-video-message" class="h-box v-box">
|
<div id="comments-turned-off-on-video-message" class="h-box v-box">
|
||||||
<p><b><%=translate(locale, "youtube_comments_disabled_text")%></b></p>
|
<p><b><%=translate(locale, "youtube_comments_disabled_text")%></b></p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<b>
|
||||||
|
<a href="javascript:void(0)" data-comments="reddit" id="try-reddit-comments-link">
|
||||||
|
<%=HTML.escape(translate(locale, "youtube_comments_disabled_try_reddit"))%>
|
||||||
|
</a>
|
||||||
|
</b>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
Loading…
Reference in New Issue
Block a user