From a84821bee99c521ca8352b68ce75b6cae36c8ccc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Janou=C5=A1ek?= Date: Sun, 8 Nov 2020 14:31:34 +0100 Subject: [PATCH] Apply standard --fix Issue: tiliado/nuvolaruntime#674 --- integrate.js | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/integrate.js b/integrate.js index 7b7d1cc..91888f0 100644 --- a/integrate.js +++ b/integrate.js @@ -26,20 +26,20 @@ (function (Nuvola) { // Create media player component - var player = Nuvola.$object(Nuvola.MediaPlayer) + const player = Nuvola.$object(Nuvola.MediaPlayer) // Handy aliases - var PlaybackState = Nuvola.PlaybackState - var PlayerAction = Nuvola.PlayerAction + const PlaybackState = Nuvola.PlaybackState + const PlayerAction = Nuvola.PlayerAction // Create new WebApp prototype - var WebApp = Nuvola.$WebApp() + const WebApp = Nuvola.$WebApp() // Initialization routines WebApp._onInitWebWorker = function (emitter) { Nuvola.WebApp._onInitWebWorker.call(this, emitter) - var state = document.readyState + const state = document.readyState if (state === 'interactive' || state === 'complete') { this._onPageReady() } else { @@ -58,8 +58,8 @@ // Extract data from the web page WebApp.update = function () { - var elms = this._getElements() - var track = { + const elms = this._getElements() + const track = { title: Nuvola.queryText('.web-chrome-playback-lcd__song-name-scroll-inner-text-wrapper'), artist: null, album: null, @@ -69,7 +69,7 @@ } if (elms.chrome) { - var subtitle = elms.chrome.querySelectorAll('.web-chrome-playback-lcd__sub-copy-scroll-inner-text-wrapper a') + let subtitle = elms.chrome.querySelectorAll('.web-chrome-playback-lcd__sub-copy-scroll-inner-text-wrapper a') if (!subtitle.length) { subtitle = elms.chrome.querySelectorAll('.web-chrome-playback-lcd__sub-copy-scroll-inner-text-wrapper span') } @@ -82,7 +82,7 @@ return null } - var imgs = src.split(',') + const imgs = src.split(',') if (!imgs.length) { return null } @@ -92,7 +92,7 @@ }) } - var state + let state if (!elms.chrome || (!elms.play && !elms.pause)) { state = PlaybackState.UNKNOWN } else if (elms.chrome.classList.contains('is-playing')) { @@ -110,7 +110,7 @@ player.setCanPlay(!!elms.play) player.setCanPause(!!elms.pause) - var shuffle = elms.shuffle ? elms.shuffle.getAttribute('aria-checked') === 'true' : null + const shuffle = elms.shuffle ? elms.shuffle.getAttribute('aria-checked') === 'true' : null player.setCanShuffle(shuffle !== null) player.setShuffleState(shuffle) @@ -125,7 +125,7 @@ // Handler of playback actions WebApp._onActionActivated = function (emitter, name, param) { - var elms = this._getElements() + const elms = this._getElements() switch (name) { case PlayerAction.TOGGLE_PLAY: if (elms.play) { @@ -161,7 +161,7 @@ WebApp._getElements = function () { // Interesting elements - var elms = { + const elms = { chrome: document.querySelector('div.web-chrome'), play: null, pause: null, @@ -174,7 +174,7 @@ } // Prev, play/pause, next - var buttons = document.querySelectorAll('.web-chrome-playback-controls__main button') + const buttons = document.querySelectorAll('.web-chrome-playback-controls__main button') if (buttons.length === 3) { elms.prev = buttons[0] elms.next = buttons[2] @@ -186,14 +186,14 @@ } // Shuffle, repeat - var checkboxes = document.querySelectorAll('.web-chrome-playback-controls__directionals div[role="checkbox"]') + const checkboxes = document.querySelectorAll('.web-chrome-playback-controls__directionals div[role="checkbox"]') if (checkboxes.length === 2) { elms.shuffle = checkboxes[0] elms.repeat = checkboxes[1] } // Ignore disabled buttons - for (var key in elms) { + for (const key in elms) { if (elms[key] && elms[key].disabled) { // console.log("disabled " + key) elms[key] = null