Skip to content

Commit

Permalink
Integrate shuffle status
Browse files Browse the repository at this point in the history
Issue: tiliado/nuvolaplayer#20

Signed-off-by: Jiří Janoušek <[email protected]>
  • Loading branch information
jiri-janousek committed Sep 16, 2018
1 parent 38f4ff8 commit f927080
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions integrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@
player.setCanGoNext(state !== PlaybackState.UNKNOWN && !!buttons.next)
player.setCanPlay(state !== PlaybackState.UNKNOWN && !!buttons.play)
player.setCanPause(state !== PlaybackState.UNKNOWN && !!buttons.pause)

var shuffle = buttons.shuffle ? buttons.shuffle.classList.contains('control-button--active') : null
Nuvola.actions.updateEnabledFlag(PlayerAction.SHUFFLE, shuffle !== null)
Nuvola.actions.updateState(PlayerAction.SHUFFLE, !!shuffle)
} finally {
setTimeout(this.update.bind(this), 500)
}
Expand Down Expand Up @@ -135,6 +139,9 @@
case PlayerAction.CHANGE_VOLUME:
Nuvola.clickOnElement(document.querySelector('#main .volume-bar .progress-bar__bg'), parameter, 0.5)
break
case PlayerAction.SHUFFLE:
Nuvola.clickOnElement(buttons.shuffle)
break
default:
throw Error('Action "' + name + '" not supported.')
}
Expand Down

0 comments on commit f927080

Please sign in to comment.