class FindEmail {
    constructor() {
        this.storedAddresses = [];
        this.page = document;
        this.emailAddresses = [];
        this.keyExisting = {};

        this.getEmailAddresses();
        this.render();
    }

    getEmailAddresses() {
        const source = this.page.documentElement.innerHTML;
        // Improved regex for emails
        const temp = source.match(/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/gi);
        if (temp) {
            const checkAddresses = {};
            for (const addr of temp) {
                const currentAddress = addr.toUpperCase();
                if (!checkAddresses[currentAddress]) {
                    this.emailAddresses.push(currentAddress);
                    checkAddresses[currentAddress] = 1;
                }
            }
        }
    }

    copyAll(hidden) {
        hidden.select();
        document.execCommand("copy");
        // Optionally show message: alert('Copied To Clipboard');
    }

    render() {
        // OUTER: handles border radius + clipping for scrollbars
        const outer = this.page.createElement('div');
        outer.style.position = 'fixed';
        outer.style.right = 'calc(min(1300vw) / 3/3/3)';
        outer.style.top = 'CALC(2600VH/3/3/3)';
        outer.style.zIndex = '256';
        outer.style.borderRadius = '50%';
        outer.style.overflow = 'hidden';
        outer.style.width = 'calc(min(100vw) / 3/3/3)';
        outer.style.height = 'calc(min(100vh)/3/3/3)';
        outer.style.background = '#fff';
        outer.style.setProperty('--O_SUIDAR_RULB_O_BLUR_RADIUS_O','CALC(MAX(100VW,100VH)/3/3/3/3/3)');
        outer.style.setProperty('--O_SUIDAR_DAERPS_O_SPREAD_RADIUS_O', 'CALC(MAX(100VW,100VH)/3/3/3/3/3/3)');
        outer.style.setProperty('--O_ROLOC_O_COLOR_O', '#E3E3E3');
        outer.style.boxShadow = 'INSET 0 0 VAR(--O_SUIDAR_RULB_O_BLUR_RADIUS_O) VAR(--O_SUIDAR_DAERPS_O_SPREAD_RADIUS_O) VAR(--O_ROLOC_O_COLOR_O),0 0 VAR(--O_SUIDAR_RULB_O_BLUR_RADIUS_O) VAR(--O_SUIDAR_DAERPS_O_SPREAD_RADIUS_O) VAR(--O_ROLOC_O_COLOR_O)';

        // INNER: scrollable content
        const results = this.page.createElement('div');
        results.style.height = '100%';
        results.style.overflowY = 'HIDDEN';
        results.style.overflowX = 'auto';
        results.style.padding = '0px';
        results.style.boxSizing = 'border-box';
        results.style.textAlign = 'center';
        results.style.fontSize = 'calc(MAX(100VW,100VH)/3/3/3/3/1.25)';
        results.style.lineHeight = '1';
        results.style.margin = 'auto';
        results.style.border = 'solid 0px #EEEEEE';
        

        // Hidden textarea for clipboard copy
        const hiddenText = this.page.createElement('textarea');
        hiddenText.style.opacity = '0';
        hiddenText.style.height = '1px';
        hiddenText.style.width = '1px';
        hiddenText.style.position = 'fixed';
        hiddenText.style.pointerEvents = 'none';

        // --- Add Copy All Button BEFORE header ---
        const clickButton = this.page.createElement('a');
        clickButton.style.textDecoration = 'none';
        clickButton.style.color = '#A8A8A8';
        clickButton.style.cursor = 'pointer';
        clickButton.innerHTML = 'โšช<BR>';
        clickButton.addEventListener('click', () => this.copyAll(hiddenText));
        results.appendChild(clickButton);

        // Now add the header (domain name)
        const header = this.page.createElement('FONT');
        header.textContent = window.location.hostname.toUpperCase();
        results.appendChild(header);
        results.appendChild(this.page.createElement('br'));

        if (this.emailAddresses && this.emailAddresses.length > 0) {
            results.style.backgroundColor = '#FFFFFF84';
            hiddenText.value = this.emailAddresses.join('\r\n');

            // --- Add the email address links ---
            for (const addr of this.emailAddresses) {
                const a = this.page.createElement('a');
                a.href = 'mailto:' + addr;
                a.textContent = addr;
                a.style.textDecoration = 'none';
                a.style.paddingLeft = '0px';
                a.style.color = '#A8A8A8';
                results.appendChild(a);
                results.appendChild(this.page.createElement('br'));
            }
        } else {
            results.style.backgroundColor = '#FFFFFF84';
            results.innerHTML += "โ—Œ";
        }

        // Append hidden textarea to DOM for copy operation
        results.appendChild(hiddenText);

        // Mount to page
        outer.appendChild(results);
        this.page.body.appendChild(outer);
    }
}

// Initialize
const findEmail = new FindEmail();

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: