diff options
author | James Taylor <28744867+user234683@users.noreply.github.com> | 2020-10-12 09:37:13 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-12 09:37:13 -0700 |
commit | fd253d9e07fa34e2a22d28d445839147daca9ee0 (patch) | |
tree | 7dfecaadce3cc58ddcc86e2cd9d5ef762563e9ce /youtube/static/js/comments.js | |
parent | 37d286fc7ce8feec72d9ecf5d238a42c873de1d0 (diff) | |
parent | 2cfc6dec39ccdcc0c5fe2eea73f47b7040e51833 (diff) | |
download | yt-local-fd253d9e07fa34e2a22d28d445839147daca9ee0.tar.lz yt-local-fd253d9e07fa34e2a22d28d445839147daca9ee0.tar.xz yt-local-fd253d9e07fa34e2a22d28d445839147daca9ee0.zip |
Merge branch 'master' into optional_proxy_images
Diffstat (limited to 'youtube/static/js/comments.js')
-rw-r--r-- | youtube/static/js/comments.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/youtube/static/js/comments.js b/youtube/static/js/comments.js new file mode 100644 index 0000000..845ed3e --- /dev/null +++ b/youtube/static/js/comments.js @@ -0,0 +1,20 @@ +function onClickReplies(e) { + var details = e.target.parentElement; + // e.preventDefault(); + console.log("loading replies .."); + doXhr(details.getAttribute("src") + "&slim=1", (html) => { + var div = details.querySelector(".comment_page"); + div.innerHTML = html; + }); + details.removeEventListener('click', onClickReplies); +} + +window.addEventListener('DOMContentLoaded', function() { + QA("details.replies").forEach(details => { + details.addEventListener('click', onClickReplies); + details.addEventListener('auxclick', (e) => { + if (e.target.parentElement !== details) return; + if (e.button == 1) window.open(details.getAttribute("src")); + }); + }); +});
\ No newline at end of file |