});
};
+window.onkeypress = function(e) {
+ switch (e.keyCode) {
+ case 49: // 1
+ show_page('controls');
+ break;
+ case 50: // 1
+ show_page('metadata');
+ break;
+ case 51: // 1
+ show_page('playlist');
+ break;
+ case 52: // 1
+ show_page('options');
+ break;
+ }
+};
+
function mpc_refresh() {
mpc.status();
}
mpc.consume(val);
setToggleButton(this, val);
}
+function tramp_mpc_deleteid() { mpc.deleteid(this.title); }
function tramp_mpc_next() { mpc.next(); }
function tramp_mpc_pause() { mpc.pause(); }
function tramp_mpc_play() { mpc.play(); }
}
function init_ui(local_keys, sync_keys, options) {
+ var ele, i;
+
/* Setup footer */
+ i = 1;
[
- 'controls', 'metadata', 'options', 'playlist',
+ 'controls', 'metadata', 'playlist', 'options',
].forEach(function(id) {
- document.getElementById('tab.' + id).onclick = show_page;
+ var ele = document.getElementById('tab.' + id);
+ ele.onclick = show_page;
+ ele.title = id + ' [' + i + ']';
+ ++i;
});
/* Setup control tab */
var ele = window['ui_mpc_' + id] = document.getElementById(id);
ele.onchange = ele.onclick = window['tramp_mpc_' + id];
ele.title = id;
+ if (ele.accessKey)
+ ele.title += ' [' + ele.accessKey + ']'
});
window['ui_mpc_currtime'] = document.getElementById('currtime');
return ret + ("00" + sec).substr(-2);
}
+function playlist_del() {
+ mpc.deleteid(this.title);
+ this.parentNode.remove();
+}
+
function update_ui(state, cmd) {
if (typeof(state) == 'string') {
ui_mpc_status.innerText = ({
if (song.Pos == currentsong.Pos)
row.style.fontWeight = 'bold';
+ cell = row.insertCell(-1);
+ cell.id = 'playlist_del';
+ cell.innerHTML = '¤';
+ cell.title = song.Id;
+ cell.onclick = playlist_del;
+
cell = row.insertCell(-1);
cell.innerText = song.Pos;
cell.style.textAlign = 'right';