edited

 avatar
unknown
javascript
4 years ago
2.4 kB
7
Indexable
   function openNewPostIframe(link) {
      chrome.runtime.sendMessage({message: 'NEW_POST_ACCESSED'});
      var EXT_URL = `chrome-extension://${chrome.runtime.id}`

        let iframe = document.querySelector('iframe#limitReached');
        if (!iframe || iframe == null) {
        iframe = document.createElement('iframe');
        iframe.src = `${EXT_URL + '/widget/reply_form.html?' + link}`;
        iframe.setAttribute('frameborder', '0');
        iframe.setAttribute('scrolling', 'yes');
        iframe.setAttribute('id', 'limitReached');
        iframe.setAttribute('style', `position: fixed;
                top: 50px;
                display: block;
                width: 60% !important;
                height: 530px;
                left: 20%;
                margin-left: -1px;
                z-index: 99999999999999;
                -webkit-box-shadow: -12px 0px 148px 110px rgba(50,50,50,.3);
                //*-webkit-box-shadow: -12px 0px 148px 110px rgba(0,0,0,0.3);*//
                -moz-box-shadow: -12px 0px 148px 110px rgba(0,0,0,0.3);
                transition: opacity .5s linear;
                opacity: 0;
        `);
        setTimeout(() => {
            iframe.style.opacity = 1;
        }, 100);
        iframe.style.setProperty("z-index", "2147483647", "important");
        rootElement = document.querySelector('#overlay_Div1');
        document.body.appendChild(iframe);
        iframeClose = document.createElement('div');
        iframeClose.setAttribute('id', 'iframeClose');
        iframeClose.onclick = function() {
            document.querySelector('iframe#limitReached').style.opacity = 0;
            setTimeout(() => {
            document.querySelector('iframe#limitReached').remove();
            this.remove();
            }, 100);
        }
        iframeClose.setAttribute('style', `position: fixed;
                top: 50px;
                margin-top: 20px;
                display: block;
                height: 61%;
                left: calc(80% - 50px);
                font-family: poppins, arial;
                font-size: 12px;
                color: gray;
                font-weight: 600;
                border: 1px solid transparent;
                border-radius: 10px;
                cursor: pointer;
                z-index: 2147483648;
            `);
        iframeClose.textContent = 'CLOSE';
        document.body.appendChild(iframeClose);
        return iframe;
    }
Editor is loading...