Remove Sidebar

Removes annoying sidebar from the left side of the screen

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         Remove Sidebar
// @namespace    https://voice.google.com/
// @version      1.0
// @description  Removes annoying sidebar from the left side of the screen
// @author       LikeToAccess
// @match        https://voice.google.com/u/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=google.com
// @grant        none
// @license      MIT
// ==/UserScript==

(async function() {
    'use strict';
    // //*[@id="gvPageRoot"]/div[2]/gv-side-panel/mat-sidenav-container/mat-sidenav-content/div/div[2]/gv-call-sidebar
    function getElementByXpath(path) {
        return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
    }
    function waitForElm(selector) {
        return new Promise(resolve => {
            if (getElementByXpath(selector)) {
                return resolve(getElementByXpath(selector));
            }

            const observer = new MutationObserver(mutations => {
                if (getElementByXpath(selector)) {
                    resolve(getElementByXpath(selector));
                    observer.disconnect();
                }
            });

            observer.observe(document.body, {
                childList: true,
                subtree: true
            });
        });
    }
    var elm = getElementByXpath("//*[@id=\"gvPageRoot\"]/div[2]/gv-side-panel/mat-sidenav-container/mat-sidenav-content/div/div[2]/gv-call-sidebar");
    elm.remove();
    window.onkeypress = async function(event) {
        if (event.keyCode == 96) {
            console.log("Keypress");
            while (await waitForElm("//div[contains(@aria-label, 'Unread')]")) {
                console.log("Started loop");
                var unread = await waitForElm("//div[contains(@aria-label, 'Unread')]");
                unread.click();
            }
        }
    }
})();