forked from midou/invidious
semicolons
This commit is contained in:
parent
eb7e48b059
commit
c72d3c4a0e
@ -6,7 +6,7 @@ String.prototype.supplant = function (o) {
|
||||
var r = o[b];
|
||||
return typeof r === 'string' || typeof r === 'number' ? r : a;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function hide_youtube_replies(event) {
|
||||
var target = event.target;
|
||||
@ -93,12 +93,12 @@ function get_youtube_replies(target, load_more) {
|
||||
body.innerHTML = fallback;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
xhr.ontimeout = function () {
|
||||
console.log('Pulling comments failed.');
|
||||
body.innerHTML = fallback;
|
||||
}
|
||||
};
|
||||
|
||||
xhr.send();
|
||||
}
|
||||
|
@ -58,17 +58,17 @@ function get_playlist(plid, retries) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
xhr.onerror = function () {
|
||||
console.log('Pulling playlist failed... ' + retries + '/5');
|
||||
setTimeout(function () { get_playlist(plid, retries - 1) }, 1000);
|
||||
}
|
||||
setTimeout(function () { get_playlist(plid, retries - 1); }, 1000);
|
||||
};
|
||||
|
||||
xhr.ontimeout = function () {
|
||||
console.log('Pulling playlist failed... ' + retries + '/5');
|
||||
get_playlist(plid, retries - 1);
|
||||
}
|
||||
};
|
||||
|
||||
xhr.send();
|
||||
}
|
||||
@ -97,7 +97,7 @@ window.addEventListener('load', function (e) {
|
||||
}
|
||||
|
||||
if (video_data.video_series.length !== 0) {
|
||||
url.searchParams.set('playlist', video_data.video_series.join(','))
|
||||
url.searchParams.set('playlist', video_data.video_series.join(','));
|
||||
}
|
||||
|
||||
location.assign(url.pathname + url.search);
|
||||
|
@ -76,7 +76,7 @@
|
||||
});
|
||||
|
||||
n2a(document.querySelectorAll('[data-onrange="update_volume_value"]')).forEach(function (e) {
|
||||
var cb = function () { update_volume_value(e); }
|
||||
var cb = function () { update_volume_value(e); };
|
||||
e.oninput = cb;
|
||||
e.onchange = cb;
|
||||
});
|
||||
@ -108,7 +108,7 @@
|
||||
row.style.display = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var csrf_token = target.parentNode.querySelector('input[name="csrf_token"]').value;
|
||||
xhr.send('csrf_token=' + csrf_token);
|
||||
@ -137,7 +137,7 @@
|
||||
row.style.display = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var csrf_token = target.parentNode.querySelector('input[name="csrf_token"]').value;
|
||||
xhr.send('csrf_token=' + csrf_token);
|
||||
|
@ -22,17 +22,17 @@ function get_subscriptions(callback, retries) {
|
||||
callback(subscriptions);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
xhr.onerror = function () {
|
||||
console.log('Pulling subscriptions failed... ' + retries + '/5');
|
||||
setTimeout(function () { get_subscriptions(callback, retries - 1) }, 1000);
|
||||
}
|
||||
setTimeout(function () { get_subscriptions(callback, retries - 1); }, 1000);
|
||||
};
|
||||
|
||||
xhr.ontimeout = function () {
|
||||
console.log('Pulling subscriptions failed... ' + retries + '/5');
|
||||
get_subscriptions(callback, retries - 1);
|
||||
}
|
||||
};
|
||||
|
||||
xhr.send();
|
||||
}
|
||||
@ -41,7 +41,7 @@ function create_notification_stream(subscriptions) {
|
||||
notifications = new SSE(
|
||||
'/api/v1/auth/notifications?fields=videoId,title,author,authorId,publishedText,published,authorThumbnails,liveNow', {
|
||||
withCredentials: true,
|
||||
payload: 'topics=' + subscriptions.map(function (subscription) { return subscription.authorId }).join(','),
|
||||
payload: 'topics=' + subscriptions.map(function (subscription) { return subscription.authorId; }).join(','),
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
|
||||
});
|
||||
delivered = [];
|
||||
@ -68,7 +68,7 @@ function create_notification_stream(subscriptions) {
|
||||
|
||||
system_notification.onclick = function (event) {
|
||||
window.open('/watch?v=' + event.currentTarget.tag, '_blank');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
delivered.push(notification.videoId);
|
||||
@ -83,7 +83,7 @@ function create_notification_stream(subscriptions) {
|
||||
'<i class="icon ion-ios-notifications-outline"></i>';
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
notifications.addEventListener('error', handle_notification_error);
|
||||
notifications.stream();
|
||||
@ -92,7 +92,7 @@ function create_notification_stream(subscriptions) {
|
||||
function handle_notification_error(event) {
|
||||
console.log('Something went wrong with notifications, trying to reconnect...');
|
||||
notifications = { close: function () { } };
|
||||
setTimeout(function () { get_subscriptions(create_notification_stream) }, 1000);
|
||||
setTimeout(function () { get_subscriptions(create_notification_stream); }, 1000);
|
||||
}
|
||||
|
||||
window.addEventListener('load', function (e) {
|
||||
|
@ -28,7 +28,7 @@ var options = {
|
||||
overrideNative: true
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (player_data.aspect_ratio) {
|
||||
options.aspectRatio = player_data.aspect_ratio;
|
||||
@ -147,7 +147,7 @@ if (isMobile()) {
|
||||
|
||||
buttons = ["playToggle", "volumePanel", "captionsButton"];
|
||||
|
||||
if (video_data.params.quality !== 'dash') buttons.push("qualitySelector")
|
||||
if (video_data.params.quality !== 'dash') buttons.push("qualitySelector");
|
||||
|
||||
// Create new control bar object for operation buttons
|
||||
const ControlBar = videojs.getComponent("controlBar");
|
||||
@ -155,35 +155,35 @@ if (isMobile()) {
|
||||
children: [],
|
||||
playbackRates: [0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0]
|
||||
});
|
||||
buttons.slice(1).forEach(child => operations_bar.addChild(child))
|
||||
buttons.slice(1).forEach(child => operations_bar.addChild(child));
|
||||
|
||||
// Remove operation buttons from primary control bar
|
||||
primary_control_bar = player.getChild("controlBar");
|
||||
buttons.forEach(child => primary_control_bar.removeChild(child));
|
||||
|
||||
operations_bar_element = operations_bar.el();
|
||||
operations_bar_element.className += " mobile-operations-bar"
|
||||
player.addChild(operations_bar)
|
||||
operations_bar_element.className += " mobile-operations-bar";
|
||||
player.addChild(operations_bar);
|
||||
|
||||
// Playback menu doesn't work when it's initialized outside of the primary control bar
|
||||
playback_element = document.getElementsByClassName("vjs-playback-rate")[0]
|
||||
operations_bar_element.append(playback_element)
|
||||
playback_element = document.getElementsByClassName("vjs-playback-rate")[0];
|
||||
operations_bar_element.append(playback_element);
|
||||
|
||||
// The share and http source selector element can't be fetched till the players ready.
|
||||
player.one("playing", () => {
|
||||
share_element = document.getElementsByClassName("vjs-share-control")[0]
|
||||
operations_bar_element.append(share_element)
|
||||
share_element = document.getElementsByClassName("vjs-share-control")[0];
|
||||
operations_bar_element.append(share_element);
|
||||
|
||||
if (video_data.params.quality === 'dash') {
|
||||
http_source_selector = document.getElementsByClassName("vjs-http-source-selector vjs-menu-button")[0]
|
||||
operations_bar_element.append(http_source_selector)
|
||||
http_source_selector = document.getElementsByClassName("vjs-http-source-selector vjs-menu-button")[0];
|
||||
operations_bar_element.append(http_source_selector);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
// Enable VR video support
|
||||
if (!video_data.params.listen && video_data.vr && video_data.params.vr_mode) {
|
||||
player.crossOrigin("anonymous")
|
||||
player.crossOrigin("anonymous");
|
||||
switch (video_data.projection_type) {
|
||||
case "EQUIRECTANGULAR":
|
||||
player.vr({projection: "equirectangular"});
|
||||
@ -280,7 +280,7 @@ player.on('volumechange', function () {
|
||||
|
||||
player.on('waiting', function () {
|
||||
if (player.playbackRate() > 1 && player.liveTracker.isLive() && player.liveTracker.atLiveEdge()) {
|
||||
console.log('Player has caught up to source, resetting playbackRate.')
|
||||
console.log('Player has caught up to source, resetting playbackRate.');
|
||||
player.playbackRate(1);
|
||||
}
|
||||
});
|
||||
@ -767,12 +767,12 @@ if (window.location.pathname.startsWith("/embed/")) {
|
||||
|
||||
// Create hyperlink for current instance
|
||||
redirect_element = document.createElement("a");
|
||||
redirect_element.setAttribute("href", `//${window.location.host}/watch?v=${window.location.pathname.replace("/embed/","")}`)
|
||||
redirect_element.appendChild(document.createTextNode("Invidious"))
|
||||
redirect_element.setAttribute("href", `//${window.location.host}/watch?v=${window.location.pathname.replace("/embed/","")}`);
|
||||
redirect_element.appendChild(document.createTextNode("Invidious"));
|
||||
|
||||
watch_on_invidious_button.el().appendChild(redirect_element)
|
||||
watch_on_invidious_button.addClass("watch-on-invidious")
|
||||
watch_on_invidious_button.el().appendChild(redirect_element);
|
||||
watch_on_invidious_button.addClass("watch-on-invidious");
|
||||
|
||||
cb = player.getChild('ControlBar')
|
||||
cb.addChild(watch_on_invidious_button)
|
||||
};
|
||||
cb = player.getChild('ControlBar');
|
||||
cb.addChild(watch_on_invidious_button);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ function add_playlist_video(target) {
|
||||
option.innerText = '✓' + option.innerText;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
xhr.send('csrf_token=' + playlist_data.csrf_token);
|
||||
}
|
||||
@ -44,7 +44,7 @@ function add_playlist_item(target) {
|
||||
tile.style.display = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
xhr.send('csrf_token=' + playlist_data.csrf_token);
|
||||
}
|
||||
@ -68,7 +68,7 @@ function remove_playlist_item(target) {
|
||||
tile.style.display = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
xhr.send('csrf_token=' + playlist_data.csrf_token);
|
||||
}
|
@ -35,17 +35,17 @@ function subscribe(retries = 5) {
|
||||
subscribe_button.innerHTML = fallback;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
xhr.onerror = function () {
|
||||
console.log('Subscribing failed... ' + retries + '/5');
|
||||
setTimeout(function () { subscribe(retries - 1) }, 1000);
|
||||
}
|
||||
setTimeout(function () { subscribe(retries - 1); }, 1000);
|
||||
};
|
||||
|
||||
xhr.ontimeout = function () {
|
||||
console.log('Subscribing failed... ' + retries + '/5');
|
||||
subscribe(retries - 1);
|
||||
}
|
||||
};
|
||||
|
||||
xhr.send('csrf_token=' + subscribe_data.csrf_token);
|
||||
}
|
||||
@ -75,17 +75,17 @@ function unsubscribe(retries = 5) {
|
||||
subscribe_button.innerHTML = fallback;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
xhr.onerror = function () {
|
||||
console.log('Unsubscribing failed... ' + retries + '/5');
|
||||
setTimeout(function () { unsubscribe(retries - 1) }, 1000);
|
||||
}
|
||||
setTimeout(function () { unsubscribe(retries - 1); }, 1000);
|
||||
};
|
||||
|
||||
xhr.ontimeout = function () {
|
||||
console.log('Unsubscribing failed... ' + retries + '/5');
|
||||
unsubscribe(retries - 1);
|
||||
}
|
||||
};
|
||||
|
||||
xhr.send('csrf_token=' + subscribe_data.csrf_token);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ String.prototype.supplant = function (o) {
|
||||
var r = o[b];
|
||||
return typeof r === 'string' || typeof r === 'number' ? r : a;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function toggle_parent(target) {
|
||||
body = target.parentNode.parentNode.children[1];
|
||||
@ -128,7 +128,7 @@ function get_playlist(plid, retries) {
|
||||
|
||||
playlist.innerHTML = ' \
|
||||
<h3 style="text-align:center"><div class="loading"><i class="icon ion-ios-refresh"></i></div></h3> \
|
||||
<hr>'
|
||||
<hr>';
|
||||
|
||||
if (plid.startsWith('RD')) {
|
||||
var plid_url = '/api/v1/mixes/' + plid +
|
||||
@ -186,7 +186,7 @@ function get_playlist(plid, retries) {
|
||||
document.getElementById('continue').style.display = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
xhr.onerror = function () {
|
||||
playlist = document.getElementById('playlist');
|
||||
@ -194,8 +194,8 @@ function get_playlist(plid, retries) {
|
||||
'<h3 style="text-align:center"><div class="loading"><i class="icon ion-ios-refresh"></i></div></h3><hr>';
|
||||
|
||||
console.log('Pulling playlist timed out... ' + retries + '/5');
|
||||
setTimeout(function () { get_playlist(plid, retries - 1) }, 1000);
|
||||
}
|
||||
setTimeout(function () { get_playlist(plid, retries - 1); }, 1000);
|
||||
};
|
||||
|
||||
xhr.ontimeout = function () {
|
||||
playlist = document.getElementById('playlist');
|
||||
@ -204,7 +204,7 @@ function get_playlist(plid, retries) {
|
||||
|
||||
console.log('Pulling playlist timed out... ' + retries + '/5');
|
||||
get_playlist(plid, retries - 1);
|
||||
}
|
||||
};
|
||||
|
||||
xhr.send();
|
||||
}
|
||||
@ -265,23 +265,23 @@ function get_reddit_comments(retries) {
|
||||
} else {
|
||||
if (video_data.params.comments[1] === 'youtube') {
|
||||
console.log('Pulling comments failed... ' + retries + '/5');
|
||||
setTimeout(function () { get_youtube_comments(retries - 1) }, 1000);
|
||||
setTimeout(function () { get_youtube_comments(retries - 1); }, 1000);
|
||||
} else {
|
||||
comments.innerHTML = fallback;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
xhr.onerror = function () {
|
||||
console.log('Pulling comments failed... ' + retries + '/5');
|
||||
setTimeout(function () { get_reddit_comments(retries - 1) }, 1000);
|
||||
}
|
||||
setTimeout(function () { get_reddit_comments(retries - 1); }, 1000);
|
||||
};
|
||||
|
||||
xhr.ontimeout = function () {
|
||||
console.log('Pulling comments failed... ' + retries + '/5');
|
||||
get_reddit_comments(retries - 1);
|
||||
}
|
||||
};
|
||||
|
||||
xhr.send();
|
||||
}
|
||||
@ -337,27 +337,27 @@ function get_youtube_comments(retries) {
|
||||
comments.children[0].children[1].children[0].onclick = swap_comments;
|
||||
} else {
|
||||
if (video_data.params.comments[1] === 'youtube') {
|
||||
setTimeout(function () { get_youtube_comments(retries - 1) }, 1000);
|
||||
setTimeout(function () { get_youtube_comments(retries - 1); }, 1000);
|
||||
} else {
|
||||
comments.innerHTML = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
xhr.onerror = function () {
|
||||
comments.innerHTML =
|
||||
'<h3 style="text-align:center"><div class="loading"><i class="icon ion-ios-refresh"></i></div></h3>';
|
||||
console.log('Pulling comments failed... ' + retries + '/5');
|
||||
setTimeout(function () { get_youtube_comments(retries - 1) }, 1000);
|
||||
}
|
||||
setTimeout(function () { get_youtube_comments(retries - 1); }, 1000);
|
||||
};
|
||||
|
||||
xhr.ontimeout = function () {
|
||||
comments.innerHTML =
|
||||
'<h3 style="text-align:center"><div class="loading"><i class="icon ion-ios-refresh"></i></div></h3>';
|
||||
console.log('Pulling comments failed... ' + retries + '/5');
|
||||
get_youtube_comments(retries - 1);
|
||||
}
|
||||
};
|
||||
|
||||
xhr.send();
|
||||
}
|
||||
@ -374,7 +374,7 @@ function get_youtube_replies(target, load_more, load_replies) {
|
||||
'?format=html' +
|
||||
'&hl=' + video_data.preferences.locale +
|
||||
'&thin_mode=' + video_data.preferences.thin_mode +
|
||||
'&continuation=' + continuation
|
||||
'&continuation=' + continuation;
|
||||
if (load_replies) {
|
||||
url += '&action=action_get_comment_replies';
|
||||
}
|
||||
@ -413,12 +413,12 @@ function get_youtube_replies(target, load_more, load_replies) {
|
||||
body.innerHTML = fallback;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
xhr.ontimeout = function () {
|
||||
console.log('Pulling comments failed.');
|
||||
body.innerHTML = fallback;
|
||||
}
|
||||
};
|
||||
|
||||
xhr.send();
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ function mark_watched(target) {
|
||||
tile.style.display = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
xhr.send('csrf_token=' + watched_data.csrf_token);
|
||||
}
|
||||
@ -27,7 +27,7 @@ function mark_watched(target) {
|
||||
function mark_unwatched(target) {
|
||||
var tile = target.parentNode.parentNode.parentNode.parentNode.parentNode;
|
||||
tile.style.display = 'none';
|
||||
var count = document.getElementById('count')
|
||||
var count = document.getElementById('count');
|
||||
count.innerText = count.innerText - 1;
|
||||
|
||||
var url = '/watch_ajax?action_mark_unwatched=1&redirect=false' +
|
||||
@ -45,7 +45,7 @@ function mark_unwatched(target) {
|
||||
tile.style.display = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
xhr.send('csrf_token=' + watched_data.csrf_token);
|
||||
}
|
Loading…
Reference in New Issue
Block a user