import { $gettext } from './gettext.js'; const Overlay = { delay: 300, element: null, selector: '.ui-front.modal-overlay', timeout: null }; Overlay.reset = function() { if (this.timeout !== null) { clearTimeout(this.timeout); this.timeout = null; } }; Overlay.schedule = function(callback, delay) { this.reset(); if (delay !== undefined && !delay) { callback.call(this); } else { this.timeout = setTimeout(callback.bind(this), this.delay); } }; Overlay.show = function(ajax, containment, secure, callback, delay) { this.schedule(function() { if (this.element === null) { containment = containment || 'body'; this.element = $('