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 29b8f0a commit 0d682db
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,15 +58,15 @@

// Extract data from the web page
WebApp.update = function () {
var track = {
const track = {
title: null,
artist: null,
album: null,
artLocation: null,
rating: null
}
var elements = this._getElements()
var elm
const elements = this._getElements()
let elm
if (elements.audio) {
elm = elements.audio.querySelector('.player_podcast_title')
track.artist = elm ? (elm.innerText || null) : null
Expand All @@ -75,14 +75,14 @@
elm = elements.audio.querySelector('.player_artwork img') || elements.audio.querySelector('.player-image img')
track.artLocation = elm ? (elm.src.replace('/webp/', '/').replace('.webp', '.jpg') || null) : null
}
var state = PlaybackState.UNKNOWN
let state = PlaybackState.UNKNOWN
if (elements.play) {
state = PlaybackState.PAUSED
} else if (elements.pause) {
state = PlaybackState.PLAYING
}
var time = this._parseTime(elements)
var volume = elements.volumeBarPos ? elements.volumeBarPos.getAttribute('aria-valuenow') * 1 : null
const time = this._parseTime(elements)
const volume = elements.volumeBarPos ? elements.volumeBarPos.getAttribute('aria-valuenow') * 1 : null

track.length = time.total
player.setTrack(track)
Expand All @@ -102,7 +102,7 @@

// Handler of playback actions
WebApp._onActionActivated = function (emitter, name, param) {
var elements = this._getElements()
const elements = this._getElements()
switch (name) {
case PlayerAction.TOGGLE_PLAY:
if (elements.play) {
Expand Down Expand Up @@ -134,7 +134,7 @@
break
case PlayerAction.SEEK:
if (elements.seekBar) {
var time = this._parseTime(elements)
const time = this._parseTime(elements)
if (time.total && param > 0 && param <= time.total) {
Nuvola.clickOnElement(elements.seekBar, param / time.total, 0.5)
}
Expand All @@ -149,14 +149,14 @@
}

WebApp._parseTime = function (elements) {
var time = {
const time = {
total: null,
current: null,
remaining: null
}
if (elements.currentTime && elements.remainingTime) {
time.current = Nuvola.parseTimeUsec(elements.currentTime.innerText || null)
var remainingTime = elements.remainingTime.innerText || null
const remainingTime = elements.remainingTime.innerText || null
if (time.current && remainingTime) {
time.remaining = Nuvola.parseTimeUsec(remainingTime.substring(1))
time.total = time.current + time.remaining
Expand All @@ -166,7 +166,7 @@
}

WebApp._getElements = function () {
var elms = {
const elms = {
players: document.querySelector('div.player-controls'),
audio: null,
play: null,
Expand Down

0 comments on commit 0d682db

Please sign in to comment.