Skip to content

Commit

Permalink
Apply standard --fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jiri-janousek committed Nov 8, 2020
1 parent 4eed828 commit a84821b
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions integrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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,
Expand All @@ -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')
}
Expand All @@ -82,7 +82,7 @@
return null
}

var imgs = src.split(',')
const imgs = src.split(',')
if (!imgs.length) {
return null
}
Expand All @@ -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')) {
Expand All @@ -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)

Expand All @@ -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) {
Expand Down Expand Up @@ -161,7 +161,7 @@

WebApp._getElements = function () {
// Interesting elements
var elms = {
const elms = {
chrome: document.querySelector('div.web-chrome'),
play: null,
pause: null,
Expand All @@ -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]
Expand All @@ -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
Expand Down

0 comments on commit a84821b

Please sign in to comment.