;(function() {
const popup = document.createElement("div");
popup.className = "dmn-booking-popup";
popup.innerHTML = `
`;
document.body.appendChild(popup);
// Cache the container and the script/CSS–only inject once
const widgetContainer = document.getElementById("booking-widget-container");
let assetsInjected = false;
document.addEventListener("click", function(e) {
const target = e.target.closest('a[href="#book"]');
if (!target) return;
e.preventDefault();
popup.style.display = "block";
// On every open, clear any previous widget markup
widgetContainer.innerHTML = "";
// Inject assets only the first time
if (!assetsInjected) {
// 1) CSS
const cssLink = document.createElement("link");
cssLink.rel = "stylesheet";
cssLink.type = "text/css";
cssLink.href = "https://onsass.designmynight.com/?background-color=%23FFFFFF&primary-color=%236DA8A6&body-text-color=%23000000&outer-border-color=gray";
document.head.appendChild(cssLink);
// 2) Script — creates the actual DesignMyNight widget
const script = document.createElement("script");
script.id = "dmn-booking-script";
script.src = "//widgets.designmynight.com/bookings-partner.min.js";
script.setAttribute("dmn-booking-form", "true");
script.setAttribute("venue", "5c6d66755a05b63f0e02b894");
script.setAttribute("hide-offers", "false");
script.setAttribute("hide-powered-by", "false");
script.setAttribute("search-venues", "false");
script.setAttribute("monday-first", "true");
script.setAttribute("locale", "undefined");
script.setAttribute("show-type-first", "true");
script.setAttribute("google-analytics-code", "G-ND7CQG6E9G");
script.setAttribute("google-tag-manager-code", "GTM-T9T86DWQ");
widgetContainer.appendChild(script);
assetsInjected = true;
} else {
// On subsequent opens, re-create the widget element only
const widget = document.createElement("script");
widget.src = "//widgets.designmynight.com/bookings-partner.min.js";
widget.setAttribute("dmn-booking-form", "true");
widget.setAttribute("venue", "5c6d66755a05b63f0e02b894");
widget.setAttribute("hide-offers", "false");
widget.setAttribute("hide-powered-by", "false");
widget.setAttribute("search-venues", "false");
widget.setAttribute("monday-first", "true");
widget.setAttribute("locale", "undefined");
widget.setAttribute("show-type-first", "true");
widget.setAttribute("google-analytics-code", "G-ND7CQG6E9G");
widget.setAttribute("google-tag-manager-code", "GTM-T9T86DWQ");
widgetContainer.appendChild(widget);
}
});
// Close the popup when the "X" is clicked
popup.querySelector(".close-button").addEventListener("click", () => {
popup.style.display = "none";
});
// Also close the popup if the user clicks outside the modal
window.addEventListener("click", function(e) {
if (e.target === popup) {
popup.style.display = "none";
}
});
})();
Order Now