forked from midou/invidious
add variable declarations
This commit is contained in:
parent
12ab11413f
commit
9b09d369d9
@ -11,10 +11,10 @@ String.prototype.supplant = function (o) {
|
|||||||
function hide_youtube_replies(event) {
|
function hide_youtube_replies(event) {
|
||||||
var target = event.target;
|
var target = event.target;
|
||||||
|
|
||||||
sub_text = target.getAttribute('data-inner-text');
|
var sub_text = target.getAttribute('data-inner-text');
|
||||||
inner_text = target.getAttribute('data-sub-text');
|
var inner_text = target.getAttribute('data-sub-text');
|
||||||
|
|
||||||
body = target.parentNode.parentNode.children[1];
|
var body = target.parentNode.parentNode.children[1];
|
||||||
body.style.display = 'none';
|
body.style.display = 'none';
|
||||||
|
|
||||||
target.innerHTML = sub_text;
|
target.innerHTML = sub_text;
|
||||||
@ -26,10 +26,10 @@ function hide_youtube_replies(event) {
|
|||||||
function show_youtube_replies(event) {
|
function show_youtube_replies(event) {
|
||||||
var target = event.target;
|
var target = event.target;
|
||||||
|
|
||||||
sub_text = target.getAttribute('data-inner-text');
|
var sub_text = target.getAttribute('data-inner-text');
|
||||||
inner_text = target.getAttribute('data-sub-text');
|
var inner_text = target.getAttribute('data-sub-text');
|
||||||
|
|
||||||
body = target.parentNode.parentNode.children[1];
|
var body = target.parentNode.parentNode.children[1];
|
||||||
body.style.display = '';
|
body.style.display = '';
|
||||||
|
|
||||||
target.innerHTML = sub_text;
|
target.innerHTML = sub_text;
|
||||||
|
@ -18,7 +18,7 @@ function get_subscriptions(callback, retries) {
|
|||||||
xhr.onreadystatechange = function () {
|
xhr.onreadystatechange = function () {
|
||||||
if (xhr.readyState === 4) {
|
if (xhr.readyState === 4) {
|
||||||
if (xhr.status === 200) {
|
if (xhr.status === 200) {
|
||||||
subscriptions = xhr.response;
|
var subscriptions = xhr.response;
|
||||||
callback(subscriptions);
|
callback(subscriptions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ function isMobile() {
|
|||||||
if (isMobile()) {
|
if (isMobile()) {
|
||||||
player.mobileUi();
|
player.mobileUi();
|
||||||
|
|
||||||
buttons = ['playToggle', 'volumePanel', 'captionsButton'];
|
var buttons = ['playToggle', 'volumePanel', 'captionsButton'];
|
||||||
|
|
||||||
if (video_data.params.quality !== 'dash') buttons.push('qualitySelector');
|
if (video_data.params.quality !== 'dash') buttons.push('qualitySelector');
|
||||||
|
|
||||||
@ -158,24 +158,24 @@ if (isMobile()) {
|
|||||||
buttons.slice(1).forEach(function (child) {operations_bar.addChild(child);});
|
buttons.slice(1).forEach(function (child) {operations_bar.addChild(child);});
|
||||||
|
|
||||||
// Remove operation buttons from primary control bar
|
// Remove operation buttons from primary control bar
|
||||||
primary_control_bar = player.getChild('controlBar');
|
var primary_control_bar = player.getChild('controlBar');
|
||||||
buttons.forEach(function (child) {primary_control_bar.removeChild(child);});
|
buttons.forEach(function (child) {primary_control_bar.removeChild(child);});
|
||||||
|
|
||||||
operations_bar_element = operations_bar.el();
|
var operations_bar_element = operations_bar.el();
|
||||||
operations_bar_element.className += ' mobile-operations-bar';
|
operations_bar_element.className += ' mobile-operations-bar';
|
||||||
player.addChild(operations_bar);
|
player.addChild(operations_bar);
|
||||||
|
|
||||||
// Playback menu doesn't work when it's initialized outside of the primary control bar
|
// Playback menu doesn't work when it's initialized outside of the primary control bar
|
||||||
playback_element = document.getElementsByClassName('vjs-playback-rate')[0];
|
var playback_element = document.getElementsByClassName('vjs-playback-rate')[0];
|
||||||
operations_bar_element.append(playback_element);
|
operations_bar_element.append(playback_element);
|
||||||
|
|
||||||
// The share and http source selector element can't be fetched till the players ready.
|
// The share and http source selector element can't be fetched till the players ready.
|
||||||
player.one('playing', function () {
|
player.one('playing', function () {
|
||||||
share_element = document.getElementsByClassName('vjs-share-control')[0];
|
var share_element = document.getElementsByClassName('vjs-share-control')[0];
|
||||||
operations_bar_element.append(share_element);
|
operations_bar_element.append(share_element);
|
||||||
|
|
||||||
if (video_data.params.quality === 'dash') {
|
if (video_data.params.quality === 'dash') {
|
||||||
http_source_selector = document.getElementsByClassName('vjs-http-source-selector vjs-menu-button')[0];
|
var http_source_selector = document.getElementsByClassName('vjs-http-source-selector vjs-menu-button')[0];
|
||||||
operations_bar_element.append(http_source_selector);
|
operations_bar_element.append(http_source_selector);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -766,13 +766,13 @@ if (window.location.pathname.startsWith('/embed/')) {
|
|||||||
let watch_on_invidious_button = new Button(player);
|
let watch_on_invidious_button = new Button(player);
|
||||||
|
|
||||||
// Create hyperlink for current instance
|
// Create hyperlink for current instance
|
||||||
redirect_element = document.createElement('a');
|
var redirect_element = document.createElement('a');
|
||||||
redirect_element.setAttribute('href', location.pathname.replace('/embed/', '/watch?v='));
|
redirect_element.setAttribute('href', location.pathname.replace('/embed/', '/watch?v='));
|
||||||
redirect_element.appendChild(document.createTextNode('Invidious'));
|
redirect_element.appendChild(document.createTextNode('Invidious'));
|
||||||
|
|
||||||
watch_on_invidious_button.el().appendChild(redirect_element);
|
watch_on_invidious_button.el().appendChild(redirect_element);
|
||||||
watch_on_invidious_button.addClass('watch-on-invidious');
|
watch_on_invidious_button.addClass('watch-on-invidious');
|
||||||
|
|
||||||
cb = player.getChild('ControlBar');
|
var cb = player.getChild('ControlBar');
|
||||||
cb.addChild(watch_on_invidious_button);
|
cb.addChild(watch_on_invidious_button);
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ String.prototype.supplant = function (o) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function toggle_parent(target) {
|
function toggle_parent(target) {
|
||||||
body = target.parentNode.parentNode.children[1];
|
var body = target.parentNode.parentNode.children[1];
|
||||||
if (body.style.display === null || body.style.display === '') {
|
if (body.style.display === null || body.style.display === '') {
|
||||||
target.innerHTML = '[ + ]';
|
target.innerHTML = '[ + ]';
|
||||||
body.style.display = 'none';
|
body.style.display = 'none';
|
||||||
@ -21,7 +21,7 @@ function toggle_parent(target) {
|
|||||||
|
|
||||||
function toggle_comments(event) {
|
function toggle_comments(event) {
|
||||||
var target = event.target;
|
var target = event.target;
|
||||||
body = target.parentNode.parentNode.parentNode.children[1];
|
var body = target.parentNode.parentNode.parentNode.children[1];
|
||||||
if (body.style.display === null || body.style.display === '') {
|
if (body.style.display === null || body.style.display === '') {
|
||||||
target.innerHTML = '[ + ]';
|
target.innerHTML = '[ + ]';
|
||||||
body.style.display = 'none';
|
body.style.display = 'none';
|
||||||
@ -44,10 +44,10 @@ function swap_comments(event) {
|
|||||||
function hide_youtube_replies(event) {
|
function hide_youtube_replies(event) {
|
||||||
var target = event.target;
|
var target = event.target;
|
||||||
|
|
||||||
sub_text = target.getAttribute('data-inner-text');
|
var sub_text = target.getAttribute('data-inner-text');
|
||||||
inner_text = target.getAttribute('data-sub-text');
|
var inner_text = target.getAttribute('data-sub-text');
|
||||||
|
|
||||||
body = target.parentNode.parentNode.children[1];
|
var body = target.parentNode.parentNode.children[1];
|
||||||
body.style.display = 'none';
|
body.style.display = 'none';
|
||||||
|
|
||||||
target.innerHTML = sub_text;
|
target.innerHTML = sub_text;
|
||||||
@ -59,10 +59,10 @@ function hide_youtube_replies(event) {
|
|||||||
function show_youtube_replies(event) {
|
function show_youtube_replies(event) {
|
||||||
var target = event.target;
|
var target = event.target;
|
||||||
|
|
||||||
sub_text = target.getAttribute('data-inner-text');
|
var sub_text = target.getAttribute('data-inner-text');
|
||||||
inner_text = target.getAttribute('data-sub-text');
|
var inner_text = target.getAttribute('data-sub-text');
|
||||||
|
|
||||||
body = target.parentNode.parentNode.children[1];
|
var body = target.parentNode.parentNode.children[1];
|
||||||
body.style.display = '';
|
body.style.display = '';
|
||||||
|
|
||||||
target.innerHTML = sub_text;
|
target.innerHTML = sub_text;
|
||||||
@ -118,7 +118,7 @@ function number_with_separator(val) {
|
|||||||
|
|
||||||
function get_playlist(plid, retries) {
|
function get_playlist(plid, retries) {
|
||||||
if (retries === undefined) retries = 5;
|
if (retries === undefined) retries = 5;
|
||||||
playlist = document.getElementById('playlist');
|
var playlist = document.getElementById('playlist');
|
||||||
|
|
||||||
if (retries <= 0) {
|
if (retries <= 0) {
|
||||||
console.log('Failed to pull playlist');
|
console.log('Failed to pull playlist');
|
||||||
@ -212,7 +212,7 @@ function get_playlist(plid, retries) {
|
|||||||
|
|
||||||
function get_reddit_comments(retries) {
|
function get_reddit_comments(retries) {
|
||||||
if (retries === undefined) retries = 5;
|
if (retries === undefined) retries = 5;
|
||||||
comments = document.getElementById('comments');
|
var comments = document.getElementById('comments');
|
||||||
|
|
||||||
if (retries <= 0) {
|
if (retries <= 0) {
|
||||||
console.log('Failed to pull comments');
|
console.log('Failed to pull comments');
|
||||||
@ -289,7 +289,7 @@ function get_reddit_comments(retries) {
|
|||||||
|
|
||||||
function get_youtube_comments(retries) {
|
function get_youtube_comments(retries) {
|
||||||
if (retries === undefined) retries = 5;
|
if (retries === undefined) retries = 5;
|
||||||
comments = document.getElementById('comments');
|
var comments = document.getElementById('comments');
|
||||||
|
|
||||||
if (retries <= 0) {
|
if (retries <= 0) {
|
||||||
console.log('Failed to pull comments');
|
console.log('Failed to pull comments');
|
||||||
@ -463,7 +463,7 @@ window.addEventListener('load', function (e) {
|
|||||||
} else if (video_data.params.comments[1] === 'reddit') {
|
} else if (video_data.params.comments[1] === 'reddit') {
|
||||||
get_reddit_comments();
|
get_reddit_comments();
|
||||||
} else {
|
} else {
|
||||||
comments = document.getElementById('comments');
|
var comments = document.getElementById('comments');
|
||||||
comments.innerHTML = '';
|
comments.innerHTML = '';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user