1 line
1.5 KiB
JavaScript
1 line
1.5 KiB
JavaScript
"use strict";jsPanel.modal||(jsPanel.modal={version:"1.0.0",date:"2017-05-17 22:15",defaults:{headerControls:"closeonly",dragit:!1,resizeit:!1,syncMargins:!1},ziModalBase:1e4,addBackdrop:function(e){var a=document.getElementsByClassName("jsPanel-modal-backdrop").length,n=document.createElement("div");return n.id="jsPanel-modal-backdrop-"+e,0===a?n.className="jsPanel-modal-backdrop":a>0&&(n.className="jsPanel-modal-backdrop jsPanel-modal-backdrop-multi"),n.style.zIndex=this.ziModal.next(),n},removeBackdrop:function(e){var a=document.getElementById("jsPanel-modal-backdrop-"+e);a.classList.add("jsPanel-modal-backdrop-out");var n=1e3*parseFloat(getComputedStyle(a).animationDuration);window.setTimeout(function(){document.body.removeChild(a)},n)},create:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.paneltype="modal",e.id?"function"==typeof e.id&&(e.id=e.id()):e.id="jsPanel-"+(jsPanel.idCounter+=1);var a=e,n=this.addBackdrop(a.id);e.config&&delete(a=Object.assign({},e.config,e)).config,a=Object.assign({},this.defaults,a,{container:"body"}),document.body.append(n);return document.addEventListener("jspanelclosed",function e(n){var d=n.detail;d===a.id&&(jsPanel.modal.removeBackdrop(d),document.removeEventListener("jspanelclosed",e,!1))},!1),jsPanel.create(a,function(e){e.style.zIndex=jsPanel.modal.ziModal.next(),e.header.style.cursor="default",e.footer.style.cursor="default"})}},jsPanel.modal.ziModal=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:jsPanel.modal.ziModalBase;return{next:function(){return e++}}}()); |