您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Converts an email to duckgo anonymous email formatt
当前为
// ==UserScript== // @name Convert Email Address to Duckduckgo Anonymous email format // @namespace http://tampermonkey.net/ // @author aspen138 // @version 1.0 // @description Converts an email to duckgo anonymous email formatt // @match https://mail.google.com/* // @match https://gmail.com/* // @grant none // @icon https://ssl.gstatic.com/ui/v1/icons/mail/rfr/gmail.ico // @license MIT // ==/UserScript== (function() { 'use strict'; // Create a container for the floating box const container = document.createElement('div'); 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.textContent = 'Email Converter'; heading.style.margin = '0 0 10px 0'; container.appendChild(heading); // Close button const closeButton = document.createElement('button'); closeButton.textContent = 'X'; closeButton.style.position = 'absolute'; closeButton.style.top = '5px'; closeButton.style.right = '10px'; closeButton.style.cursor = 'pointer'; closeButton.style.border = 'none'; closeButton.style.background = 'none'; closeButton.style.fontSize = '16px'; closeButton.addEventListener('click', function() { document.body.removeChild(container); }); container.appendChild(closeButton); // Wrapper to neatly organize form elements const formWrapper = document.createElement('div'); formWrapper.style.display = 'flex'; formWrapper.style.flexDirection = 'column'; formWrapper.style.gap = '5px'; // spacing between items // Create label and input for "send email to who?" const labelSendTo = document.createElement('label'); labelSendTo.textContent = 'Send email to who: '; labelSendTo.style.marginRight = '10px'; const inputSendTo = document.createElement('input'); inputSendTo.type = 'text'; inputSendTo.placeholder = 'e.g. [email protected]'; inputSendTo.style.width = '250px'; // Container for the "send email to who?" row const rowSendTo = document.createElement('div'); rowSendTo.appendChild(labelSendTo); rowSendTo.appendChild(inputSendTo); // Create label and input for "your ddgo mail?" const labelDdgo = document.createElement('label'); labelDdgo.textContent = 'Your DuckduckGo address: '; labelDdgo.style.marginRight = '10px'; const inputDdgo = document.createElement('input'); inputDdgo.type = 'text'; inputDdgo.placeholder = 'e.g. [email protected]'; inputDdgo.style.width = '250px'; // Container for the DDG mail row const rowDdgo = document.createElement('div'); rowDdgo.appendChild(labelDdgo); rowDdgo.appendChild(inputDdgo); // Create a button to trigger conversion const buttonConvert = document.createElement('button'); buttonConvert.textContent = 'Convert'; buttonConvert.style.marginRight = '10px'; buttonConvert.style.cursor = 'pointer'; buttonConvert.style.width = '250px'; // Create an input field for the output (read-only) const labelOutput = document.createElement('label'); labelOutput.textContent = 'Converted: '; labelOutput.style.marginRight = '10px'; const outputEmail = document.createElement('input'); outputEmail.type = 'text'; outputEmail.readOnly = true; outputEmail.style.width = '250px'; // Container for the output row const rowOutput = document.createElement('div'); // rowOutput.style.marginTop = '5px'; rowOutput.appendChild(labelOutput); rowOutput.appendChild(outputEmail); // Feedback or error message area const feedback = document.createElement('p'); feedback.style.color = 'red'; feedback.style.fontSize = '14px'; feedback.style.margin = '5px 0 0 0'; feedback.style.minHeight = '18px'; // keep space for feedback text feedback.textContent = ''; // Conversion function buttonConvert.addEventListener('click', function() { const originalEmail = inputSendTo.value.trim(); const ddgoEmail = inputDdgo.value.trim(); let errorMessage = ''; // Simple validations 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; } // Replace all '@' with '_at_' and append the ddgo email const converted = originalEmail.replace(/@/g, '_at_') + '_' + ddgoEmail; outputEmail.value = converted; feedback.textContent = ''; // clear any previous error message }); // 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); })();