diff options
| author | Omar Roth <omarroth@protonmail.com> | 2019-10-18 12:44:11 -0400 |
|---|---|---|
| committer | Omar Roth <omarroth@protonmail.com> | 2019-10-18 12:44:11 -0400 |
| commit | 23ccaea2ff30fa97c92a05343141ce1fc4d08dd1 (patch) | |
| tree | 926efe5e3c8195b7f3d4f732d6c99e3bee538b11 /assets/js/embed.js | |
| parent | 2a4b252a9d2d163150d8ad46f44b3931dfc0f16b (diff) | |
| download | invidious-23ccaea2ff30fa97c92a05343141ce1fc4d08dd1.tar.gz invidious-23ccaea2ff30fa97c92a05343141ce1fc4d08dd1.tar.bz2 invidious-23ccaea2ff30fa97c92a05343141ce1fc4d08dd1.zip | |
Fix comment event listener
Diffstat (limited to 'assets/js/embed.js')
| -rw-r--r-- | assets/js/embed.js | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/assets/js/embed.js b/assets/js/embed.js index 074a9d8d..534c30ff 100644 --- a/assets/js/embed.js +++ b/assets/js/embed.js @@ -69,32 +69,34 @@ function get_playlist(plid, retries) { xhr.send(); } -if (video_data.plid) { - get_playlist(video_data.plid); -} else if (video_data.video_series) { - player.on('ended', function () { - var url = new URL('https://example.com/embed/' + video_data.video_series.shift()); - - if (video_data.params.autoplay || video_data.params.continue_autoplay) { - url.searchParams.set('autoplay', '1'); - } +window.addEventListener('load', function (e) { + if (video_data.plid) { + get_playlist(video_data.plid); + } else if (video_data.video_series) { + player.on('ended', function () { + var url = new URL('https://example.com/embed/' + video_data.video_series.shift()); + + if (video_data.params.autoplay || video_data.params.continue_autoplay) { + url.searchParams.set('autoplay', '1'); + } - if (video_data.params.listen !== video_data.preferences.listen) { - url.searchParams.set('listen', video_data.params.listen); - } + if (video_data.params.listen !== video_data.preferences.listen) { + url.searchParams.set('listen', video_data.params.listen); + } - if (video_data.params.speed !== video_data.preferences.speed) { - url.searchParams.set('speed', video_data.params.speed); - } + if (video_data.params.speed !== video_data.preferences.speed) { + url.searchParams.set('speed', video_data.params.speed); + } - if (video_data.params.local !== video_data.preferences.local) { - url.searchParams.set('local', video_data.params.local); - } + if (video_data.params.local !== video_data.preferences.local) { + url.searchParams.set('local', video_data.params.local); + } - if (video_data.video_series.length !== 0) { - url.searchParams.set('playlist', video_data.video_series.join(',')) - } + if (video_data.video_series.length !== 0) { + url.searchParams.set('playlist', video_data.video_series.join(',')) + } - location.assign(url.pathname + url.search); - }); -} + location.assign(url.pathname + url.search); + }); + } +}); |
