Scrollable modals, working add_mapping feature.

This commit is contained in:
Fabian Schlenz 2019-11-17 14:22:22 +01:00
parent cc4729eb6b
commit 8e5a3195b9

View File

@ -85,7 +85,7 @@
<div class="modal fade" id="openModal" tabindex="-1" role="dialog"> <div class="modal fade" id="openModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-dialog-centered" role="document"> <div class="modal-dialog modal-dialog-centered modal-dialog-scrollable" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title">Album öffnen</h5> <h5 class="modal-title">Album öffnen</h5>
@ -118,7 +118,7 @@
</div> </div>
<div class="modal fade" id="settingsModal" tabindex="-1" role="dialog"> <div class="modal fade" id="settingsModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-dialog-centered" role="document"> <div class="modal-dialog modal-dialog-centered modal-dialog-scrollable" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title">Settings</h5> <h5 class="modal-title">Settings</h5>
@ -258,6 +258,8 @@ process_ws_message = function(event) {
} }
} }
var play_on_click = true;
$(function() { $(function() {
ws = new WebSocket("ws://" + location.host + "/ws"); ws = new WebSocket("ws://" + location.host + "/ws");
ws.onmessage = process_ws_message; ws.onmessage = process_ws_message;
@ -269,7 +271,7 @@ $(function() {
$('#button_track_prev').click(function(e) { ws.send("track_prev"); }); $('#button_track_prev').click(function(e) { ws.send("track_prev"); });
$('#button_open').click(function(e) { $('#openModal').modal('show'); }); $('#button_open').click(function(e) { $('#openModal').modal('show'); });
$('#track_list').on('click', 'tr', function(e) { ws.send("track=" + $(e.target).parent().data('track')); }); $('#track_list').on('click', 'tr', function(e) { ws.send("track=" + $(e.target).parent().data('track')); });
$('#albums_without_id, #albums_with_id').on('click', 'tr', function(e) { ws.send("play " + $(e.target).parents('tr').data('folder')); $('#openModal').modal('hide'); }); $('#albums_without_id, #albums_with_id').on('click', 'tr', function(e) { if (play_on_click) {ws.send("play " + $(e.target).parents('tr').data('folder')); $('#openModal').modal('hide');} });
$('#button_settings').click(function(e) { $('#settingsModal').modal('show'); }); $('#button_settings').click(function(e) { $('#settingsModal').modal('show'); });
$('#button_reset_vs1053').click(function(e) { ws.send("reset_vs1053"); $('#settingsModal').modal('hide'); }); $('#button_reset_vs1053').click(function(e) { ws.send("reset_vs1053"); $('#settingsModal').modal('hide'); });
$('#button_reboot').click(function(e) { ws.send("reboot"); $('#settingsModal').modal('hide'); }); $('#button_reboot').click(function(e) { ws.send("reboot"); $('#settingsModal').modal('hide'); });
@ -277,8 +279,9 @@ $(function() {
$('#settingsModal').modal('hide'); $('#settingsModal').modal('hide');
$('#openModal').modal('show'); $('#openModal').modal('show');
$('.add_mapping_button').show(); $('.add_mapping_button').show();
play_on_click = false;
}); });
$('#openModal').on('click', '.add_mapping_button', function(e) {console.log("add_mapping=" + $('#last_rfid_id').html() + "=" + $(e.target).parents('tr').data('folder')); $('#openModal').modal('hide'); $('.add_mapping_button').hide(); e.stopPropagation();}); $('#openModal').on('click', '.add_mapping_button', function(e) {ws.send("add_mapping=" + $('#last_rfid_id').html() + "=" + $(e.target).parents('tr').data('folder')); $('#openModal').modal('hide'); $('.add_mapping_button').hide(); e.stopPropagation(); play_on_click=true; return false;});
}); });
</script> </script>
</html> </html>