Email Address Extractor (Alert on Success)

Scans the entire current webpage for unique email addresses ([email protected]) and displays them in a simple alert box if any are found. The script remains completely silent if no emails are detected.

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

You will need to install an extension such as Tampermonkey to install this script.

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         Email Address Extractor (Alert on Success)
// @namespace    http://tampermonkey.net/
// @version      1.3
// @description  Scans the entire current webpage for unique email addresses ([email protected]) and displays them in a simple alert box if any are found. The script remains completely silent if no emails are detected.
// @author       Gemini
// @match        *://*/*
// @grant        window.alert
// @run-at       document-idle
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // A simple, un-minified Regular Expression pattern to match most common email formats.
    const emailRegex = /([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi;

    // Get the visible text content from the body of the page.
    const pageText = document.body.innerText;

    // Execute the search for email matches.
    const emails = pageText.match(emailRegex);

    // Check if matches were found AND the array is not empty.
    if (emails && emails.length > 0) {
        
        // 1. Remove duplicates by converting the array to a Set and back to an array.
        const uniqueEmails = [...new Set(emails)];

        // 2. Format the output string for the alert box.
        const result = `--- Email Extraction Complete ---\n\n` +
                       `Found ${uniqueEmails.length} unique email(s) on this page:\n\n` +
                       uniqueEmails.join('\n');

        // 3. Display the results.
        window.alert(result);
    }
    // Per the user request, the script is silent if no emails are found.

})();