From eb7e48b05999b29670a2de80e6f53bd8b4fd8d15 Mon Sep 17 00:00:00 2001 From: meow Date: Wed, 20 Apr 2022 11:38:24 +0300 Subject: use strict --- assets/js/notifications.js | 1 + 1 file changed, 1 insertion(+) (limited to 'assets/js/notifications.js') diff --git a/assets/js/notifications.js b/assets/js/notifications.js index 3d1ec1ed..68ea1e15 100644 --- a/assets/js/notifications.js +++ b/assets/js/notifications.js @@ -1,3 +1,4 @@ +'use strict'; var notification_data = JSON.parse(document.getElementById('notification_data').innerHTML); var notifications, delivered; -- cgit v1.2.3 From c72d3c4a0ea9329fa455d5c066aff598c307d04d Mon Sep 17 00:00:00 2001 From: meow Date: Wed, 20 Apr 2022 12:05:19 +0300 Subject: semicolons --- assets/js/community.js | 6 +++--- assets/js/embed.js | 10 +++++----- assets/js/handlers.js | 6 +++--- assets/js/notifications.js | 16 ++++++++-------- assets/js/player.js | 42 +++++++++++++++++++++--------------------- assets/js/playlist_widget.js | 6 +++--- assets/js/subscribe_widget.js | 16 ++++++++-------- assets/js/watch.js | 38 +++++++++++++++++++------------------- assets/js/watched_widget.js | 6 +++--- 9 files changed, 73 insertions(+), 73 deletions(-) (limited to 'assets/js/notifications.js') diff --git a/assets/js/community.js b/assets/js/community.js index 2e7a1f6d..5bc1ee2e 100644 --- a/assets/js/community.js +++ b/assets/js/community.js @@ -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(); } diff --git a/assets/js/embed.js b/assets/js/embed.js index 7d66c8c4..11d94060 100644 --- a/assets/js/embed.js +++ b/assets/js/embed.js @@ -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); diff --git a/assets/js/handlers.js b/assets/js/handlers.js index 02175957..84e1d7c2 100644 --- a/assets/js/handlers.js +++ b/assets/js/handlers.js @@ -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); diff --git a/assets/js/notifications.js b/assets/js/notifications.js index 68ea1e15..9c77895b 100644 --- a/assets/js/notifications.js +++ b/assets/js/notifications.js @@ -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) { ''; } } - } + }; 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) { diff --git a/assets/js/player.js b/assets/js/player.js index 496cdfd0..a0cef29e 100644 --- a/assets/js/player.js +++ b/assets/js/player.js @@ -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); +} diff --git a/assets/js/playlist_widget.js b/assets/js/playlist_widget.js index 971f3806..0cf721a1 100644 --- a/assets/js/playlist_widget.js +++ b/assets/js/playlist_widget.js @@ -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); } \ No newline at end of file diff --git a/assets/js/subscribe_widget.js b/assets/js/subscribe_widget.js index bb6c7556..bdd5d581 100644 --- a/assets/js/subscribe_widget.js +++ b/assets/js/subscribe_widget.js @@ -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); } diff --git a/assets/js/watch.js b/assets/js/watch.js index 43df0561..578d4ac0 100644 --- a/assets/js/watch.js +++ b/assets/js/watch.js @@ -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 = ' \

\ -
' +
'; 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) { '


'; 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 = '

'; 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 = '

