2017-02-03 23:05:59 +01:00
|
|
|
/* Pop up Dialog Box */
|
2017-05-24 15:49:52 +02:00
|
|
|
|
|
|
|
//Close dialog box when clicking outside
|
|
|
|
$(document).click(function(event) {
|
2017-06-01 06:17:50 +02:00
|
|
|
if (dialogBoxOpened) {
|
|
|
|
if (!$(event.target).closest('.dialog-box-container').length){
|
|
|
|
--dialogBoxCount;
|
|
|
|
$(".dialog-box-container").remove();
|
|
|
|
if (dialogBoxCount == 0) {
|
|
|
|
dialogBoxOpened = false;
|
|
|
|
}
|
2017-05-24 15:49:52 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2017-06-01 06:17:50 +02:00
|
|
|
//Dialog box close buttons
|
|
|
|
$(document).on('click', '.dialog-box-close-button', function( event ) {
|
|
|
|
console.log("clicked close button");
|
|
|
|
if (dialogBoxOpened) {
|
|
|
|
$(this).closest('.dialog-box-container').remove();
|
|
|
|
--dialogBoxCount;
|
|
|
|
if (dialogBoxCount == 0) {
|
|
|
|
dialogBoxOpened = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2017-02-03 23:05:59 +01:00
|
|
|
|
2017-06-01 06:17:50 +02:00
|
|
|
var dialogBoxOpened = false;
|
|
|
|
var dialogBoxCount = 0;
|
2017-02-03 23:05:59 +01:00
|
|
|
|
2017-06-01 06:17:50 +02:00
|
|
|
dialogBoxCreate = function(txt) {
|
|
|
|
var container = document.createElement("div");
|
|
|
|
container.setAttribute("class", "dialog-box-container");
|
|
|
|
|
|
|
|
var content = document.createElement("div");
|
|
|
|
content.setAttribute("class", "dialog-box-content");
|
|
|
|
|
|
|
|
var closeButton = document.createElement("span");
|
|
|
|
closeButton.setAttribute("class", "dialog-box-close-button");
|
|
|
|
closeButton.innerHTML = "×"
|
|
|
|
|
|
|
|
var textE = document.createElement("p");
|
|
|
|
textE.innerHTML = txt;
|
|
|
|
|
|
|
|
content.appendChild(closeButton);
|
|
|
|
content.appendChild(textE);
|
|
|
|
container.appendChild(content);
|
|
|
|
|
|
|
|
document.body.appendChild(container);
|
|
|
|
|
2017-05-24 15:49:52 +02:00
|
|
|
setTimeout(function() {
|
|
|
|
dialogBoxOpened = true;
|
2017-06-01 06:17:50 +02:00
|
|
|
++dialogBoxCount;
|
2017-05-24 15:49:52 +02:00
|
|
|
}, 500);
|
2017-02-03 23:05:59 +01:00
|
|
|
}
|