diff --git a/javascript/embed.js b/javascript/embed.js index d0f76e7..9a31e2f 100644 --- a/javascript/embed.js +++ b/javascript/embed.js @@ -1,2 +1 @@ - -var ds07o6pcmkorn=function(e){var t=this;t.left=e.left||0,t.top=e.top||0,t.icon=e.iconSize||"big",t.url="https://staticcdn.co.nz",t.smallIcon=t.url+"/embed/sm.png",t.bigIcon=t.url+"/embed/lg.png",t.closeIcon=t.url+"/embed/close.png",t.elementId=e.openElementId||"",t.appended=!1,t.btn=function(){return'Enter the Shielded Site'},t.frame='',t.iconSize=function(e){return"big"===e?t.bigIcon:t.smallIcon},t.addButton=function(){document.body.insertAdjacentHTML("afterbegin",t.btn())},t.openFrame=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1,t.appended||(document.body.insertAdjacentHTML("afterbegin",t.frame),t.modalEl=document.getElementById("modal"),document.getElementById("frame-close").addEventListener("click",t.closeFrame),t.appended=!0),t.modalEl.style.display="block",document.body.style.overflow="hidden",t.frameOpenerEl.style.opacity=0},t.closeFrame=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1,document.body.removeAttribute("style"),t.modalEl.style.display="none",t.frameOpenerEl.style.opacity=1},t.init=function(){t.elementId?t.frameOpenerEl=document.querySelector(t.elementId):(t.addButton(),t.frameOpenerEl=document.getElementById("frame-opener")),t.frameOpenerEl.addEventListener("click",t.openFrame)}}; +var closeModal,ds07o6pcmkorn=function(e){var t=this;t.modalID=e.modalID||"modal",t.left=e.left||0,t.top=e.top||0,t.icon=e.iconSize||"big",t.url="https://staticcdn.co.nz",t.smallIcon=t.url+"/embed/sm.png",t.bigIcon=t.url+"/embed/lg.png",t.closeIcon=t.url+"/embed/close.png",t.elementId=e.openElementId||"",t.appended=!1,t.tab=function(){return'Enter the Shielded Site'},t.frame='',t.iconSize=function(e){return"big"===e?t.bigIcon:t.smallIcon},t.addTab=function(){document.body.insertAdjacentHTML("afterbegin",t.tab())},t.openFrame=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1,t.appended||(document.body.insertAdjacentHTML("afterbegin",t.frame),t.modalEl=document.getElementById(t.modalID),t.appended=!0),t.modalEl.style.display="block",document.body.style.overflow="hidden",Array.prototype.forEach.call(t.frameOpenerEl,function(e){e.style.opacity=0})},t.closeFrame=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1,document.body.removeAttribute("style"),t.modalEl.remove(),Array.prototype.forEach.call(t.frameOpenerEl,function(e){e.style.opacity=1}),t.appended=!1},closeModal=t.closeFrame,t.init=function(){t.elementId||(t.elementId="#frame-opener",t.addTab()),t.frameOpenerEl=document.querySelectorAll(t.elementId),Array.prototype.forEach.call(t.frameOpenerEl,function(e){e.addEventListener("click",t.openFrame)})}};window.addEventListener("message",e=>{"closeModal"===e.data&&closeModal(e)},!1); \ No newline at end of file