Last active
October 6, 2018 07:18
-
-
Save goofmint/07222c71f7a5630a526692ecf9f0b0bc to your computer and use it in GitHub Desktop.
CloudGarageの管理画面でIPアドレスをコピーするユーザスクリプトです
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 IPアドレスコピー | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description CloudGarageのIPアドレスをコピーするユーザスクリプトです | |
// @author Atsushi | |
// @match https://console.cloudgarage.jp/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
let i = setInterval(() => { | |
const ary = document.querySelectorAll(".tui-grid-cell-content"); | |
if (ary.length > 0) { | |
clearInterval(i); | |
} | |
for (const dom of ary) { | |
const text = dom.innerText; | |
if (text.match(/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/)) { | |
$(dom).html(`${text} <button class="copy" data-clipboard-text="${text}">📋</button>`); | |
} | |
} | |
const clipboard = new Clipboard('.copy'); | |
clipboard.on('success', (e) => { | |
$(e.trigger).text('✔️'); | |
setTimeout(() => { | |
$(e.trigger).text('📋'); | |
}, 1000); | |
}); | |
}, 3000); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment