]> git.wh0rd.org - chrome-ext/music-player-client.git/commitdiff
show current volume/time in tooltips
authorMike Frysinger <vapier@gentoo.org>
Sun, 1 Sep 2013 08:32:36 +0000 (04:32 -0400)
committerMike Frysinger <vapier@gentoo.org>
Sun, 1 Sep 2013 08:32:36 +0000 (04:32 -0400)
main.js

diff --git a/main.js b/main.js
index d107abba5a021cd2d5de282e7dd09999816acfad..fefb964e54b8974fe12f5949f18d0ed65f527881 100644 (file)
--- 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.
 
        if ('file' in state) {
                // Hack: should be a real object.
-               ui_mpc_metadata.innerText = state['file'];
+               ui_mpc_metadata.innerText = state.file;
        }
 
        var time;
        }
 
        var time;
@@ -246,10 +246,14 @@ function update_ui(state, cmd) {
                time = state.time.split(':');
        else
                time = [0, 0];
                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) {
        [
                'consume', 'random', 'repeat', 'single',
        ].forEach(function(id) {