1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-11-30 00:19:54 +00:00

Improves the add stream dialog user experience.

When the dialog is opened, the text area is focused. When enter is
pressed (and the form is submit) the window now behaves as expected and
adds the stream to the playlist and closes. The text area is now also
cleared once the form is submit, previously the old stream was still
visible when the dialog was opened a second time.
This commit is contained in:
Ivor Wanders 2015-07-16 11:50:54 +02:00
parent f2164b382a
commit d3148056fc

View File

@ -106,6 +106,13 @@ $(document).ready(function(){
} }
}); });
$('#addstream').on('shown.bs.modal', function () {
$('#streamurl').focus();
})
$('#addstream form').on('submit', function (e) {
addStream();
});
if(!notificationsSupported()) if(!notificationsSupported())
$('#btnnotify').addClass("disabled"); $('#btnnotify').addClass("disabled");
else else
@ -573,6 +580,7 @@ function addStream() {
if($('#streamurl').val().length > 0) { if($('#streamurl').val().length > 0) {
socket.send('MPD_API_ADD_TRACK,'+$('#streamurl').val()); socket.send('MPD_API_ADD_TRACK,'+$('#streamurl').val());
} }
$('#streamurl').val("");
$('#addstream').modal('hide'); $('#addstream').modal('hide');
} }