From 92ef863031eb48baaee057efda818d874ce31451 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sun, 1 Sep 2013 04:32:36 -0400 Subject: [PATCH] show current volume/time in tooltips --- main.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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) { -- 2.39.5