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 4a2e29d commit d40cf46
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions integrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@
'use strict';

(function (Nuvola) {
var PlaybackState = Nuvola.PlaybackState
var PlayerAction = Nuvola.PlayerAction
var player = Nuvola.$object(Nuvola.MediaPlayer)
const PlaybackState = Nuvola.PlaybackState
const PlayerAction = Nuvola.PlayerAction
const player = Nuvola.$object(Nuvola.MediaPlayer)

var WebApp = Nuvola.$WebApp()
const WebApp = Nuvola.$WebApp()

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 @@ -48,8 +48,8 @@
}

WebApp.update = function () {
var elms = this._getElements()
var track = {
const elms = this._getElements()
const track = {
title: Nuvola.queryText('#main .top-header .title h1'),
artist: null,
album: null,
Expand All @@ -58,7 +58,7 @@
length: elms.timeTotal
}

var state
let state
if (elms.pause) {
state = PlaybackState.PLAYING
} else if (elms.play) {
Expand All @@ -80,7 +80,7 @@
}

WebApp._onActionActivated = function (emitter, name, param) {
var elms = this._getElements()
const elms = this._getElements()
switch (name) {
case PlayerAction.TOGGLE_PLAY:
if (elms.play) {
Expand All @@ -96,24 +96,25 @@
case PlayerAction.STOP:
Nuvola.clickOnElement(elms.pause)
break
case PlayerAction.SEEK:
var total = Nuvola.parseTimeUsec(elms.timeTotal)
case PlayerAction.SEEK: {
const total = Nuvola.parseTimeUsec(elms.timeTotal)
if (param > 0 && param <= total) {
Nuvola.clickOnElement(elms.seekBar, param / total, 0.5)
}
break
}
}
}

WebApp._getElements = function () {
var elms = {
const elms = {
play: document.querySelector('.button .play > a'),
pause: document.querySelector('.button .stop > a'),
timeElapsed: Nuvola.queryText('.player-timebar .time'),
timeTotal: Nuvola.queryText('.player-timebar .total-time'),
seekBar: document.querySelector('.player-timebar .buffer-timebar')
}
for (var key of ['play', 'pause']) {
for (const key of ['play', 'pause']) {
if (elms[key] && elms[key].parentElement.style.display === 'none') {
elms[key] = null
}
Expand Down

0 comments on commit d40cf46

Please sign in to comment.