MCPcopy Create free account
hub / github.com/XIU2/UserScript / addCopyButton

Function addCopyButton

Ping.Sx-Enhanced.user.js:47–55  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

45
46 // 添加复制按钮
47 function addCopyButton() {
48 if (document.querySelector('#copy_233, #copynocn_233')) return
49 // 复制全部
50 document.querySelector('header ul').insertAdjacentHTML('afterbegin', `<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>`);
51 // 复制非 CN 的 IP
52 document.querySelector('header ul').insertAdjacentHTML('afterbegin', `<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="一键复制非 CN IP" id="copynocn_233">Copy<del><em>(Cn)</em></del></a></li>`);
53 document.getElementById('copy_233').addEventListener('click', addCopyButtonEvent1)
54 document.getElementById('copynocn_233').addEventListener('click', addCopyButtonEvent2)
55 }
56
57
58 // 复制按钮点击事件

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected