Invidious is an alternative front-end to YouTube
JS. Trailing spaces removed
meowd3ab4a51457e
diff --git a/assets/js/_helpers.js b/assets/js/_helpers.jsindex 0bd99a8c..7c50670e 100644--- a/assets/js/_helpers.js+++ b/assets/js/_helpers.js@@ -164,7 +164,7 @@ window.helpers = window.helpers || {helpers._xhrRetry(method, url, options, callbacks);}, options.retry_timeout);};-+// Pack retry() call into error handlerscallbacks._onError = callbacks.onError;callbacks.onError = function (xhr) {diff --git a/assets/js/community.js b/assets/js/community.jsindex 608dc971..32fe4ebc 100644--- a/assets/js/community.js+++ b/assets/js/community.js@@ -38,7 +38,7 @@ function get_youtube_replies(target, load_more) {var fallback = body.innerHTML;body.innerHTML ='<h3 style="text-align:center"><div class="loading"><i class="icon ion-ios-refresh"></i></div></h3>';-+var url = '/api/v1/channels/comments/' + community_data.ucid +'?format=html' +'&hl=' + community_data.preferences.locale +diff --git a/assets/js/notifications.js b/assets/js/notifications.jsindex 51ff1f98..058553d9 100644--- a/assets/js/notifications.js+++ b/assets/js/notifications.js@@ -52,13 +52,13 @@ function create_notification_stream(subscriptions) {if (window.Notification && Notification.permission === 'granted') {var notification_text = notification.liveNow ? notification_data.live_now_text : notification_data.upload_text;notification_text = notification_text.replace('`x`', notification.author);-+var system_notification = new Notification(notification_text, {body: notification.title,icon: '/ggpht' + new URL(notification.authorThumbnails[2].url).pathname,img: '/ggpht' + new URL(notification.authorThumbnails[4].url).pathname});-+system_notification.onclick = function (e) {open('/watch?v=' + notification.videoId, '_blank');};diff --git a/assets/js/player.js b/assets/js/player.jsindex 48533b3e..7d099e66 100644--- a/assets/js/player.js+++ b/assets/js/player.js@@ -54,12 +54,12 @@ var player = videojs('player', options);player.on('error', function () {if (video_data.params.quality === 'dash') return;-+var localNotDisabled = (!player.currentSrc().includes('local=true') && !video_data.local_disabled);var reloadMakesSense = (- player.error().code === MediaError.MEDIA_ERR_NETWORK ||+ player.error().code === MediaError.MEDIA_ERR_NETWORK ||player.error().code === MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED);@@ -465,7 +465,7 @@ function toggle_play() { player.paused() ? play() : pause(); }const toggle_captions = (function () {let toggledTrack = null;-+function bindChange(onOrOff) {player.textTracks()[onOrOff]('change', function (e) {toggledTrack = null;@@ -481,7 +481,7 @@ const toggle_captions = (function () {bindChange('on');}, 0);}-+bindChange('on');return function () {if (toggledTrack !== null) {diff --git a/assets/js/watch.js b/assets/js/watch.jsindex f78b9242..cff84e4d 100644--- a/assets/js/watch.js+++ b/assets/js/watch.js@@ -172,7 +172,7 @@ function get_reddit_comments() {var onNon200 = function (xhr) { comments.innerHTML = fallback; };if (video_data.params.comments[1] === 'youtube')onNon200 = function (xhr) {};-+helpers.xhr('GET', url, {retries: 5, entity_name: ''}, {on200: function (response) {comments.innerHTML = ' \@@ -218,11 +218,11 @@ function get_youtube_comments() {'?format=html' +'&hl=' + video_data.preferences.locale +'&thin_mode=' + video_data.preferences.thin_mode;-+var onNon200 = function (xhr) { comments.innerHTML = fallback; };if (video_data.params.comments[1] === 'youtube')onNon200 = function (xhr) {};-+helpers.xhr('GET', url, {retries: 5, entity_name: 'comments'}, {on200: function (response) {comments.innerHTML = ' \@@ -304,11 +304,11 @@ function get_youtube_replies(target, load_more, load_replies) {}},onNon200: function (xhr) {- body.innerHTML = fallback;+ body.innerHTML = fallback;},onTimeout: function (xhr) {console.warn('Pulling comments failed');- body.innerHTML = fallback;+ body.innerHTML = fallback;}});}