Zoom automatically raise hand

By detecting how many others are raising their hand, if exceed the threshold you set, then the program will automatically raise your hands.

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Zoom automatically raise hand
// @name:zh-TW   Zoom自動舉手
// @namespace    http://tampermonkey.net/
// @version      0.4
// @description  By detecting how many others are raising their hand, if exceed the threshold you set, then the program will automatically raise your hands.
// @description:zh-TW 檢測有多少人舉手,如果超過閾值,程序將自動舉手
// @author       You
// @match        *://zoom.us/wc/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var bar = document.getElementsByClassName("footer__inner")[0];
    var tray = document.createElement("div");
    tray.innerHTML = '<span>Raise hand if </span> <input id="hands" style="width: 30px; background-color: black;border: solid 1px white;"></input> hands are raising <button id="handBtn" style="background-color: black; border: solid 1px white;">Set</button> <button id="stopBtn" style="background-color: black; border: solid 1px white;">Stop</button><br><span id="pluginText">The plugin will only work when opening the participant list.</span>';
    tray.setAttribute ('id', 'mask');
    tray.style.position = "absolute";
    tray.style.color = "white";
    tray.style.backgroundColor = "rgba(0,0,0,0)";
    tray.style.left = "250px";
    tray.style.top = "5px";
    tray.style.zIndex = "999999";
    bar.insertBefore(tray, bar.childNodes[1]);
    var interval2;
    var hands;
    var text23 = document.getElementById("pluginText");

    function startHang(){
        clearInterval("interval2");
        interval2 = setInterval(function(){
            var array = document.getElementsByClassName("participants-icon__participants-raisehand");
            if(typeof(document.getElementsByClassName("nonverbal-icon raisehand-icon")[0]) == "undefined"){
                text23.innerHTML = "Please open the participant list in order to run the code.";
                text23.style.color = "red";
            }else{
                text23.innerHTML = "Plugin is running.";
                text23.style.color = "white";
            }
            var handStatus = document.getElementsByClassName("nonverbal-icon raisehand-icon")[0].className;

            if((hands <= array.length && handStatus.indexOf("selected") == -1)||(hands > array.length && handStatus.indexOf("selected") != -1)){
                document.getElementsByClassName("button-without-style")[0].click();
            }
        }, 2000);
    }

    var handBtn = document.getElementById("handBtn");
    handBtn.onclick = function(){
        hands = Number(document.getElementById("hands").value);
        startHang();
        if(typeof(document.getElementsByClassName("nonverbal-icon raisehand-icon")[0]) == "undefined"){
                text23.innerHTML = "Please open the participant list in order to run the code.";
                text23.style.color = "red";
            }else{
                text23.innerHTML = "Plugin is running.";
                text23.style.color = "white";
            }
    }

    var stopBtn = document.getElementById("stopBtn");
    stopBtn.onclick = function(){
        clearInterval(interval2);
        text23.innerHTML = "Plugin is stoped.";
    }

    // Your code here...
})();