优化 代码

This commit is contained in:
xiu2
2022-01-18 08:16:43 +08:00
parent 3c39be4a78
commit b7747469db
2 changed files with 6 additions and 2 deletions
+5 -1
View File
@@ -1,6 +1,6 @@
// ==UserScript==
// @name Ping.Sx 增强
// @version 1.0.0
// @version 1.0.1
// @author X.I.U
// @description 一键复制所有 IP、清理 IP 链接(点击复制而不是跳转)、快捷回到顶部(右键两侧空白处)
// @match https://ping.sx/ping*
@@ -8,6 +8,7 @@
// @match https://ping.sx/check-port*
// @icon https://ping.sx/favicon.ico
// @grant GM_setClipboard
// @grant window.onurlchange
// @license GPL-3.0 License
// @run-at document-end
// @namespace https://github.com/XIU2/UserScript
@@ -16,6 +17,8 @@
(function() {
'use strict';
window.addEventListener('urlchange', function() {addCopyButton(); cleanLinks(); backToTop();});
setTimeout(addCopyButton, 2000); // 添加复制按钮
setTimeout(cleanLinks, 2000); // 清理链接(可以直接点击复制单个 IP)
setTimeout(backToTop, 2000); // 快捷回到顶部(右键左右两侧空白处)
@@ -23,6 +26,7 @@
// 添加复制按钮
function addCopyButton() {
if (document.querySelector('#copy_233, #copynocn_233')) return
// 复制全部
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>`
document.querySelector('header ul').insertAdjacentHTML('afterbegin', _copy);
+1 -1
View File
@@ -23,7 +23,7 @@
| [<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)** |
| [<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)** |
| [<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)** |
| [<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)** |
| [<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)** |
| [<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)** |
| [<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)** |
| [<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)** |