JS. Trailing spaces removed
This commit is contained in:
parent
f2f3f045e5
commit
d3ab4a5145
|
@ -164,7 +164,7 @@ window.helpers = window.helpers || {
|
||||||
helpers._xhrRetry(method, url, options, callbacks);
|
helpers._xhrRetry(method, url, options, callbacks);
|
||||||
}, options.retry_timeout);
|
}, options.retry_timeout);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Pack retry() call into error handlers
|
// Pack retry() call into error handlers
|
||||||
callbacks._onError = callbacks.onError;
|
callbacks._onError = callbacks.onError;
|
||||||
callbacks.onError = function (xhr) {
|
callbacks.onError = function (xhr) {
|
||||||
|
|
|
@ -38,7 +38,7 @@ function get_youtube_replies(target, load_more) {
|
||||||
var fallback = body.innerHTML;
|
var fallback = body.innerHTML;
|
||||||
body.innerHTML =
|
body.innerHTML =
|
||||||
'<h3 style="text-align:center"><div class="loading"><i class="icon ion-ios-refresh"></i></div></h3>';
|
'<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 +
|
var url = '/api/v1/channels/comments/' + community_data.ucid +
|
||||||
'?format=html' +
|
'?format=html' +
|
||||||
'&hl=' + community_data.preferences.locale +
|
'&hl=' + community_data.preferences.locale +
|
||||||
|
|
|
@ -52,13 +52,13 @@ function create_notification_stream(subscriptions) {
|
||||||
if (window.Notification && Notification.permission === 'granted') {
|
if (window.Notification && Notification.permission === 'granted') {
|
||||||
var notification_text = notification.liveNow ? notification_data.live_now_text : notification_data.upload_text;
|
var notification_text = notification.liveNow ? notification_data.live_now_text : notification_data.upload_text;
|
||||||
notification_text = notification_text.replace('`x`', notification.author);
|
notification_text = notification_text.replace('`x`', notification.author);
|
||||||
|
|
||||||
var system_notification = new Notification(notification_text, {
|
var system_notification = new Notification(notification_text, {
|
||||||
body: notification.title,
|
body: notification.title,
|
||||||
icon: '/ggpht' + new URL(notification.authorThumbnails[2].url).pathname,
|
icon: '/ggpht' + new URL(notification.authorThumbnails[2].url).pathname,
|
||||||
img: '/ggpht' + new URL(notification.authorThumbnails[4].url).pathname
|
img: '/ggpht' + new URL(notification.authorThumbnails[4].url).pathname
|
||||||
});
|
});
|
||||||
|
|
||||||
system_notification.onclick = function (e) {
|
system_notification.onclick = function (e) {
|
||||||
open('/watch?v=' + notification.videoId, '_blank');
|
open('/watch?v=' + notification.videoId, '_blank');
|
||||||
};
|
};
|
||||||
|
|
|
@ -54,12 +54,12 @@ var player = videojs('player', options);
|
||||||
|
|
||||||
player.on('error', function () {
|
player.on('error', function () {
|
||||||
if (video_data.params.quality === 'dash') return;
|
if (video_data.params.quality === 'dash') return;
|
||||||
|
|
||||||
var localNotDisabled = (
|
var localNotDisabled = (
|
||||||
!player.currentSrc().includes('local=true') && !video_data.local_disabled
|
!player.currentSrc().includes('local=true') && !video_data.local_disabled
|
||||||
);
|
);
|
||||||
var reloadMakesSense = (
|
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
|
player.error().code === MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -465,7 +465,7 @@ function toggle_play() { player.paused() ? play() : pause(); }
|
||||||
|
|
||||||
const toggle_captions = (function () {
|
const toggle_captions = (function () {
|
||||||
let toggledTrack = null;
|
let toggledTrack = null;
|
||||||
|
|
||||||
function bindChange(onOrOff) {
|
function bindChange(onOrOff) {
|
||||||
player.textTracks()[onOrOff]('change', function (e) {
|
player.textTracks()[onOrOff]('change', function (e) {
|
||||||
toggledTrack = null;
|
toggledTrack = null;
|
||||||
|
@ -481,7 +481,7 @@ const toggle_captions = (function () {
|
||||||
bindChange('on');
|
bindChange('on');
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bindChange('on');
|
bindChange('on');
|
||||||
return function () {
|
return function () {
|
||||||
if (toggledTrack !== null) {
|
if (toggledTrack !== null) {
|
||||||
|
|
|
@ -172,7 +172,7 @@ function get_reddit_comments() {
|
||||||
var onNon200 = function (xhr) { comments.innerHTML = fallback; };
|
var onNon200 = function (xhr) { comments.innerHTML = fallback; };
|
||||||
if (video_data.params.comments[1] === 'youtube')
|
if (video_data.params.comments[1] === 'youtube')
|
||||||
onNon200 = function (xhr) {};
|
onNon200 = function (xhr) {};
|
||||||
|
|
||||||
helpers.xhr('GET', url, {retries: 5, entity_name: ''}, {
|
helpers.xhr('GET', url, {retries: 5, entity_name: ''}, {
|
||||||
on200: function (response) {
|
on200: function (response) {
|
||||||
comments.innerHTML = ' \
|
comments.innerHTML = ' \
|
||||||
|
@ -218,11 +218,11 @@ function get_youtube_comments() {
|
||||||
'?format=html' +
|
'?format=html' +
|
||||||
'&hl=' + video_data.preferences.locale +
|
'&hl=' + video_data.preferences.locale +
|
||||||
'&thin_mode=' + video_data.preferences.thin_mode;
|
'&thin_mode=' + video_data.preferences.thin_mode;
|
||||||
|
|
||||||
var onNon200 = function (xhr) { comments.innerHTML = fallback; };
|
var onNon200 = function (xhr) { comments.innerHTML = fallback; };
|
||||||
if (video_data.params.comments[1] === 'youtube')
|
if (video_data.params.comments[1] === 'youtube')
|
||||||
onNon200 = function (xhr) {};
|
onNon200 = function (xhr) {};
|
||||||
|
|
||||||
helpers.xhr('GET', url, {retries: 5, entity_name: 'comments'}, {
|
helpers.xhr('GET', url, {retries: 5, entity_name: 'comments'}, {
|
||||||
on200: function (response) {
|
on200: function (response) {
|
||||||
comments.innerHTML = ' \
|
comments.innerHTML = ' \
|
||||||
|
@ -304,11 +304,11 @@ function get_youtube_replies(target, load_more, load_replies) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onNon200: function (xhr) {
|
onNon200: function (xhr) {
|
||||||
body.innerHTML = fallback;
|
body.innerHTML = fallback;
|
||||||
},
|
},
|
||||||
onTimeout: function (xhr) {
|
onTimeout: function (xhr) {
|
||||||
console.warn('Pulling comments failed');
|
console.warn('Pulling comments failed');
|
||||||
body.innerHTML = fallback;
|
body.innerHTML = fallback;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue