您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
获取本机的外网IP地址
// ==UserScript== // @name 获取本机外网IP地址 // @namespace http://tampermonkey.net/ // @version 0.5 // @description 获取本机的外网IP地址 // @author jflmao // @match *://*/* // @icon https://www.ipip.net/favicon.ico // @grant GM_registerMenuCommand // @grant GM_xmlhttpRequest // @grant GM_setClipboard // @grant GM_notification // @connect myip.ipip.net // @license MIT // ==/UserScript== (function() { 'use strict'; GM_xmlhttpRequest({ url:"https://myip.ipip.net/", method :"GET", headers: { "Content-type": "application/x-www-form-urlencoded" }, onload:function(xhr){ console.log(xhr.responseText); GM_registerMenuCommand(xhr.responseText, () => { var reg = /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/; var str = xhr.responseText.match(reg); console.log(str); GM_setClipboard(str); GM_notification("IP地址已复制到剪切板!"); }); } }); })();