'; 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(); } diff --git a/assets/js/watched_widget.js b/assets/js/watched_widget.js index 372cbbab..22afb054 100644 --- a/assets/js/watched_widget.js +++ b/assets/js/watched_widget.js @@ -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); } \ No newline at end of file -- cgit v1.2.3 From 38ef0b10e79232de1c6fa2062d9983e4a944f6be Mon Sep 17 00:00:00 2001 From: meow Date: Wed, 20 Apr 2022 12:13:16 +0300 Subject: eqeqeq --- assets/js/community.js | 4 ++-- assets/js/embed.js | 2 +- assets/js/handlers.js | 10 +++++----- assets/js/notifications.js | 2 +- assets/js/player.js | 22 +++++++++++----------- assets/js/playlist_widget.js | 12 ++++++------ assets/js/subscribe_widget.js | 8 ++++---- assets/js/watch.js | 22 +++++++++++----------- assets/js/watched_widget.js | 8 ++++---- 9 files changed, 45 insertions(+), 45 deletions(-) (limited to 'assets/js/notifications.js') diff --git a/assets/js/community.js b/assets/js/community.js index 5bc1ee2e..eebaf5d8 100644 --- a/assets/js/community.js +++ b/assets/js/community.js @@ -64,8 +64,8 @@ function get_youtube_replies(target, load_more) { xhr.open('GET', url, true); xhr.onreadystatechange = function () { - if (xhr.readyState == 4) { - if (xhr.status == 200) { + if (xhr.readyState === 4) { + if (xhr.status === 200) { if (load_more) { body = body.parentNode.parentNode; body.removeChild(body.lastElementChild); diff --git a/assets/js/embed.js b/assets/js/embed.js index 11d94060..d3c530cb 100644 --- a/assets/js/embed.js +++ b/assets/js/embed.js @@ -2,7 +2,7 @@ var video_data = JSON.parse(document.getElementById('video_data').innerHTML); function get_playlist(plid, retries) { - if (retries == undefined) retries = 5; + if (retries === undefined) retries = 5; if (retries <= 0) { console.log('Failed to pull playlist'); diff --git a/assets/js/handlers.js b/assets/js/handlers.js index 84e1d7c2..1bf11364 100644 --- a/assets/js/handlers.js +++ b/assets/js/handlers.js @@ -102,8 +102,8 @@ xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xhr.onreadystatechange = function () { - if (xhr.readyState == 4) { - if (xhr.status != 200) { + if (xhr.readyState === 4) { + if (xhr.status !== 200) { count.innerText = parseInt(count.innerText) + 1; row.style.display = ''; } @@ -131,8 +131,8 @@ xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xhr.onreadystatechange = function () { - if (xhr.readyState == 4) { - if (xhr.status != 200) { + if (xhr.readyState === 4) { + if (xhr.status !== 200) { count.innerText = parseInt(count.innerText) + 1; row.style.display = ''; } @@ -159,7 +159,7 @@ } // Focus search bar on '/' - if (event.key == "/") { + if (event.key === "/") { document.getElementById('searchbox').focus(); event.preventDefault(); } diff --git a/assets/js/notifications.js b/assets/js/notifications.js index 9c77895b..1235fb41 100644 --- a/assets/js/notifications.js +++ b/assets/js/notifications.js @@ -4,7 +4,7 @@ var notification_data = JSON.parse(document.getElementById('notification_data'). var notifications, delivered; function get_subscriptions(callback, retries) { - if (retries == undefined) retries = 5; + if (retries === undefined) retries = 5; if (retries <= 0) { return; diff --git a/assets/js/player.js b/assets/js/player.js index a0cef29e..9903e614 100644 --- a/assets/js/player.js +++ b/assets/js/player.js @@ -225,7 +225,7 @@ player.playbackRate(video_data.params.speed); function getCookieValue(name) { var value = document.cookie.split(";").filter(item => item.includes(name + "=")); - return (value != null && value.length >= 1) + return (value.length >= 1) ? value[0].substring((name + "=").length, value[0].length) : null; } @@ -237,13 +237,13 @@ function getCookieValue(name) { * @param {number} newSpeed New speed defined (null if unchanged) */ function updateCookie(newVolume, newSpeed) { - var volumeValue = newVolume != null ? newVolume : video_data.params.volume; - var speedValue = newSpeed != null ? newSpeed : video_data.params.speed; + var volumeValue = newVolume !== null ? newVolume : video_data.params.volume; + var speedValue = newSpeed !== null ? newSpeed : video_data.params.speed; var cookieValue = getCookieValue('PREFS'); var cookieData; - if (cookieValue != null) { + if (cookieValue !== null) { var cookieJson = JSON.parse(decodeURIComponent(cookieValue)); cookieJson.volume = volumeValue; cookieJson.speed = speedValue; @@ -260,7 +260,7 @@ function updateCookie(newVolume, newSpeed) { var domainUsed = window.location.hostname; // Fix for a bug in FF where the leading dot in the FQDN is not ignored - if (domainUsed.charAt(0) != '.' && !ipRegex.test(domainUsed) && domainUsed != 'localhost') + if (domainUsed.charAt(0) !== '.' && !ipRegex.test(domainUsed) && domainUsed !== 'localhost') domainUsed = '.' + window.location.hostname; document.cookie = 'PREFS=' + cookieData + '; SameSite=Strict; path=/; domain=' + @@ -334,7 +334,7 @@ if (video_data.params.autoplay) { if (!video_data.params.listen && video_data.params.quality === 'dash') { player.httpSourceSelector(); - if (video_data.params.quality_dash != "auto") { + if (video_data.params.quality_dash !== "auto") { player.ready(() => { player.on("loadedmetadata", () => { const qualityLevels = Array.from(player.qualityLevels()).sort((a, b) => a.height - b.height); @@ -357,7 +357,7 @@ if (!video_data.params.listen && video_data.params.quality === 'dash') { } } for (let i = 0; i < qualityLevels.length; i++) { - qualityLevels[i].enabled = (i == targetQualityLevel); + qualityLevels[i].enabled = (i === targetQualityLevel); } }); }); @@ -703,7 +703,7 @@ window.addEventListener('keydown', e => { var volumeHover = false; var volumeSelector = pEl.querySelector('.vjs-volume-menu-button') || pEl.querySelector('.vjs-volume-panel'); - if (volumeSelector != null) { + if (volumeSelector !== null) { volumeSelector.onmouseover = function () { volumeHover = true; }; volumeSelector.onmouseout = function () { volumeHover = false; }; } @@ -723,9 +723,9 @@ window.addEventListener('keydown', e => { var delta = Math.max(-1, Math.min(1, (event.wheelDelta || -event.detail))); event.preventDefault(); - if (delta == 1) { + if (delta === 1) { increase_volume(volumeStep); - } else if (delta == -1) { + } else if (delta === -1) { increase_volume(-volumeStep); } } @@ -750,7 +750,7 @@ if (player_data.preferred_caption_found) { } // Safari audio double duration fix -if (navigator.vendor == "Apple Computer, Inc." && video_data.params.listen) { +if (navigator.vendor === "Apple Computer, Inc." && video_data.params.listen) { player.on('loadedmetadata', function () { player.on('timeupdate', function () { if (player.remainingTime() < player.duration() / 2 && player.remainingTime() >= 2) { diff --git a/assets/js/playlist_widget.js b/assets/js/playlist_widget.js index 0cf721a1..c7f4805f 100644 --- a/assets/js/playlist_widget.js +++ b/assets/js/playlist_widget.js @@ -15,8 +15,8 @@ function add_playlist_video(target) { xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xhr.onreadystatechange = function () { - if (xhr.readyState == 4) { - if (xhr.status == 200) { + if (xhr.readyState === 4) { + if (xhr.status === 200) { option.innerText = '✓' + option.innerText; } } @@ -39,8 +39,8 @@ function add_playlist_item(target) { xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xhr.onreadystatechange = function () { - if (xhr.readyState == 4) { - if (xhr.status != 200) { + if (xhr.readyState === 4) { + if (xhr.status !== 200) { tile.style.display = ''; } } @@ -63,8 +63,8 @@ function remove_playlist_item(target) { xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xhr.onreadystatechange = function () { - if (xhr.readyState == 4) { - if (xhr.status != 200) { + if (xhr.readyState === 4) { + if (xhr.status !== 200) { tile.style.display = ''; } } diff --git a/assets/js/subscribe_widget.js b/assets/js/subscribe_widget.js index bdd5d581..d44d65da 100644 --- a/assets/js/subscribe_widget.js +++ b/assets/js/subscribe_widget.js @@ -29,8 +29,8 @@ function subscribe(retries = 5) { subscribe_button.innerHTML = '' + subscribe_data.unsubscribe_text + ' | ' + subscribe_data.sub_count_text + ''; xhr.onreadystatechange = function () { - if (xhr.readyState == 4) { - if (xhr.status != 200) { + if (xhr.readyState === 4) { + if (xhr.status !== 200) { subscribe_button.onclick = subscribe; subscribe_button.innerHTML = fallback; } @@ -69,8 +69,8 @@ function unsubscribe(retries = 5) { subscribe_button.innerHTML = '' + subscribe_data.subscribe_text + ' | ' + subscribe_data.sub_count_text + ''; xhr.onreadystatechange = function () { - if (xhr.readyState == 4) { - if (xhr.status != 200) { + if (xhr.readyState === 4) { + if (xhr.status !== 200) { subscribe_button.onclick = unsubscribe; subscribe_button.innerHTML = fallback; } diff --git a/assets/js/watch.js b/assets/js/watch.js index 578d4ac0..ebc77905 100644 --- a/assets/js/watch.js +++ b/assets/js/watch.js @@ -117,7 +117,7 @@ function number_with_separator(val) { } function get_playlist(plid, retries) { - if (retries == undefined) retries = 5; + if (retries === undefined) retries = 5; playlist = document.getElementById('playlist'); if (retries <= 0) { @@ -147,8 +147,8 @@ function get_playlist(plid, retries) { xhr.open('GET', plid_url, true); xhr.onreadystatechange = function () { - if (xhr.readyState == 4) { - if (xhr.status == 200) { + if (xhr.readyState === 4) { + if (xhr.status === 200) { playlist.innerHTML = xhr.response.playlistHtml; var nextVideo = document.getElementById(xhr.response.nextVideo); nextVideo.parentNode.parentNode.scrollTop = nextVideo.offsetTop; @@ -210,7 +210,7 @@ function get_playlist(plid, retries) { } function get_reddit_comments(retries) { - if (retries == undefined) retries = 5; + if (retries === undefined) retries = 5; comments = document.getElementById('comments'); if (retries <= 0) { @@ -232,8 +232,8 @@ function get_reddit_comments(retries) { xhr.open('GET', url, true); xhr.onreadystatechange = function () { - if (xhr.readyState == 4) { - if (xhr.status == 200) { + if (xhr.readyState === 4) { + if (xhr.status === 200) { comments.innerHTML = ' \
\

