Last active
December 14, 2018 11:16
-
-
Save wyw/21a3f15ec4ee3c9cbf5386161052b0db to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name PVE IP | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @include https://*:8006/* | |
// ==/UserScript== | |
(function (i, s, o, g, r, c, a, m) { | |
i['global_clipboard'] = r; i[r] = i[r] || function () { | |
(i[r].q = i[r].q || []).push(arguments) | |
}, i[r].l = 1 * new Date(); a = s.createElement(o), | |
m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; a.onload = c; m.parentNode.insertBefore(a, m); | |
})(window, document, 'script', 'https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js', 'ga', function onload() { | |
var reg = /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/g; | |
var itv = null; | |
var list = []; | |
function handleClick(t) { | |
setTimeout(() => { | |
t.style.color = 'green'; | |
}, 1000); | |
t.style.color = 'inherit'; | |
return t.innerHTML.match(reg)[0]; | |
} | |
function applyClipboard() { | |
var l = Array.from(document.querySelectorAll('label')).filter(i => i.textContent.match(reg))[0]; | |
if (typeof l !== 'undefined') { | |
if (list.indexOf(l) === -1) { | |
list.push(l); | |
l.style.color = 'green'; | |
new ClipboardJS(l, { text: handleClick}); | |
return; | |
} | |
} | |
} | |
itv = setInterval(applyClipboard, 500); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment