Skip to content

Instantly share code, notes, and snippets.

@goofmint
Last active October 6, 2018 07:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goofmint/07222c71f7a5630a526692ecf9f0b0bc to your computer and use it in GitHub Desktop.
Save goofmint/07222c71f7a5630a526692ecf9f0b0bc to your computer and use it in GitHub Desktop.
CloudGarageの管理画面でIPアドレスをコピーするユーザスクリプトです
// ==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