Skip to content

Commit b774746

Browse files
committed
优化 代码
1 parent 3c39be4 commit b774746

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

Ping.Sx-Enhanced.user.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
// ==UserScript==
22
// @name Ping.Sx 增强
3-
// @version 1.0.0
3+
// @version 1.0.1
44
// @author X.I.U
55
// @description 一键复制所有 IP、清理 IP 链接(点击复制而不是跳转)、快捷回到顶部(右键两侧空白处)
66
// @match https://ping.sx/ping*
77
// @match https://ping.sx/dig*
88
// @match https://ping.sx/check-port*
99
// @icon https://ping.sx/favicon.ico
1010
// @grant GM_setClipboard
11+
// @grant window.onurlchange
1112
// @license GPL-3.0 License
1213
// @run-at document-end
1314
// @namespace https://github.com/XIU2/UserScript
@@ -16,13 +17,16 @@
1617

1718
(function() {
1819
'use strict';
20+
window.addEventListener('urlchange', function() {addCopyButton(); cleanLinks(); backToTop();});
21+
1922
setTimeout(addCopyButton, 2000); // 添加复制按钮
2023
setTimeout(cleanLinks, 2000); // 清理链接(可以直接点击复制单个 IP)
2124
setTimeout(backToTop, 2000); // 快捷回到顶部(右键左右两侧空白处)
2225

2326

2427
// 添加复制按钮
2528
function addCopyButton() {
29+
if (document.querySelector('#copy_233, #copynocn_233')) return
2630
// 复制全部
2731
let _copy = `<li><a title="复制当前页面下的所有 IP 地址到剪切板" class="text-gray-600 hover:text-gray-900 px-3 lg:px-5 py-2 flex items-center transition duration-150 ease-in-out" href="javascript:void(0);" title="一键复制所有 IP" id="copy_233">Copy</a></li>`
2832
document.querySelector('header ul').insertAdjacentHTML('afterbegin', _copy);

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
| [<img src="https://static.zhihu.com/heifetz/favicon.ico" height="16px" />](https://www.zhihu.com/people/xiu2) | **知乎 美化** | 宽屏显示、**暗黑模式****屏蔽首页活动**、调整图片最大高度... | **[安装](https://greasyfork.org/zh-CN/scripts/412212)** \| **[备用](https://cdn.jsdelivr.net/gh/XIU2/UserScript/Zhihu-Beautification.user.js)** |
2424
| [<img src="https://static.zhihu.com/heifetz/favicon.ico" height="16px" />](https://www.zhihu.com/people/xiu2) | **知乎 增强** | **移除登录弹窗****屏蔽首页视频**、屏蔽用户、屏蔽关键词... | **[安装](https://greasyfork.org/zh-CN/scripts/419081)** \| **[备用](https://cdn.jsdelivr.net/gh/XIU2/UserScript/Zhihu-Enhanced.user.js)** |
2525
| [<img src="https://www.v2ex.com/static/favicon.ico" height="16px" />](https://www.v2ex.com/) | **V2EX 增强** | **自动签到**、链接转图片、自动无缝翻页、新标签页打开链... | **[安装](https://greasyfork.org/zh-CN/scripts/424246)** \| **[备用](https://cdn.jsdelivr.net/gh/XIU2/UserScript/V2ex-Enhanced.user.js)** |
26-
| [<img src="https://ping.sx/favicon.ico" height="16px" />](https://ping.sx/ping) | **Ping.Sx 增强** | **一键复制所有 IP**、清理 IP 链接、快捷回到顶部 ... | **[安装](https://greasyfork.org/zh-CN/scripts/111111111111)** \| **[备用](https://cdn.jsdelivr.net/gh/XIU2/UserScript/Ping.Sx-Enhanced.user.js)** |
26+
| [<img src="https://ping.sx/favicon.ico" height="16px" />](https://ping.sx/ping) | **Ping.Sx 增强** | **一键复制所有 IP**、清理 IP 链接、快捷回到顶部 ... | **[安装](https://greasyfork.org/zh-CN/scripts/438704)** \| **[备用](https://cdn.jsdelivr.net/gh/XIU2/UserScript/Ping.Sx-Enhanced.user.js)** |
2727
| [<img src="https://i.loli.net/2021/03/30/ULV9XunaHesqGIR.png" height="16px" />](https://github.com/XIU2) | **Github 增强** | **高速下载** Git Clone/SSH、Release、Raw、Code(ZIP) ... | **[安装](https://greasyfork.org/zh-CN/scripts/412245)** \| **[备用](https://cdn.jsdelivr.net/gh/XIU2/UserScript/GithubEnhanced-High-Speed-Download.user.js)** |
2828
| [<img src="https://user-images.githubusercontent.com/54703944/118383905-b5d32380-b634-11eb-8914-dcea8e628ed3.png" height="16px" />](https://github.com/XIU2) | **自动无缝翻页 \*** | **所有 Discuz! 论坛**/百度/谷歌/B站/贴吧/豆瓣/漫画/千图... | **[安装](https://greasyfork.org/zh-CN/scripts/419215)** \| **[备用](https://cdn.jsdelivr.net/gh/XIU2/UserScript/Autopage.user.js)** |
2929
| [<img src="https://www.3dmgame.com/favicon.ico" height="16px" />](https://bbs.3dmgame.com) | **3DM论坛 美化** | 精简多余内容、样式优化 | **[安装](https://greasyfork.org/zh-CN/scripts/413593)** \| **[备用](https://cdn.jsdelivr.net/gh/XIU2/UserScript/3dm-Beautification.user.js)** |

0 commit comments

Comments
 (0)