1
0
mirror of https://github.com/SuperBFG7/ympd synced 2025-11-07 09:03:00 +00:00

add settings modal dialog

This commit is contained in:
Andrew Karpow
2014-02-04 17:58:10 +01:00
parent 6f8d5ef732
commit 8c49b2a877
7 changed files with 88 additions and 9 deletions

View File

@@ -311,6 +311,10 @@ function webSocketConnect() {
type: "info",
}).show();
break;
case "mpdhost":
$('#mpdhost').val(obj.data.host);
$('#mpdport').val(obj.data.port);
break;
case "error":
$('.top-right').notify({
@@ -452,6 +456,23 @@ function getVersion()
});
}
function getHost() {
socket.send('MPD_API_GET_MPDHOST');
function onEnter(event) {
if ( event.which == 13 )
setHost();
$('#settings').modal('hide');
}
$('#mpdhost').keypress(onEnter);
$('#mpdport').keypress(onEnter);
}
function setHost() {
socket.send('MPD_API_SET_MPDHOST,'+$('#mpdport').val()+','+$('#mpdhost').val());
}
function notificationsSupported() {
return "webkitNotifications" in window;
}