add variable declarations

This commit is contained in:
meow 2022-04-20 13:23:24 +03:00
parent 12ab11413f
commit 9b09d369d9
4 changed files with 27 additions and 27 deletions

View file

@ -11,10 +11,10 @@ String.prototype.supplant = function (o) {
function hide_youtube_replies(event) {
var target = event.target;
sub_text = target.getAttribute('data-inner-text');
inner_text = target.getAttribute('data-sub-text');
var sub_text = target.getAttribute('data-inner-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';
target.innerHTML = sub_text;
@ -26,10 +26,10 @@ function hide_youtube_replies(event) {
function show_youtube_replies(event) {
var target = event.target;
sub_text = target.getAttribute('data-inner-text');
inner_text = target.getAttribute('data-sub-text');
var sub_text = target.getAttribute('data-inner-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 = '';
target.innerHTML = sub_text;

View file

@ -18,7 +18,7 @@ function get_subscriptions(callback, retries) {
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
subscriptions = xhr.response;
var subscriptions = xhr.response;
callback(subscriptions);
}
}

View file

@ -145,7 +145,7 @@ function isMobile() {
if (isMobile()) {
player.mobileUi();
buttons = ['playToggle', 'volumePanel', 'captionsButton'];
var buttons = ['playToggle', 'volumePanel', 'captionsButton'];
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);});
// 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);});
operations_bar_element = operations_bar.el();
var operations_bar_element = operations_bar.el();
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];
var 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', function () {
share_element = document.getElementsByClassName('vjs-share-control')[0];
var 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];
var http_source_selector = document.getElementsByClassName('vjs-http-source-selector vjs-menu-button')[0];
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);
// 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.appendChild(document.createTextNode('Invidious'));
watch_on_invidious_button.el().appendChild(redirect_element);
watch_on_invidious_button.addClass('watch-on-invidious');
cb = player.getChild('ControlBar');
var cb = player.getChild('ControlBar');
cb.addChild(watch_on_invidious_button);
}

View file

@ -9,7 +9,7 @@ String.prototype.supplant = function (o) {
};
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 === '') {
target.innerHTML = '[ + ]';
body.style.display = 'none';
@ -21,7 +21,7 @@ function toggle_parent(target) {
function toggle_comments(event) {
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 === '') {
target.innerHTML = '[ + ]';
body.style.display = 'none';
@ -44,10 +44,10 @@ function swap_comments(event) {
function hide_youtube_replies(event) {
var target = event.target;
sub_text = target.getAttribute('data-inner-text');
inner_text = target.getAttribute('data-sub-text');
var sub_text = target.getAttribute('data-inner-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';
target.innerHTML = sub_text;
@ -59,10 +59,10 @@ function hide_youtube_replies(event) {
function show_youtube_replies(event) {
var target = event.target;
sub_text = target.getAttribute('data-inner-text');
inner_text = target.getAttribute('data-sub-text');
var sub_text = target.getAttribute('data-inner-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 = '';
target.innerHTML = sub_text;
@ -118,7 +118,7 @@ function number_with_separator(val) {
function get_playlist(plid, retries) {
if (retries === undefined) retries = 5;
playlist = document.getElementById('playlist');
var playlist = document.getElementById('playlist');
if (retries <= 0) {
console.log('Failed to pull playlist');
@ -212,7 +212,7 @@ function get_playlist(plid, retries) {
function get_reddit_comments(retries) {
if (retries === undefined) retries = 5;
comments = document.getElementById('comments');
var comments = document.getElementById('comments');
if (retries <= 0) {
console.log('Failed to pull comments');
@ -289,7 +289,7 @@ function get_reddit_comments(retries) {
function get_youtube_comments(retries) {
if (retries === undefined) retries = 5;
comments = document.getElementById('comments');
var comments = document.getElementById('comments');
if (retries <= 0) {
console.log('Failed to pull comments');
@ -463,7 +463,7 @@ window.addEventListener('load', function (e) {
} else if (video_data.params.comments[1] === 'reddit') {
get_reddit_comments();
} else {
comments = document.getElementById('comments');
var comments = document.getElementById('comments');
comments.innerHTML = '';
}
});