Chuyển đổi địa chỉ email sang định dạng email ẩn danh của DuckDuckGo

Chuyển đổi email sang định dạng email ẩn danh của DuckDuckGo, giờ có chức năng thu nhỏ

Tính đến 31-03-2025. Xem phiên bản mới nhất.

// ==UserScript==
// @name         Convert Email Address to DuckDuckGo Anonymous email format
// @description  Converts an email to duckgo anonymous email format, now with minimize functionality
// @name:ar      تحويل عنوان البريد الإلكتروني إلى تنسيق بريد DuckDuckGo المجهول
// @description:ar  يحول بريدًا إلكترونيًا إلى تنسيق بريد DuckDuckGo المجهول، مع وظيفة التصغير الآن
// @name:bg      Преобразуване на имейл адрес в анонимен формат на DuckDuckGo
// @description:bg  Преобразува имейл в анонимен формат на DuckDuckGo, сега с функция за минимизиране
// @name:cs      Převod e-mailové adresy do anonymního formátu DuckDuckGo
// @description:cs  Převede e-mail do anonymního formátu DuckDuckGo, nyní s funkcí minimalizace
// @name:da      Konverter e-mailadresse til DuckDuckGo anonymt e-mailformat
// @description:da  Konverterer en e-mail til DuckDuckGo anonymt e-mailformat, nu med minimeringsfunktion
// @name:de      E-Mail-Adresse in DuckDuckGo anonymes E-Mail-Format umwandeln
// @description:de  Wandelt eine E-Mail in das anonyme E-Mail-Format von DuckDuckGo um, jetzt mit Minimierungsfunktion
// @name:el      Μετατροπή διεύθυνσης email σε ανώνυμη μορφή email DuckDuckGo
// @description:el  Μετατρέπει ένα email σε ανώνυμη μορφή email DuckDuckGo, τώρα με λειτουργία ελαχιστοποίησης
// @name:en      Convert Email Address to DuckDuckGo Anonymous email format
// @description:en  Converts an email to duckgo anonymous email format, now with minimize functionality
// @name:eo      Konverti Retpoŝtadreson al DuckDuckGo Anonima Retpoŝtformato
// @description:eo  Konvertas retpoŝton al anonima retpoŝtformato de DuckDuckGo, nun kun minimumiga funkcio
// @name:es      Convertir dirección de correo a formato de correo anónimo de DuckDuckGo
// @description:es  Convierte un correo a formato de correo anónimo de DuckDuckGo, ahora con función de minimización
// @name:fi      Muunna sähköpostiosoite DuckDuckGo-anonyymiin sähköpostimuotoon
// @description:fi  Muuntaa sähköpostin DuckDuckGo-anonyymiksi sähköpostimuodoksi, nyt minimoimistoiminnolla
// @name:fr      Convertir une adresse e-mail au format e-mail anonyme de DuckDuckGo
// @description:fr  Convertit un e-mail au format e-mail anonyme de DuckDuckGo, maintenant avec fonction de minimisation
// @name:fr-CA   Convertir une adresse courriel au format courriel anonyme de DuckDuckGo
// @description:fr-CA  Convertit un courriel au format courriel anonyme de DuckDuckGo, maintenant avec fonction de réduction
// @name:he      המרת כתובת דוא"ל לפורמט דוא"ל אנונימי של DuckDuckGo
// @description:he  ממיר דוא"ל לפורמט דוא"ל אנונימי של DuckDuckGo, כעת עם פונקציית מזעור
// @name:hr      Pretvori adresu e-pošte u DuckDuckGo anonimni format e-pošte
// @description:hr  Pretvara e-poštu u anonimni format e-pošte DuckDuckGo, sada s funkcijom minimiziranja
// @name:hu      E-mail cím átalakítása DuckDuckGo anonim e-mail formátumba
// @description:hu  Átalakít egy e-mailt DuckDuckGo anonim e-mail formátummá, most minimalizálási funkcióval
// @name:id      Konversi Alamat Email ke Format Email Anonim DuckDuckGo
// @description:id  Mengonversi email ke format email anonim DuckDuckGo, kini dengan fungsi minimalkan
// @name:it      Converti indirizzo email in formato email anonimo di DuckDuckGo
// @description:it  Converte un’email nel formato email anonimo di DuckDuckGo, ora con funzione di minimizzazione
// @name:ja      メールアドレスを DuckDuckGo の匿名メール形式に変換
// @description:ja  メールをDuckGoの匿名メール形式に変換し、最小化機能が追加されました
// @name:ka      ელფოსტის მისამართის გარდაქმნა DuckDuckGo-ს ანონიმური ელფოსტის ფორმატში
// @description:ka  გარდაქმნის ელფოსტას DuckDuckGo-ს ანონიმური ელფოსტის ფორმატში, ახლა მინიმიზაციის ფუნქციით
// @name:ko      이메일 주소를 DuckDuckGo 익명 이메일 형식으로 변환
// @description:ko  이메일을 DuckDuckGo 익명 이메일 형식으로 변환, 이제 최소화 기능 포함
// @name:nb      Konverter e-postadresse til DuckDuckGo anonymt e-postformat
// @description:nb  Konverterer en e-post til DuckDuckGo anonymt e-postformat, nå med minimeringsfunksjon
// @name:nl      E-mailadres converteren naar DuckDuckGo anoniem e-mailformaat
// @description:nl  Converteert een e-mail naar het anonieme e-mailformaat van DuckDuckGo, nu met minimalisatiefunctie
// @name:pl      Konwertuj adres e-mail na anonimowy format e-mail DuckDuckGo
// @description:pl  Konwertuje e-mail na anonimowy format e-mail DuckDuckGo, teraz z funkcją minimalizacji
// @name:pt-BR   Converter endereço de e-mail para o formato de e-mail anônimo do DuckDuckGo
// @description:pt-BR  Converte um e-mail para o formato de e-mail anônimo do DuckDuckGo, agora com função de minimização
// @name:ro      Convertiți adresa de e-mail în formatul de e-mail anonim DuckDuckGo
// @description:ro  Convertește un e-mail în formatul de e-mail anonim DuckDuckGo, acum cu funcționalitate de minimizare
// @name:ru      Преобразовать адрес электронной почты в анонимный формат DuckDuckGo
// @description:ru  Преобразует email в анонимный формат DuckDuckGo, теперь с функцией минимизации
// @name:sk      Previesť e-mailovú adresu na anonymný formát e-mailu DuckDuckGo
// @description:sk  Prevedie e-mail na anonymný formát e-mailu DuckDuckGo, teraz s funkciou minimalizácie
// @name:sr      Претвори адресу е-поште у анонимни формат е-поште DuckDuckGo
// @description:sr  Претвара е-пошту у анонимни формат е-поште DuckDuckGo, сада са функцијом минимизације
// @name:sv      Konvertera e-postadress till DuckDuckGo anonymt e-postformat
// @description:sv  Omvandlar en e-post till DuckDuckGo anonymt e-postformat, nu med minimeringsfunktion
// @name:th      แปลงที่อยู่อีเมลเป็นรูปแบบอีเมลนิรนามของ DuckDuckGo
// @description:th  แปลงอีเมลเป็นรูปแบบอีเมลนิรนามของ DuckDuckGo พร้อมฟังก์ชันย่อขนาด
// @name:tr      E-posta Adresini DuckDuckGo Anonim E-posta Formatına Dönüştür
// @description:tr  Bir e-postayı DuckDuckGo anonim e-posta formatına dönüştürür, şimdi küçültme işleviyle
// @name:ug      ئېلخەت ئادرېسىنى DuckDuckGo نامسىز ئېلخەت فورماتىغا ئايلاندۇرۇش
// @description:ug  ئېلخەتنى DuckDuckGo نامسىز ئېلخەت فورماتىغا ئايلاندۇرىدۇ، ھازىر كىچىكلەتكۈچى ئىقتىدارى بىلەن
// @name:uk      Перетворити адресу електронної пошти у анонімний формат DuckDuckGo
// @description:uk  Перетворює email у анонімний формат DuckDuckGo, тепер із функцією мінімізації
// @name:vi      Chuyển đổi địa chỉ email sang định dạng email ẩn danh của DuckDuckGo
// @description:vi  Chuyển đổi email sang định dạng email ẩn danh của DuckDuckGo, giờ có chức năng thu nhỏ
// @name:zh      将电子邮件地址转换为DuckDuckGo匿名邮件格式
// @description:zh  将电子邮件转换为DuckDuckGo匿名邮件格式
// @name:zh-CN   将电子邮件地址转换为DuckDuckGo匿名邮件格式
// @description:zh-CN  将电子邮件转换为DuckDuckGo匿名邮件格式
// @name:zh-HK   將電郵地址轉換為DuckDuckGo匿名電郵格式
// @description:zh-HK  將電郵轉換為DuckDuckGo匿名電郵格式
// @name:zh-SG   将电子邮件地址转换为DuckDuckGo匿名邮件格式
// @description:zh-SG  将电子邮件转换为DuckDuckGo匿名邮件格式
// @name:zh-TW   將電子郵件地址轉換為DuckDuckGo匿名郵件格式
// @description:zh-TW  將電子郵件轉換為DuckDuckGo匿名郵件格式
// @namespace    http://tampermonkey.net/
// @author       aspen138
// @version      1.1.3.3
// @match https://126.com/*
// @match https://abv.bg/*
// @match https://adelphia.net/*
// @match https://aim.com/*
// @match https://alice.it/*
// @match https://aol.com/*
// @match https://att.net/*
// @match https://bellsouth.net/*
// @match https://bigpond.com/*
// @match https://bluewin.ch/*
// @match https://blueyonder.co.uk/*
// @match https://bol.com.br/*
// @match https://btinternet.com/*
// @match https://charter.net/*
// @match https://comcast.net/*
// @match https://cox.net/*
// @match https://cs.com/*
// @match https://earthlink.net/*
// @match https://email.mail.com/*
// @match https://embarqmail.com/*
// @match https://excite.com/*
// @match https://exmail.qq.com/*
// @match https://work.weixin.qq.com/mail/
// @match https://fastmail.com/*
// @match https://free.fr/*
// @match https://frontiernet.net/*
// @match https://ge.com/*
// @match https://gmail.com/*
// @match https://gmx.com/*
// @match https://hetnet.nl/*
// @match https://home.nl/*
// @match https://hp.com/*
// @match https://icloud.com/mail/*
// @match https://ig.com.br/*
// @match https://insightbb.co/*
// @match https://juno.com/*
// @match https://laposte.net/*
// @match https://libero.it/*
// @match https://mac.com/*
// @match https://mail.126.com/*
// @match https://mail.163.com/*
// @match https://mail.apple.com/*
// @match https://mail.aol.com/*
// @match https://mail.fastmail.com/*
// @match https://mail.gmx.com/*
// @match https://mail.google.com/*
// @match https://mail.proton.me/*
// @match https://mail.qq.com/*
// @match https://mail.ru/*
// @match https://mail.sina.com/*
// @match https://mail.sina.com.cn/*
// @match https://mail.yahoo.com/*
// @match https://mail.yandex.com/*
// @match https://mail.zoho.com/*
// @match https://mchsi.com/*
// @match https://me.com/*
// @match https://mindspring.com/*
// @match https://msn.com/*
// @match https://netscape.net/*
// @match https://netzero.com/*
// @match https://netzero.net/*
// @match https://ntlworld.com/*
// @match https://optonline.net/*
// @match https://optusnet.com.au/*
// @match https://orange.fr/*
// @match https://outlook.com/*
// @match https://outlook.live.com/*
// @match https://pacbell.net/*
// @match https://peoplepc.com/*
// @match https://planet.nl/*
// @match https://prodigy.net/*
// @match https://proton.me/*
// @match https://rediffmail.com/*
// @match https://roadrunner.com/*
// @match https://rogers.com/*
// @match https://sbcglobal.net/*
// @match https://shaw.ca/*
// @match https://sky.com/*
// @match https://skynet.be/*
// @match https://sympatico.ca/*
// @match https://t-online.de/*
// @match https://talktalk.net/*
// @match https://telenet.be/*
// @match https://telus.net/*
// @match https://terra.com.br/*
// @match https://tiscali.co.uk/*
// @match https://tiscali.it/*
// @match https://trainingelite.com/*
// @match https://uol.com.br/*
// @match https://us.army.mil/*
// @match https://verizon.net/*
// @match https://videotron.ca/*
// @match https://virgilio.it/*
// @match https://wanadoo.fr/*
// @match https://web.de/*
// @match https://webtv.net/*
// @match https://windstream.net/*
// @match https://wp.pl/*
// @match https://www.mail.com/*
// @match https://xtra.co.nz/*
// @match https://yahoo.ca/*
// @match https://yahoo.co.id/*
// @match https://yahoo.co.in/*
// @match https://yahoo.co.uk/*
// @match https://yahoo.com/*
// @match https://yahoo.com.ar/*
// @match https://yahoo.com.au/*
// @match https://yahoo.com.br/*
// @match https://yahoo.com.cn/*
// @match https://yahoo.com.mx/*
// @match https://yahoo.com.sg/*
// @match https://yahoo.com/mail/*
// @match https://yahoo.de/*
// @match https://yahoo.es/*
// @match https://yahoo.fr/*
// @match https://yahoo.in/*
// @match https://yahoo.it/*
// @match https://ymail.com/*
// @match https://yandex.com/mail/*
// @match https://yandex.ru/*
// @match https://zoho.com/mail/*
// @icon         data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiB2aWV3Qm94PSIwIDAgMTI4IDEyOCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8cGF0aCBmaWxsPSIjZGU1ODMzIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik02NCAxMjhjMzUuMzQ2IDAgNjQtMjguNjU0IDY0LTY0IDAtMzUuMzQ2LTI4LjY1NC02NC02NC02NFMwIDI4LjY1NCAwIDY0YzAgMzUuMzQ2IDI4LjY1NCA2NCA2NCA2NHoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPgogIDxwYXRoIGZpbGw9IiNkZGQiIGZpbGwtcnVsZT0iZXZlbm9kZCIgZD0iTTczIDExMS43NWMwLS41LjEyMy0uNjE0LTEuNDY3LTMuNzgyLTQuMjI0LTguNDU5LTguNDY5LTIwLjM4NC02LjUzOC0yOC4wNzUuMzUyLTEuMzk3LTMuOTc5LTUxLjc0NC03LjA0LTUzLjM2NS0zLjQwMy0xLjgxMy03LjU5LTQuNjktMTEuNDE5LTUuMzMtMS45NDMtLjMxLTQuNDktLjE2NC02LjQ4Mi4xMDUtLjM1NC4wNDctLjM2OC42ODQtLjAzLjc5OCAxLjMwNy40NDMgMi44OTU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C4wNDUgMCAwIDEgNC4wNSA0LjAzN3ptLTEuMTkzLTEuMzM4YTEuMDUgMS4wNSAwIDAgMC0yLjA5NyAwIDEuMDQ3IDEuMDQ3IDAgMCAwIDIuMDk3IDB6IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz4KICA8L2c+CiAgPHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNjQgMTE3Ljc1YzI5LjY4NSAwIDUzLjc1LTI0LjA2NSA1My43NS01My43NVM5My42ODUgMTAuMjUgNjQgMTAuMjUgMTAuMjUgMzQuMzE1IDEwLjI1IDY0IDM0LjMxNSAxMTcuNzUgNjQgMTE3Ljc1em0wIDVjMzIuNDQ3IDAgNTguNzUtMjYuMzAzIDU4Ljc1LTU4Ljc1Uzk2LjQ0NyA1LjI1IDY0IDUuMjUgNS4yNSAzMS41NTMgNS4yNSA2NCAzMS41NTMgMTIyLjc1IDY0IDEyMi43NXoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPgo8L3N2Zz4K
// @iconbackup   https://ssl.gstatic.com/ui/v1/icons/mail/rfr/gmail.ico
// @license      MIT
// @grant        GM_getValue
// @grant        GM_setValue
// ==/UserScript==


