Skip to content

Instantly share code, notes, and snippets.

@kemsakurai
Created October 17, 2020 14:07
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 kemsakurai/0e04d7f37e64ed110b40b0c83e065aa4 to your computer and use it in GitHub Desktop.
Save kemsakurai/0e04d7f37e64ed110b40b0c83e065aa4 to your computer and use it in GitHub Desktop.
Chatwork のルームのメンバーの一覧を取得する Tampermonkeyスクリプト
// ==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