Gang bug fixes. Issues #574 and #575

This commit is contained in:
danielyxie
2019-04-13 00:26:49 -07:00
committed by danielyxie
parent 215cf59e0b
commit f6af9e94ab
3 changed files with 27 additions and 19 deletions
+9 -4
View File
@@ -1,7 +1,11 @@
/* Pop up Dialog Box */
/**
* Create and display a pop-up dialog box.
* This dialog box does not allow for any interaction and should close when clicking
* outside of it
*/
let dialogBoxes = [];
//Close dialog box when clicking outside
// Close dialog box when clicking outside
$(document).click(function(event) {
if (dialogBoxOpened && dialogBoxes.length >= 1) {
if (!$(event.target).closest(dialogBoxes[0]).length){
@@ -17,7 +21,7 @@ $(document).click(function(event) {
});
//Dialog box close buttons
// Dialog box close buttons
$(document).on('click', '.dialog-box-close-button', function( event ) {
if (dialogBoxOpened && dialogBoxes.length >= 1) {
dialogBoxes[0].remove();
@@ -30,9 +34,10 @@ $(document).on('click', '.dialog-box-close-button', function( event ) {
}
});
var dialogBoxOpened = false;
let dialogBoxOpened = false;
function dialogBoxCreate(txt, preformatted=false) {
console.log(`dialogBoxCreate() called`)
var container = document.createElement("div");
container.setAttribute("class", "dialog-box-container");