(function() {
    'use strict';
    // Create a container for the floating box
    const container = document.createElement('div');
    container.id = 'emailConverter_container';
    container.style.position = 'fixed';
    container.style.bottom = '20px';
    container.style.left = '20px';
    container.style.zIndex = '9999';
    container.style.padding = '10px';
    container.style.backgroundColor = '#fff';
    container.style.border = '1px solid #ccc';
    container.style.borderRadius = '5px';
    container.style.boxShadow = '0 0 5px rgba(0,0,0,0.3)';
    container.style.fontFamily = 'Arial, sans-serif';
    container.style.maxWidth = '280px';

    // Title or heading
    const heading = document.createElement('h4');
    heading.id = 'emailConverter_heading';
    heading.textContent = 'Email Converter';
    heading.style.margin = '0 0 10px 0';
    container.appendChild(heading);

    // Close (minimize) button
    const minimizeButton = document.createElement('button');
    minimizeButton.id = 'emailConverter_minimizeBtn';
    minimizeButton.textContent = 'X';
    minimizeButton.style.position = 'absolute';
    minimizeButton.style.top = '5px';
    minimizeButton.style.right = '10px';
    minimizeButton.style.cursor = 'pointer';
    minimizeButton.style.border = 'none';
    minimizeButton.style.background = 'none';
    minimizeButton.style.fontSize = '16px';
    container.appendChild(minimizeButton);

    // This button will appear when the container is minimized
    const restoreButton = document.createElement('button');
    restoreButton.id = 'emailConverter_restoreBtn';
    restoreButton.textContent = 'Email Converter';
    restoreButton.style.position = 'fixed';
    restoreButton.style.left = '0';
    restoreButton.style.bottom = '20px';
    restoreButton.style.zIndex = '9999';
    restoreButton.style.padding = '6px 12px';
    restoreButton.style.cursor = 'pointer';
    restoreButton.style.border = '1px solid #ccc';
    restoreButton.style.borderRadius = '5px';
    restoreButton.style.fontFamily = 'Arial, sans-serif';
    restoreButton.style.backgroundColor = '#fff';
    restoreButton.style.boxShadow = '0 0 5px rgba(0,0,0,0.3)';
    container.style.display = 'none';
    restoreButton.style.display = 'block';
    document.body.appendChild(restoreButton);

    // Event listeners for minimize/restore
    minimizeButton.addEventListener('click', () => {
        container.style.display = 'none';
        restoreButton.style.display = 'block';
    });

    restoreButton.addEventListener('click', () => {
        container.style.display = 'block';
        restoreButton.style.display = 'none';
    });

    // Wrapper to neatly organize form elements
    const formWrapper = document.createElement('div');
    formWrapper.id = 'emailConverter_formWrapper';
    formWrapper.style.display = 'flex';
    formWrapper.style.flexDirection = 'column';
    formWrapper.style.gap = '5px';

    // Retrieve stored values (if any)
    const storedSendTo = GM_getValue('converterSendTo', '');
    const storedDdgo = GM_getValue('converterDdgo', '');

    // Label and input for "send email to who?"
    const labelSendTo = document.createElement('label');
    labelSendTo.id = 'emailConverter_labelSendTo';
    labelSendTo.textContent = 'Send email to who: ';
    labelSendTo.style.marginRight = '10px';

    const inputSendTo = document.createElement('input');
    inputSendTo.id = 'emailConverter_inputSendTo';
    inputSendTo.type = 'text';
    inputSendTo.placeholder = 'e.g. [email protected]';
    inputSendTo.style.width = '250px';
    inputSendTo.value = storedSendTo;

    const rowSendTo = document.createElement('div');
    rowSendTo.id = 'emailConverter_rowSendTo';
    rowSendTo.appendChild(labelSendTo);
    rowSendTo.appendChild(inputSendTo);

    // Label and input for "your ddgo mail?"
    const labelDdgo = document.createElement('label');
    labelDdgo.id = 'emailConverter_labelDdgo';
    labelDdgo.textContent = 'Your DuckDuckGo address: ';
    labelDdgo.style.marginRight = '10px';

    const inputDdgo = document.createElement('input');
    inputDdgo.id = 'emailConverter_inputDdgo';
    inputDdgo.type = 'text';
    inputDdgo.placeholder = 'e.g. [email protected]';
    inputDdgo.style.width = '250px';
    inputDdgo.value = storedDdgo;

    const rowDdgo = document.createElement('div');
    rowDdgo.id = 'emailConverter_rowDdgo';
    rowDdgo.appendChild(labelDdgo);
    rowDdgo.appendChild(inputDdgo);

    // Convert button
    const buttonConvert = document.createElement('button');
    buttonConvert.id = 'emailConverter_convertBtn';
    buttonConvert.textContent = 'Convert';
    buttonConvert.style.marginRight = '10px';
    buttonConvert.style.cursor = 'pointer';
    buttonConvert.style.width = '258px';

    // Output field for converted email
    const labelOutput = document.createElement('label');
    labelOutput.id = 'emailConverter_labelOutput';
    labelOutput.textContent = 'Converted: ';
    labelOutput.style.marginRight = '10px';

    const outputEmail = document.createElement('input');
    outputEmail.id = 'emailConverter_outputEmail';
    outputEmail.type = 'text';
    outputEmail.readOnly = true;
    outputEmail.style.width = '250px';

    const rowOutput = document.createElement('div');
    rowOutput.id = 'emailConverter_rowOutput';
    rowOutput.appendChild(labelOutput);
    rowOutput.appendChild(outputEmail);

    // Feedback or error message area
    const feedback = document.createElement('p');
    feedback.id = 'emailConverter_feedback';
    feedback.style.color = 'red';
    feedback.style.fontSize = '14px';
    feedback.style.margin = '5px 0 0 0';
    feedback.style.minHeight = '18px';
    feedback.textContent = '';

    // Conversion function
    buttonConvert.addEventListener('click', () => {
        const originalEmail = inputSendTo.value.trim();
        const ddgoEmail = inputDdgo.value.trim();
        let errorMessage = '';

        if (!originalEmail) {
            errorMessage = 'Please enter an email address to convert.';
        } else if (!ddgoEmail) {
            errorMessage = 'Please enter your DDG address.';
        }

        if (errorMessage) {
            feedback.textContent = errorMessage;
            outputEmail.value = '';
            return;
        }

        const converted = originalEmail.replace(/@/g, '_at_') + '_' + ddgoEmail;
        outputEmail.value = converted;
        feedback.textContent = '';

        GM_setValue('converterSendTo', originalEmail);
        GM_setValue('converterDdgo', ddgoEmail);
    });

    // Assemble elements in the container
    formWrapper.appendChild(rowSendTo);
    formWrapper.appendChild(rowDdgo);
    formWrapper.appendChild(buttonConvert);
    formWrapper.appendChild(rowOutput);
    formWrapper.appendChild(feedback);

    container.appendChild(formWrapper);
    document.body.appendChild(container);
})();