mirror of https://github.com/iv-org/invidious.git
Add option to switch between YouTube and Reddit comments
This commit is contained in:
parent
a4d44d3286
commit
98bb20abcd
|
@ -217,6 +217,13 @@ function get_reddit_comments() {
|
||||||
<a href="javascript:void(0)" onclick="toggle_comments(this)">[ - ]</a> \
|
<a href="javascript:void(0)" onclick="toggle_comments(this)">[ - ]</a> \
|
||||||
{title} \
|
{title} \
|
||||||
</h3> \
|
</h3> \
|
||||||
|
<p> \
|
||||||
|
<b> \
|
||||||
|
<a href="javascript:void(0)" onclick="swap_comments(\'youtube\')"> \
|
||||||
|
View YouTube comments \
|
||||||
|
</a> \
|
||||||
|
</b> \
|
||||||
|
</p> \
|
||||||
<b> \
|
<b> \
|
||||||
<a rel="noopener" target="_blank" href="https://reddit.com{permalink}">View more comments on Reddit</a> \
|
<a rel="noopener" target="_blank" href="https://reddit.com{permalink}">View more comments on Reddit</a> \
|
||||||
</b> \
|
</b> \
|
||||||
|
@ -263,6 +270,11 @@ function get_youtube_comments() {
|
||||||
<a href="javascript:void(0)" onclick="toggle_comments(this)">[ - ]</a> \
|
<a href="javascript:void(0)" onclick="toggle_comments(this)">[ - ]</a> \
|
||||||
View {commentCount} comments \
|
View {commentCount} comments \
|
||||||
</h3> \
|
</h3> \
|
||||||
|
<b> \
|
||||||
|
<a href="javascript:void(0)" onclick="swap_comments(\'reddit\')"> \
|
||||||
|
View Reddit comments \
|
||||||
|
</a> \
|
||||||
|
</b> \
|
||||||
</div> \
|
</div> \
|
||||||
<div>{contentHtml}</div> \
|
<div>{contentHtml}</div> \
|
||||||
<hr>'.supplant({
|
<hr>'.supplant({
|
||||||
|
@ -292,6 +304,19 @@ function get_youtube_comments() {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function swap_comments(source) {
|
||||||
|
comments = document.getElementById("comments");
|
||||||
|
var fallback = comments.innerHTML;
|
||||||
|
comments.innerHTML =
|
||||||
|
'<h3><center class="loading"><i class="icon ion-ios-refresh"></i></center></h3>';
|
||||||
|
|
||||||
|
if (source == "youtube") {
|
||||||
|
get_youtube_comments();
|
||||||
|
} else if (source == "reddit") {
|
||||||
|
get_reddit_comments();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function commaSeparateNumber(val){
|
function commaSeparateNumber(val){
|
||||||
while (/(\d+)(\d{3})/.test(val.toString())){
|
while (/(\d+)(\d{3})/.test(val.toString())){
|
||||||
val = val.toString().replace(/(\d+)(\d{3})/, '$1'+','+'$2');
|
val = val.toString().replace(/(\d+)(\d{3})/, '$1'+','+'$2');
|
||||||
|
|
Loading…
Reference in New Issue