Greasy Fork is available in English.
获取本机的外网IP地址
当前为
// ==UserScript==
// @name 获取本机外网IP地址
// @namespace http://tampermonkey.net/
// @version 0.2
// @description 获取本机的外网IP地址
// @author jflmao
// @match *://*/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=ipip.net
// @grant GM_registerMenuCommand
// @grant GM_xmlhttpRequest
// @grant GM_setClipboard
// @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)
});
}
});
})();