]> Untitled Git - ympd.git/commitdiff
Improves the add stream dialog user experience.
authorIvor Wanders <ivor@iwanders.net>
Thu, 16 Jul 2015 09:50:54 +0000 (11:50 +0200)
committerIvor Wanders <ivor@iwanders.net>
Thu, 16 Jul 2015 09:50:54 +0000 (11:50 +0200)
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

index 49a46565d207b1660ab11d4b2831a1ee4534c2cb..3c6d9af55184b5f5decd29a7089dd9f2564caf98 100644 (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())
         $('#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');
 }