Commit c6831368 authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

Merge branch 'prakhar/purr-data-diag_msg_send' into emscripten

parents 1011c64e d5c70f3d
Pipeline #3689 failed with stage
in 0 seconds
......@@ -30,6 +30,32 @@
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="message-modal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">New message</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form>
<div class="form-group">
<label for="message-text" class="col-form-label">Message:</label>
<textarea class="form-control" id="message-text"></textarea>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" id="send-message-btn" class="btn btn-primary" onclick="pdbundle.pdgui.web_menu_send()">Send message</button>
</div>
</div>
</div>
</div>
<div id="container-app" class="container-fluid">
<!-- Menu -->
<nav id="menu"></nav>
......
......@@ -1197,15 +1197,34 @@ function gui_quit_dialog() {
// send a message to Pd
function menu_send(name) {
var message,
if (is_webapp) {
$(".editmode").removeClass("editmode");
$('[id*="editmode"]').prop('checked', false);
$("#message-modal").modal("show");
$("#message-text").val(name);
} else {
var message,
win = name ? patchwin[name] : pd_window;
message = win.window.prompt("Type a message to send to Pd", name);
message = win.window.prompt("Type a message to send to Pd", name);
if (message != undefined && message.length) {
post("Sending message to Pd: " + message + ";");
pdsend(message);
}
}
}
function web_menu_send() {
var message = $("#message-text").val();
if (message != undefined && message.length) {
post("Sending message to Pd: " + message + ";");
pdsend(message);
}
$("#message-text").val("");
$("#message-modal").modal("hide");
}
exports.web_menu_send = web_menu_send;
// requires nw.js API (Menuitem)
function canvas_set_editmode(cid, state) {
var patchsvg_id = is_webapp() ? "patchsvg_"+cid : "patchsvg"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment