X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;ds=sidebyside;f=main.js;h=fefb964e54b8974fe12f5949f18d0ed65f527881;hb=d4a26e736741a0a75acc6742d075d1cf7a11a44c;hp=1de6b6a4c18e8f254be18dbcc6acb6971c9220ef;hpb=4ed31ba857752d2d550dde24200a751574ffce8f;p=chrome-ext%2Fmusic-player-client.git diff --git a/main.js b/main.js index 1de6b6a..fefb964 100644 --- a/main.js +++ b/main.js @@ -237,8 +237,7 @@ function update_ui(state, cmd) { if ('file' in state) { // Hack: should be a real object. - ui_mpc_metadata.innerText = state['file']; - return; + ui_mpc_metadata.innerText = state.file; } var time; @@ -247,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) {