From d3148056fc8394446643e67b2cd487bbe17f0d87 Mon Sep 17 00:00:00 2001 From: Ivor Wanders Date: Thu, 16 Jul 2015 11:50:54 +0200 Subject: [PATCH] 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. --- htdocs/js/mpd.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/js/mpd.js b/htdocs/js/mpd.js index 49a46565d..3c6d9af55 100644 --- a/htdocs/js/mpd.js +++ b/htdocs/js/mpd.js @@ -106,6 +106,13 @@ $(document).ready(function(){ } }); + $('#addstream').on('shown.bs.modal', function () { + $('#streamurl').focus(); + }) + $('#addstream form').on('submit', function (e) { + addStream(); + }); + if(!notificationsSupported()) $('#btnnotify').addClass("disabled"); else @@ -573,6 +580,7 @@ function addStream() { if($('#streamurl').val().length > 0) { socket.send('MPD_API_ADD_TRACK,'+$('#streamurl').val()); } + $('#streamurl').val(""); $('#addstream').modal('hide'); }