Skip to content

Commit d6fe159

Browse files
committed
修复 [一键复制所有 IP] 在个别情况下会复制到非 IP 内容的问题
1 parent c51b876 commit d6fe159

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

Ping.Sx-Enhanced.user.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ==UserScript==
22
// @name Ping.Sx 增强
3-
// @version 1.0.1
3+
// @version 1.0.2
44
// @author X.I.U
55
// @description 一键复制所有 IP、清理 IP 链接(点击复制而不是跳转)、快捷回到顶部(右键两侧空白处)
66
// @match https://ping.sx/ping*
@@ -43,12 +43,12 @@
4343
// 复制按钮点击事件
4444
function addCopyButtonEvent1() {
4545
let ip = new Array();
46-
document.querySelectorAll('span.select-all:first-child').forEach(function(_this) {ip.push(_this.innerText);})
46+
document.querySelectorAll('span.select-all > a[href]').forEach(function(_this) {ip.push(_this.innerText);})
4747
if (ip.length > 0) GM_setClipboard(unique(ip).toString().replaceAll(',','\n'), 'text');
4848
}
4949
function addCopyButtonEvent2() {
5050
let ip = new Array();
51-
document.querySelectorAll('span.select-all:first-child').forEach(function(_this) {
51+
document.querySelectorAll('span.select-all > a[href]').forEach(function(_this) {
5252
let img = findParentElement(_this, 'TR').querySelector('img.max-w-none');
5353
if (img) {if (img.alt != 'CN Flag') ip.push(_this.innerText);}
5454
})
@@ -113,6 +113,7 @@
113113
if (this.value) {
114114
this.value = this.value.replace(/(http:\/\/|https:\/\/|\:.+|\/.*)/ig,"");
115115
this.setAttribute('value',this.value);
116+
this.dispatchEvent(new Event('input'));
116117
}
117118
}, true);*/
118119
})();

0 commit comments

Comments
 (0)