function Overlay(type, dialogueid) {
this.dialogueid = dialogueid || overlays_stack.getNextId();
this.headerid = 'overlay-dialogue-header-title-' + this.dialogueid;
this.$backdrop = jQuery('<div>', {
'data-dialogueid': this.dialogueid
this.$dialogue = jQuery('<div>', {
'class': 'overlay-dialogue modal',
'data-dialogueid': this.dialogueid,
'aria-labelledby': this.headerid
this.$dialogue.$header = jQuery('<h4>', {id: this.headerid});
const $close_btn = jQuery('<button>', {
class: 'btn-overlay-close',
overlayDialogueDestroy(this.dialogueid);
this.$dialogue.$controls = jQuery('<div>', {class: 'overlay-dialogue-controls'});
this.$dialogue.$head = jQuery('<div>', {class: 'overlay-dialogue-header'});
this.$dialogue.$body = jQuery('<div>', {class: 'overlay-dialogue-body'});
this.$dialogue.$debug = jQuery('<pre>', {class: 'debug-output'});
this.$dialogue.$footer = jQuery('<div>', {class: 'overlay-dialogue-footer'});
this.$dialogue.$script = jQuery('<script>');
this.$dialogue.$head.append(this.$dialogue.$header, $close_btn);
this.$dialogue.append(this.$dialogue.$head);
this.$dialogue.append(this.$dialogue.$body);
this.$dialogue.append(this.$dialogue.$footer);
this.$dialogue.$body.on('submit', 'form', function(e) {
if (this.$btn_submit && this.$btn_submit.prop('disabled') === false) {
this.$btn_submit.trigger('click');
this.center_dialog_animation_frame = null;
this.center_dialog_function = () => {
if (this.center_dialog_animation_frame !== null) {
cancelAnimationFrame(this.center_dialog_animation_frame);
this.center_dialog_animation_frame = requestAnimationFrame(() => {
this.center_dialog_animation_frame = null;
var body_mutation_observer = window.MutationObserver || window.WebKitMutationObserver;
this.body_mutation_observer = new body_mutation_observer(this.center_dialog_function);
jQuery(window).resize(function() {
this.$dialogue.is(':visible') && this.centerDialog();