Created
October 17, 2020 14:07
-
-
Save kemsakurai/0e04d7f37e64ed110b40b0c83e065aa4 to your computer and use it in GitHub Desktop.
Chatwork のルームのメンバーの一覧を取得する Tampermonkeyスクリプト
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 Copy Chatwork room members | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Chatwork のルームメンバーをクリックボードにコピーする | |
// @author K.Sakurai | |
// @match https://www.chatwork.com/* | |
// @run-at context-menu | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
document.querySelector("#_to").click(); | |
var elems = document.querySelectorAll("#_toList > ul > li > p"); | |
var text = ""; | |
for (var elem of elems) { | |
if (elem.innerText != "undefined" ) { | |
var temp = elem.innerText; | |
temp = temp.replace("さん",""); | |
temp = temp.split("/")[0]; | |
temp = temp.trimEnd(); | |
text +=temp + "\r\n"; | |
} | |
} | |
var node = document.createElement('textarea') | |
var selection = document.getSelection() | |
node.textContent = text; | |
document.body.appendChild(node); | |
selection.removeAllRanges(); | |
node.select(); | |
document.execCommand('copy'); | |
selection.removeAllRanges(); | |
document.body.removeChild(node); | |
document.querySelector("#_to").click(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment