您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
手动更改 GoDaddy 域名的 DNS 服务器,允许用户输入域名服务器并点击按钮进行填充
当前为
// ==UserScript== // @name GoDaddy Nameserver Changer with User Input and Button // @namespace http://tampermonkey.net/ // @version 1.8 // @description 手动更改 GoDaddy 域名的 DNS 服务器,允许用户输入域名服务器并点击按钮进行填充 // @author hatrd // @match https://dcc.godaddy.com/control/portfolio/* // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; // 创建并添加输入区域和按钮 function createUI() { const container = document.createElement('div'); container.style.position = 'fixed'; container.style.top = '10px'; container.style.right = '10px'; container.style.zIndex = '9999'; container.style.backgroundColor = '#fff'; container.style.border = '1px solid #ccc'; container.style.padding = '10px'; container.style.boxShadow = '0 0 10px rgba(0,0,0,0.1)'; const textarea = document.createElement('textarea'); textarea.rows = 4; textarea.cols = 40; textarea.placeholder = '请输入域名服务器,每行一个,最多四个'; const button = document.createElement('button'); button.textContent = '填充域名服务器'; button.addEventListener('click', () => { const userInput = textarea.value; if (userInput) { // 将用户输入的内容按行分割 const newNameservers = userInput.split('\n').map(ns => ns.trim()).filter(ns => ns); // 去除末尾的点 const sanitizedNameservers = newNameservers.map(ns => ns.replace(/\.$/, '')); // 填写域名服务器输入框 function fillNameservers() { let currentIndex = 0; function fillNextNameserver() { if (currentIndex >= sanitizedNameservers.length) return; const ns = sanitizedNameservers[currentIndex]; const nsInputId = `#nameserver${currentIndex + 1}`; waitForElement(nsInputId, (nsInput) => { nsInput.focus(); // 模拟粘贴输入 nsInput.value = ''; // 清空输入框内容 nsInput.select(); document.execCommand('insertText', false, ns); // 插入文本 nsInput.dispatchEvent(new Event('input', { bubbles: true })); // 触发输入事件 nsInput.dispatchEvent(new Event('change', { bubbles: true })); // 触发更改事件 currentIndex++; }); // 递归调用填写下一个域名服务器 if (currentIndex < sanitizedNameservers.length) { setTimeout(fillNextNameserver, 500 + Math.random() * 500); // 添加随机时间间隔 } } fillNextNameserver(); } // 等待指定元素加载完毕的函数 function waitForElement(selector, callback) { const interval = setInterval(() => { const element = document.querySelector(selector); if (element) { clearInterval(interval); callback(element); } }, 100); } // 开始填充 fillNameservers(); } }); container.appendChild(textarea); container.appendChild(button); document.body.appendChild(container); } // 等待页面加载完毕后创建UI window.addEventListener('load', createUI); })();