HipChat / Jitsi Meet - Auto mute by default

Automatically mutes when joining a conference in HipChat or Jitsi Meet

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name          HipChat / Jitsi Meet - Auto mute by default
// @description   Automatically mutes when joining a conference in HipChat or Jitsi Meet
// @include       https://hipchat.me/*
// @include       https://meet.jit.si/*
// @match         https://hipchat.me/*
// @match         https://meet.jit.si/*
// @version       0.2
// @namespace https://greasyfork.org/users/77886
// @require  http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @require  https://greasyfork.org/scripts/5392-waitforkeyelements/code/WaitForKeyElements.js?version=115012
// ==/UserScript==

function clickWhenItAppears (jNode) {
    var clickEvent  = document.createEvent ('MouseEvents');
    clickEvent.initEvent ('click', true, true);
    jNode[0].dispatchEvent (clickEvent);
}

bWaitOnce = true;

$(document).ready(function() { //When document has loaded
    setTimeout(function() {
        // <a class="button icon-microphone" id="toolbar_button_mute" shortcut="mutePopover" content="Mute / Unmute" data-i18n="[content]toolbar.mute" data-container="body" data-placement="bottom" data-tooltip="n" original-title=""><ul id="micMutedPopup" class="loginmenu"><li data-i18n="[html]toolbar.micMutedPopup">Your microphone has been muted so that you<br>would fully enjoy your shared video.</li></ul><ul id="unableToUnmutePopup" class="loginmenu"><li data-i18n="[html]toolbar.unableToUnmutePopup">You cannot un-mute while the shared video is on.</li></ul><ul id="talkWhileMutedPopup" class="loginmenu"><li data-i18n="[html]toolbar.talkWhileMutedPopup">Trying to speak? You are muted.</li></ul></a>
        waitForKeyElements (
            "a[class='button icon-microphone']", clickWhenItAppears
        );
    }, 1500); //Wait 1 seconds before trying to click. This is to avoid hitting the redundant "HipChat Video needs to use your microphone and camera." dialog.
});