diff --git a/Ping.Sx-Enhanced.user.js b/Ping.Sx-Enhanced.user.js
index 8337be3..828e90d 100644
--- a/Ping.Sx-Enhanced.user.js
+++ b/Ping.Sx-Enhanced.user.js
@@ -2,11 +2,11 @@
// @name Ping.Sx enhancement
// @name:zh-CN Ping.Sx 增强
// @name:zh-TW Ping.Sx 增強
-// @version 1.0.3
+// @version 1.0.4
// @author X.I.U
// @description Copy all IPs with one click, clean IP links (click Copy instead of Jump), and quickly go back to the top (blank space on both sides of the right click).
-// @description:zh-CN 一键复制所有 IP、清理 IP 链接(点击复制而不是跳转)、快捷回到顶部(右键两侧空白处)
-// @description:zh-TW 一鍵複製所有 IP、清理 IP 鏈接(點擊複製而不是跳轉)、快捷回到頂部(右鍵兩側空白處)
+// @description:zh-CN 一键复制所有 IP、快捷回到顶部(右键两侧空白处)
+// @description:zh-TW 一鍵複製所有 IP、快捷回到頂部(右鍵兩側空白處)
// @match https://ping.sx/ping*
// @match https://ping.sx/dig*
// @match https://ping.sx/check-port*
@@ -36,20 +36,107 @@
// 站长之家
// let ip = new Array(); document.querySelectorAll('[name=ip]>a').forEach(function(_this) {ip.push(_this.innerText);});console.log(Array.from(new Set(ip)).sort().toString().replaceAll(',','\n'))
- window.addEventListener('urlchange', function() {addCopyButton(); cleanLinks(); backToTop();});
+ window.addEventListener('urlchange', function() {addCopyButton(); /*cleanLinks();*/ backToTop();});
setTimeout(addCopyButton, 2000); // 添加复制按钮
- setTimeout(cleanLinks, 2000); // 清理链接(可以直接点击复制单个 IP)
+ //setTimeout(cleanLinks, 2000); // 清理链接(可以直接点击复制单个 IP)
setTimeout(backToTop, 2000); // 快捷回到顶部(右键左右两侧空白处)
// 添加复制按钮
function addCopyButton() {
if (document.querySelector('#copy_233, #copynocn_233')) return
+ const aa = `
+
+
+
+
+
`
+ document.body.insertAdjacentHTML('beforeend', aa);
// 复制全部
- document.querySelector('header ul').insertAdjacentHTML('afterbegin', `Copy`);
+ //document.querySelector('header nav.tool-navigation').insertAdjacentHTML('beforeend', `Copy`);
// 复制非 CN 的 IP
- document.querySelector('header ul').insertAdjacentHTML('afterbegin', `Copy(Cn)`);
+ //document.querySelector('header nav.tool-navigation').insertAdjacentHTML('beforeend', `Copy(Cn)`);
document.getElementById('copy_233').addEventListener('click', addCopyButtonEvent1)
document.getElementById('copynocn_233').addEventListener('click', addCopyButtonEvent2)
}
@@ -58,7 +145,7 @@
// 复制按钮点击事件
function addCopyButtonEvent1() {
let ip = new Array();
- document.querySelectorAll('span.select-all > a[href]').forEach(function(_this) {ip.push(_this.innerText);})
+ document.querySelectorAll('tbody span.dns-value > a[href]').forEach(function(_this) {ip.push(_this.innerText);})
if (ip.length > 0) {
if (GM_getValue('menu_separator')) {
GM_setClipboard(unique(ip).toString().replaceAll(',','\n'), 'text');
@@ -69,9 +156,9 @@
}
function addCopyButtonEvent2() {
let ip = new Array();
- document.querySelectorAll('span.select-all > a[href]').forEach(function(_this) {
- let img = findParentElement(_this, 'TR').querySelector('img.max-w-none');
- if (img) {if (img.alt != 'CN Flag') ip.push(_this.innerText);}
+ document.querySelectorAll('tbody span.dns-value > a[href]').forEach(function(_this) {
+ let img = findParentElement(_this, 'TR').querySelector('img');
+ if (img) {if (img.alt != 'China') ip.push(_this.innerText);}
})
if (ip.length > 0) {
if (GM_getValue('menu_separator')) {
@@ -84,13 +171,14 @@
// 清理链接(可以直接点击复制单个 IP)
- function cleanLinks() {
+ /*function cleanLinks() {
const callback = (mutationsList, observer) => {
for (const mutation of mutationsList) {
for (const target of mutation.addedNodes) {
if (target.nodeType != 1) return
- if (target.tagName === 'TD' && target.className.indexOf('w-4/12') > -1) {
- target.querySelectorAll('span.select-all > a[href]').forEach(function(_this) {
+ console.log(target)
+ if (target.tagName === 'DIV' && target.className === 'dns-answer-line') {
+ target.querySelectorAll('span.dns-value > a[href]').forEach(function(_this) {
_this.href = 'javascript:void(0);';
_this.target = '_self';
})
@@ -100,12 +188,12 @@
};
const observer = new MutationObserver(callback);
observer.observe(document, { childList: true, subtree: true });
- }
+ }*/
// 快捷回到顶部(右键左右两侧空白处)
function backToTop() {
- document.querySelector('section.relative').oncontextmenu = function(e){
+ document.querySelector('main#main-content').oncontextmenu = function(e){
if (e.target == this) {
e.preventDefault();
window.scrollTo(0,0);