var toggleIframe = function() { var isFirstRun = true; var isOpen = false; var iframeWrapper = null; var iframeWrapperCssText = 'width:100%;height:100%;position:fixed;background:rgba(0,0,0,0.5);top:0;left:0;'; var firstRun = function(src) { /* wrapper */ iframeWrapper = document.createElement('div'); iframeWrapper.style.cssText = iframeWrapperCssText; document.body.appendChild(iframeWrapper); /* spinner */ var spinner = document.createElement('img'); spinner.src = 'http://vm.providesupport.com/images/common/loader.gif'; iframeWrapper.appendChild(spinner); spinner.style.cssText = 'position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);'; /* iframe */ var iframe = document.createElement('iframe'); iframe.style.cssText = 'width:94%;height:94%;margin:3%;border:none;position:fixed;'; iframe.src = src; iframeWrapper.appendChild(iframe); /* listener */ iframeWrapper.addEventListener('click', function(event) { if (!isOpen) return; const isOnSettingsPage = iframe.contains(event.target); if (!isOnSettingsPage){ toggle(); } }); isFirstRun = false; isOpen = true; } var toggle = function() { iframeWrapper.style.cssText = iframeWrapperCssText + (isOpen && 'display:none;'); isOpen = !isOpen; } return function(src) { if (isFirstRun) { firstRun(src); } else { toggle(); } } }();

deeeee

deeeee