From 9b09d369d90006df847119eb42b9eabd877d0e7b Mon Sep 17 00:00:00 2001 From: meow Date: Wed, 20 Apr 2022 13:23:24 +0300 Subject: [PATCH] add variable declarations --- assets/js/community.js | 12 ++++++------ assets/js/notifications.js | 2 +- assets/js/player.js | 16 ++++++++-------- assets/js/watch.js | 24 ++++++++++++------------ 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/assets/js/community.js b/assets/js/community.js index eebaf5d8..0f1d5d9c 100644 --- a/assets/js/community.js +++ b/assets/js/community.js @@ -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; diff --git a/assets/js/notifications.js b/assets/js/notifications.js index 1235fb41..d7732fb9 100644 --- a/assets/js/notifications.js +++ b/assets/js/notifications.js @@ -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); } } diff --git a/assets/js/player.js b/assets/js/player.js index e0c9829e..315fb618 100644 --- a/assets/js/player.js +++ b/assets/js/player.js @@ -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); } diff --git a/assets/js/watch.js b/assets/js/watch.js index 1066653c..e435bc7e 100644 --- a/assets/js/watch.js +++ b/assets/js/watch.js @@ -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 = ''; } });