From: Mike Frysinger Date: Sun, 1 Sep 2013 08:32:36 +0000 (-0400) Subject: show current volume/time in tooltips X-Git-Tag: v3.0~13 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=92ef863031eb48baaee057efda818d874ce31451;p=chrome-ext%2Fmusic-player-client.git show current volume/time in tooltips --- diff --git a/main.js b/main.js index d107abb..fefb964 100644 --- a/main.js +++ b/main.js @@ -237,7 +237,7 @@ function update_ui(state, cmd) { if ('file' in state) { // Hack: should be a real object. - ui_mpc_metadata.innerText = state['file']; + ui_mpc_metadata.innerText = state.file; } var time; @@ -246,10 +246,14 @@ function update_ui(state, cmd) { time = state.time.split(':'); else time = [0, 0]; - window['ui_mpc_seekcur'].max = time[1]; - window['ui_mpc_seekcur'].value = time[0]; + window.ui_mpc_seekcur.max = time[1]; + window.ui_mpc_seekcur.value = time[0]; + percent = Math.floor((0.0 + time[0]) * 100 / (0.0 + time[1])); + window.ui_mpc_seekcur.title = 'seekcur (' + percent + '%)'; + + window.ui_mpc_setvol.value = state.volume; + window.ui_mpc_setvol.title = 'setvol (' + state.volume + '%)'; - window['ui_mpc_setvol'].value = state.volume; [ 'consume', 'random', 'repeat', 'single', ].forEach(function(id) {