\ @@ -287,7 +287,7 @@ function get_reddit_comments(retries) { } function get_youtube_comments(retries) { - if (retries == undefined) retries = 5; + if (retries === undefined) retries = 5; comments = document.getElementById('comments'); if (retries <= 0) { @@ -310,8 +310,8 @@ function get_youtube_comments(retries) { xhr.open('GET', url, true); xhr.onreadystatechange = function () { - if (xhr.readyState == 4) { - if (xhr.status == 200) { + if (xhr.readyState === 4) { + if (xhr.status === 200) { comments.innerHTML = ' \
\

\ @@ -384,8 +384,8 @@ function get_youtube_replies(target, load_more, load_replies) { xhr.open('GET', url, true); xhr.onreadystatechange = function () { - if (xhr.readyState == 4) { - if (xhr.status == 200) { + if (xhr.readyState === 4) { + if (xhr.status === 200) { if (load_more) { body = body.parentNode.parentNode; body.removeChild(body.lastElementChild); diff --git a/assets/js/watched_widget.js b/assets/js/watched_widget.js index 22afb054..bd037c2b 100644 --- a/assets/js/watched_widget.js +++ b/assets/js/watched_widget.js @@ -14,8 +14,8 @@ function mark_watched(target) { xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xhr.onreadystatechange = function () { - if (xhr.readyState == 4) { - if (xhr.status != 200) { + if (xhr.readyState === 4) { + if (xhr.status !== 200) { tile.style.display = ''; } } @@ -39,8 +39,8 @@ function mark_unwatched(target) { xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xhr.onreadystatechange = function () { - if (xhr.readyState == 4) { - if (xhr.status != 200) { + if (xhr.readyState === 4) { + if (xhr.status !== 200) { count.innerText = count.innerText - 1 + 2; tile.style.display = ''; } -- cgit v1.2.3 From 9b09d369d90006df847119eb42b9eabd877d0e7b Mon Sep 17 00:00:00 2001 From: meow Date: Wed, 20 Apr 2022 13:23:24 +0300 Subject: 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(-) (limited to 'assets/js/notifications.js') 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 = ''; } }); -- cgit v1.2.3 From c4cc50ca39a32e9beeb29b6fb7b669adb6b9df98 Mon Sep 17 00:00:00 2001 From: meow Date: Wed, 20 Apr 2022 13:40:30 +0300 Subject: replace innerHTML to safer textContent where possible --- assets/js/community.js | 2 +- assets/js/embed.js | 2 +- assets/js/notifications.js | 2 +- assets/js/player.js | 4 ++-- assets/js/playlist_widget.js | 2 +- assets/js/subscribe_widget.js | 2 +- assets/js/watch.js | 14 +++++++------- assets/js/watched_widget.js | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) (limited to 'assets/js/notifications.js') diff --git a/assets/js/community.js b/assets/js/community.js index 0f1d5d9c..58caa71e 100644 --- a/assets/js/community.js +++ b/assets/js/community.js @@ -1,5 +1,5 @@ 'use strict'; -var community_data = JSON.parse(document.getElementById('community_data').innerHTML); +var community_data = JSON.parse(document.getElementById('community_data').textContent); String.prototype.supplant = function (o) { return this.replace(/{([^{}]*)}/g, function (a, b) { diff --git a/assets/js/embed.js b/assets/js/embed.js index 69dcc053..492f546b 100644 --- a/assets/js/embed.js +++ b/assets/js/embed.js @@ -1,5 +1,5 @@ 'use strict'; -var video_data = JSON.parse(document.getElementById('video_data').innerHTML); +var video_data = JSON.parse(document.getElementById('video_data').textContent); function get_playlist(plid, retries) { if (retries === undefined) retries = 5; diff --git a/assets/js/notifications.js b/assets/js/notifications.js index d7732fb9..5f431a69 100644 --- a/assets/js/notifications.js +++ b/assets/js/notifications.js @@ -1,5 +1,5 @@ 'use strict'; -var notification_data = JSON.parse(document.getElementById('notification_data').innerHTML); +var notification_data = JSON.parse(document.getElementById('notification_data').textContent); var notifications, delivered; diff --git a/assets/js/player.js b/assets/js/player.js index 315fb618..7f0f8c7a 100644 --- a/assets/js/player.js +++ b/assets/js/player.js @@ -1,6 +1,6 @@ 'use strict'; -var player_data = JSON.parse(document.getElementById('player_data').innerHTML); -var video_data = JSON.parse(document.getElementById('video_data').innerHTML); +var player_data = JSON.parse(document.getElementById('player_data').textContent); +var video_data = JSON.parse(document.getElementById('video_data').textContent); var options = { preload: 'auto', diff --git a/assets/js/playlist_widget.js b/assets/js/playlist_widget.js index c7f4805f..d2f7d74c 100644 --- a/assets/js/playlist_widget.js +++ b/assets/js/playlist_widget.js @@ -1,5 +1,5 @@ 'use strict'; -var playlist_data = JSON.parse(document.getElementById('playlist_data').innerHTML); +var playlist_data = JSON.parse(document.getElementById('playlist_data').textContent); function add_playlist_video(target) { var select = target.parentNode.children[0].children[1]; diff --git a/assets/js/subscribe_widget.js b/assets/js/subscribe_widget.js index d44d65da..6f4d90f6 100644 --- a/assets/js/subscribe_widget.js +++ b/assets/js/subscribe_widget.js @@ -1,5 +1,5 @@ 'use strict'; -var subscribe_data = JSON.parse(document.getElementById('subscribe_data').innerHTML); +var subscribe_data = JSON.parse(document.getElementById('subscribe_data').textContent); var subscribe_button = document.getElementById('subscribe'); subscribe_button.parentNode['action'] = 'javascript:void(0)'; diff --git a/assets/js/watch.js b/assets/js/watch.js index e435bc7e..b7a80a18 100644 --- a/assets/js/watch.js +++ b/assets/js/watch.js @@ -1,5 +1,5 @@ 'use strict'; -var video_data = JSON.parse(document.getElementById('video_data').innerHTML); +var video_data = JSON.parse(document.getElementById('video_data').textContent); String.prototype.supplant = function (o) { return this.replace(/{([^{}]*)}/g, function (a, b) { @@ -11,10 +11,10 @@ String.prototype.supplant = function (o) { function toggle_parent(target) { var body = target.parentNode.parentNode.children[1]; if (body.style.display === null || body.style.display === '') { - target.innerHTML = '[ + ]'; + target.textContent = '[ + ]'; body.style.display = 'none'; } else { - target.innerHTML = '[ - ]'; + target.textContent = '[ - ]'; body.style.display = ''; } } @@ -23,10 +23,10 @@ function toggle_comments(event) { var target = event.target; var body = target.parentNode.parentNode.parentNode.children[1]; if (body.style.display === null || body.style.display === '') { - target.innerHTML = '[ + ]'; + target.textContent = '[ + ]'; body.style.display = 'none'; } else { - target.innerHTML = '[ - ]'; + target.textContent = '[ - ]'; body.style.display = ''; } } @@ -50,7 +50,7 @@ function hide_youtube_replies(event) { var body = target.parentNode.parentNode.children[1]; body.style.display = 'none'; - target.innerHTML = sub_text; + target.textContent = sub_text; target.onclick = show_youtube_replies; target.setAttribute('data-inner-text', inner_text); target.setAttribute('data-sub-text', sub_text); @@ -65,7 +65,7 @@ function show_youtube_replies(event) { var body = target.parentNode.parentNode.children[1]; body.style.display = ''; - target.innerHTML = sub_text; + target.textContent = sub_text; target.onclick = hide_youtube_replies; target.setAttribute('data-inner-text', inner_text); target.setAttribute('data-sub-text', sub_text); diff --git a/assets/js/watched_widget.js b/assets/js/watched_widget.js index bd037c2b..b597a3c8 100644 --- a/assets/js/watched_widget.js +++ b/assets/js/watched_widget.js @@ -1,5 +1,5 @@ 'use strict'; -var watched_data = JSON.parse(document.getElementById('watched_data').innerHTML); +var watched_data = JSON.parse(document.getElementById('watched_data').textContent); function mark_watched(target) { var tile = target.parentNode.parentNode.parentNode.parentNode.parentNode; -- cgit v1.2.3 From 3431a1b1def2408a8b4ad26a831e6606b8db11f9 Mon Sep 17 00:00:00 2001 From: meow Date: Wed, 20 Apr 2022 16:36:03 +0300 Subject: `console.warn` and `info` instead of `log` --- assets/js/community.js | 2 +- assets/js/embed.js | 6 +++--- assets/js/notifications.js | 8 ++++---- assets/js/player.js | 6 +++--- assets/js/subscribe_widget.js | 12 ++++++------ assets/js/watch.js | 22 +++++++++++----------- 6 files changed, 28 insertions(+), 28 deletions(-) (limited to 'assets/js/notifications.js') diff --git a/assets/js/community.js b/assets/js/community.js index 58caa71e..44066a58 100644 --- a/assets/js/community.js +++ b/assets/js/community.js @@ -96,7 +96,7 @@ function get_youtube_replies(target, load_more) { }; xhr.ontimeout = function () { - console.log('Pulling comments failed.'); + console.warn('Pulling comments failed.'); body.innerHTML = fallback; }; diff --git a/assets/js/embed.js b/assets/js/embed.js index 492f546b..7e9ac605 100644 --- a/assets/js/embed.js +++ b/assets/js/embed.js @@ -5,7 +5,7 @@ function get_playlist(plid, retries) { if (retries === undefined) retries = 5; if (retries <= 0) { - console.log('Failed to pull playlist'); + console.warn('Failed to pull playlist'); return; } @@ -62,12 +62,12 @@ function get_playlist(plid, retries) { }; xhr.onerror = function () { - console.log('Pulling playlist failed... ' + retries + '/5'); + console.warn('Pulling playlist failed... ' + retries + '/5'); setTimeout(function () { get_playlist(plid, retries - 1); }, 1000); }; xhr.ontimeout = function () { - console.log('Pulling playlist failed... ' + retries + '/5'); + console.warn('Pulling playlist failed... ' + retries + '/5'); get_playlist(plid, retries - 1); }; diff --git a/assets/js/notifications.js b/assets/js/notifications.js index 5f431a69..ec5f6dd3 100644 --- a/assets/js/notifications.js +++ b/assets/js/notifications.js @@ -25,12 +25,12 @@ function get_subscriptions(callback, retries) { }; xhr.onerror = function () { - console.log('Pulling subscriptions failed... ' + retries + '/5'); + console.warn('Pulling subscriptions failed... ' + retries + '/5'); setTimeout(function () { get_subscriptions(callback, retries - 1); }, 1000); }; xhr.ontimeout = function () { - console.log('Pulling subscriptions failed... ' + retries + '/5'); + console.warn('Pulling subscriptions failed... ' + retries + '/5'); get_subscriptions(callback, retries - 1); }; @@ -54,7 +54,7 @@ function create_notification_stream(subscriptions) { } var notification = JSON.parse(event.data); - console.log('Got notification:', notification); + console.info('Got notification:', notification); if (start_time < notification.published && !delivered.includes(notification.videoId)) { if (Notification.permission === 'granted') { @@ -90,7 +90,7 @@ function create_notification_stream(subscriptions) { } function handle_notification_error(event) { - console.log('Something went wrong with notifications, trying to reconnect...'); + console.warn('Something went wrong with notifications, trying to reconnect...'); notifications = { close: function () { } }; setTimeout(function () { get_subscriptions(create_notification_stream); }, 1000); } diff --git a/assets/js/player.js b/assets/js/player.js index 3c8cf219..f07031ac 100644 --- a/assets/js/player.js +++ b/assets/js/player.js @@ -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.info('Player has caught up to source, resetting playbackRate.'); player.playbackRate(1); } }); @@ -477,7 +477,7 @@ function set_all_video_times(times) { try { storage.setItem(save_player_pos_key, JSON.stringify(times)); } catch (e) { - console.debug('set_all_video_times: ' + e); + console.warn('set_all_video_times: ' + e); } } else { storage.removeItem(save_player_pos_key); @@ -492,7 +492,7 @@ function get_all_video_times() { try { return JSON.parse(raw); } catch (e) { - console.debug('get_all_video_times: ' + e); + console.warn('get_all_video_times: ' + e); } } } diff --git a/assets/js/subscribe_widget.js b/assets/js/subscribe_widget.js index 771235c1..45ff5706 100644 --- a/assets/js/subscribe_widget.js +++ b/assets/js/subscribe_widget.js @@ -14,7 +14,7 @@ function subscribe(retries) { if (retries === undefined) retries = 5; if (retries <= 0) { - console.log('Failed to subscribe.'); + console.warn('Failed to subscribe.'); return; } @@ -40,12 +40,12 @@ function subscribe(retries) { }; xhr.onerror = function () { - console.log('Subscribing failed... ' + retries + '/5'); + console.warn('Subscribing failed... ' + retries + '/5'); setTimeout(function () { subscribe(retries - 1); }, 1000); }; xhr.ontimeout = function () { - console.log('Subscribing failed... ' + retries + '/5'); + console.warn('Subscribing failed... ' + retries + '/5'); subscribe(retries - 1); }; @@ -57,7 +57,7 @@ function unsubscribe(retries) { retries = 5; if (retries <= 0) { - console.log('Failed to subscribe'); + console.warn('Failed to subscribe'); return; } @@ -83,12 +83,12 @@ function unsubscribe(retries) { }; xhr.onerror = function () { - console.log('Unsubscribing failed... ' + retries + '/5'); + console.warn('Unsubscribing failed... ' + retries + '/5'); setTimeout(function () { unsubscribe(retries - 1); }, 1000); }; xhr.ontimeout = function () { - console.log('Unsubscribing failed... ' + retries + '/5'); + console.warn('Unsubscribing failed... ' + retries + '/5'); unsubscribe(retries - 1); }; diff --git a/assets/js/watch.js b/assets/js/watch.js index 5153f1c1..29d58be5 100644 --- a/assets/js/watch.js +++ b/assets/js/watch.js @@ -121,7 +121,7 @@ function get_playlist(plid, retries) { var playlist = document.getElementById('playlist'); if (retries <= 0) { - console.log('Failed to pull playlist'); + console.warn('Failed to pull playlist'); playlist.innerHTML = ''; return; } @@ -194,7 +194,7 @@ function get_playlist(plid, retries) { playlist.innerHTML = '


'; - console.log('Pulling playlist timed out... ' + retries + '/5'); + console.warn('Pulling playlist timed out... ' + retries + '/5'); setTimeout(function () { get_playlist(plid, retries - 1); }, 1000); }; @@ -203,7 +203,7 @@ function get_playlist(plid, retries) { playlist.innerHTML = '


'; - console.log('Pulling playlist timed out... ' + retries + '/5'); + console.warn('Pulling playlist timed out... ' + retries + '/5'); get_playlist(plid, retries - 1); }; @@ -215,7 +215,7 @@ function get_reddit_comments(retries) { var comments = document.getElementById('comments'); if (retries <= 0) { - console.log('Failed to pull comments'); + console.warn('Failed to pull comments'); comments.innerHTML = ''; return; } @@ -265,7 +265,7 @@ function get_reddit_comments(retries) { comments.children[0].children[1].children[0].onclick = swap_comments; } else { if (video_data.params.comments[1] === 'youtube') { - console.log('Pulling comments failed... ' + retries + '/5'); + console.warn('Pulling comments failed... ' + retries + '/5'); setTimeout(function () { get_youtube_comments(retries - 1); }, 1000); } else { comments.innerHTML = fallback; @@ -275,12 +275,12 @@ function get_reddit_comments(retries) { }; xhr.onerror = function () { - console.log('Pulling comments failed... ' + retries + '/5'); + console.warn('Pulling comments failed... ' + retries + '/5'); setTimeout(function () { get_reddit_comments(retries - 1); }, 1000); }; xhr.ontimeout = function () { - console.log('Pulling comments failed... ' + retries + '/5'); + console.warn('Pulling comments failed... ' + retries + '/5'); get_reddit_comments(retries - 1); }; @@ -292,7 +292,7 @@ function get_youtube_comments(retries) { var comments = document.getElementById('comments'); if (retries <= 0) { - console.log('Failed to pull comments'); + console.warn('Failed to pull comments'); comments.innerHTML = ''; return; } @@ -349,14 +349,14 @@ function get_youtube_comments(retries) { xhr.onerror = function () { comments.innerHTML = '

'; - console.log('Pulling comments failed... ' + retries + '/5'); + console.warn('Pulling comments failed... ' + retries + '/5'); setTimeout(function () { get_youtube_comments(retries - 1); }, 1000); }; xhr.ontimeout = function () { comments.innerHTML = '

'; - console.log('Pulling comments failed... ' + retries + '/5'); + console.warn('Pulling comments failed... ' + retries + '/5'); get_youtube_comments(retries - 1); }; @@ -417,7 +417,7 @@ function get_youtube_replies(target, load_more, load_replies) { }; xhr.ontimeout = function () { - console.log('Pulling comments failed.'); + console.warn('Pulling comments failed.'); body.innerHTML = fallback; }; -- cgit v1.2.3