make dialogs stackable

This commit is contained in:
Eric House 2021-02-16 13:25:21 -08:00
parent 540cf73496
commit 52773c577f
2 changed files with 9 additions and 11 deletions

View file

@ -50,11 +50,9 @@
to {transform: rotate(360deg);}
}
#nbalert {
display: none;
div.nbalert {
position: absolute;
text-align: left;
z-index: 10000;
white-space: pre-wrap;
left: 33%;
top: 250px;

View file

@ -88,14 +88,16 @@ function mqttSend( topic, ptr ) {
}
function nbDialog(msg, buttons, proc, closure) {
let dlg = document.getElementById('nbalert');
while (dlg.firstChild) {
dlg.removeChild(dlg.firstChild);
}
let container = document.getElementById('nbalert');
let dlg = document.createElement('div');
dlg.classList.add('nbalert');
dlg.style.zIndex = 10000;
container.appendChild( dlg );
let txtDiv = document.createElement('div');
txtDiv.textContent = msg
dlg.appendChild( txtDiv );
txtDiv.textContent = msg
let span = document.createElement('div');
span.classList.add('buttonRow');
@ -105,13 +107,11 @@ function nbDialog(msg, buttons, proc, closure) {
button.onclick = function() {
Module.ccall('onDlgButton', null, ['number', 'number', 'string'],
[proc, closure, buttonTxt]);
dlg.style.display = 'none'; // hide
container.removeChild(dlg);
};
span.appendChild( button );
}
dlg.appendChild( span );
dlg.style.display = 'block'; // reveal
}
for ( let one of ['paho-mqtt.js'] ) {