mirror of
https://github.com/iv-org/invidious.git
synced 2024-11-22 21:47:26 +00:00
Don't nest YouTube replies
This commit is contained in:
parent
ed3d9ce540
commit
81ea2bf799
@ -129,7 +129,7 @@ def template_youtube_comments(comments)
|
|||||||
<div class="pure-u-1">
|
<div class="pure-u-1">
|
||||||
<p>
|
<p>
|
||||||
<a href="javascript:void(0)" data-continuation="#{comments["continuation"]}"
|
<a href="javascript:void(0)" data-continuation="#{comments["continuation"]}"
|
||||||
onclick="get_youtube_replies(this)">Load more</a>
|
onclick="get_youtube_replies(this, true)">Load more</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -379,7 +379,7 @@ function get_youtube_comments() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_youtube_replies(target) {
|
function get_youtube_replies(target, load_more) {
|
||||||
var continuation = target.getAttribute('data-continuation');
|
var continuation = target.getAttribute('data-continuation');
|
||||||
|
|
||||||
var body = target.parentNode.parentNode;
|
var body = target.parentNode.parentNode;
|
||||||
@ -398,6 +398,11 @@ function get_youtube_replies(target) {
|
|||||||
xhr.onreadystatechange = function() {
|
xhr.onreadystatechange = function() {
|
||||||
if (xhr.readyState == 4) {
|
if (xhr.readyState == 4) {
|
||||||
if (xhr.status == 200) {
|
if (xhr.status == 200) {
|
||||||
|
if (load_more) {
|
||||||
|
body = body.parentNode.parentNode;
|
||||||
|
body.removeChild(body.lastElementChild);
|
||||||
|
body.innerHTML += xhr.response.contentHtml;
|
||||||
|
} else {
|
||||||
body.innerHTML = ' \
|
body.innerHTML = ' \
|
||||||
<p><a href="javascript:void(0)" \
|
<p><a href="javascript:void(0)" \
|
||||||
onclick="hide_youtube_replies(this)">Hide replies \
|
onclick="hide_youtube_replies(this)">Hide replies \
|
||||||
@ -405,6 +410,7 @@ function get_youtube_replies(target) {
|
|||||||
<div>{contentHtml}</div>'.supplant({
|
<div>{contentHtml}</div>'.supplant({
|
||||||
contentHtml: xhr.response.contentHtml,
|
contentHtml: xhr.response.contentHtml,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
body.innerHTML = fallback;
|
body.innerHTML = fallback;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user