This repository has been archived on 2023-01-26. You can view files and clone it, but cannot push or open issues or pull requests.
scripts-old/src/utils/showPopup.js

25 lines
771 B
JavaScript

const POPUP_WRAPPER_SELECTOR = '.popup_helper';
const POPUP_SELECTOR = '#inline_popup';
export default ({ e, title, html, id } = {}) => {
const popup = document.querySelector(POPUP_SELECTOR);
if (popup) {
popup.style.width = 'auto';
popup.style.maxWidth = '1000px';
}
if (popup.classList.contains('show')) {
popup.querySelector('#inline_popup_title').innerHTML = title;
popup.querySelector('#inline_popup_content').innerHTML = html;
} else {
inlinePopup(e, id, null, { offset_x: 0, offset_y: 0 }, html, title);
}
const popupWrapper = document.querySelector(POPUP_WRAPPER_SELECTOR);
if (popupWrapper) {
popupWrapper.style.width = 'auto';
popupWrapper.style.position = 'fixed';
popupWrapper.style.zIndex = '50001';
}
};