Skip to content

Instantly share code, notes, and snippets.

@willnet
Last active November 28, 2024 06:11
Show Gist options
  • Save willnet/a1def22d1946de09d0d957528eca230c to your computer and use it in GitHub Desktop.
Save willnet/a1def22d1946de09d0d957528eca230c to your computer and use it in GitHub Desktop.
google meet参加者から誰か一人をランダムで選択するスクリプト
// chromeを利用して、ユーザ一覧を表示しつつconsoleで↓を実行すると、現在の参加者からランダムで一人表示することができます
const names_array = document.querySelector("[aria-label='参加者']").innerText.split("\n").filter((word)=> !word.match(/\(|メイン|ミュート|主催者|画面共有|その他の操作|keep_off|more_vert|keep|domain_disabled/))
const names_set = new Set(names_array)
const names_uniq_array = Array.from(names_set)
names_uniq_array[Math.floor(Math.random() * names_uniq_array.length)]
// chromeを利用して、ユーザ一覧を表示しつつconsoleで↓を実行すると、現在の参加者をシャッフルして表示できます
const names_array = document.querySelector("[aria-label='参加者']").innerText.split("\n").filter((word)=> !word.match(/\(|メイン|ミュート|主催者|画面共有|その他の操作|keep_off|more_vert|keep|domain_disabled/))
const names_set = new Set(names_array)
const array = Array.from(names_set)
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
array
@zoshigayan
Copy link

shuffle_from_attendees をちょっとだけ加工したらbookmarkletで動きました!ありがとうございます!

javascript:void function(){const names_array = document.querySelector("[aria-label='参加者']").innerText.split("\n").filter((word)=> !word.match(/\(||||||keep_off|more_vert|keep|domain_disabled/));const names_set = new Set(names_array);const array = Array.from(names_set);for (let i = array.length - 1; i > 0; i--) {const j = Math.floor(Math.random() * (i + 1));[array[i], array[j]] = [array[j], array[i]];} alert(array.join(', '));}()

@willnet
Copy link
Author

willnet commented Nov 28, 2024

👍 👍 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment