Fix comment event listener

This commit is contained in:
Omar Roth 2019-10-18 12:44:11 -04:00
parent 2a4b252a9d
commit 23ccaea2ff
No known key found for this signature in database
GPG Key ID: B8254FB7EC3D37F2
3 changed files with 175 additions and 169 deletions

View File

@ -69,6 +69,7 @@ function get_playlist(plid, retries) {
xhr.send(); xhr.send();
} }
window.addEventListener('load', function (e) {
if (video_data.plid) { if (video_data.plid) {
get_playlist(video_data.plid); get_playlist(video_data.plid);
} else if (video_data.video_series) { } else if (video_data.video_series) {
@ -98,3 +99,4 @@ if (video_data.plid) {
location.assign(url.pathname + url.search); location.assign(url.pathname + url.search);
}); });
} }
});

View File

@ -151,6 +151,7 @@ player.vttThumbnails({
// Enable annotations // Enable annotations
if (!video_data.params.listen && video_data.params.annotations) { if (!video_data.params.listen && video_data.params.annotations) {
window.addEventListener('load', function (e) {
var video_container = document.getElementById('player'); var video_container = document.getElementById('player');
let xhr = new XMLHttpRequest(); let xhr = new XMLHttpRequest();
xhr.responseType = 'text'; xhr.responseType = 'text';
@ -190,6 +191,7 @@ if (!video_data.params.listen && video_data.params.annotations) {
}); });
xhr.send(); xhr.send();
});
} }
function increase_volume(delta) { function increase_volume(delta) {

View File

@ -439,6 +439,7 @@ if (video_data.play_next) {
}); });
} }
window.addEventListener('load', function (e) {
if (video_data.plid) { if (video_data.plid) {
get_playlist(video_data.plid); get_playlist(video_data.plid);
} }
@ -455,3 +456,4 @@ if (video_data.params.comments[0] === 'youtube') {
comments = document.getElementById('comments'); comments = document.getElementById('comments');
comments.innerHTML = ''; comments.innerHTML = '';
} }
});