WhatsApp Web - Clean UI

Fix & debloat WhatsApp Web's interface

目前為 2025-05-06 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         WhatsApp Web - Clean UI
// @description  Fix & debloat WhatsApp Web's interface
// @author       Gamba
// @version      1.0
// @license      MIT
// @namespace    http://tampermonkey.net/
// @match        https://web.whatsapp.com/*
// @icon         https://t3.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=https://web.whatsapp.com/&size=256
// @grant        none
// ==/UserScript==
 
'use strict';
 
// Intercept keyboard shortcuts
{
    document.addEventListener("keydown", onKeyboard, true);
 
    const shortcuts =
    [
        input => input.ctrlKey && input.key == "Delete"
    ];
 
    function onKeyboard(input)
    {
        for (const shortcut of shortcuts)
        {
            if (shortcut(input))
            {
                input.stopImmediatePropagation();
 
                break;
            }
        }
    }
}
 
// Intercept button clicks
{
    document.addEventListener("click", onClick, true);
 
    function onClick(event)
    {
        let target = event.target.closest("button");
 
        if (target && target.closest("header"))
        {
            target.blur();
 
            document.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape" }));
        }
    }
}
 
// Apply CSS
{
    const css =
`
/*Viewport*/
#app > div > div > div[tabindex="-1"]
{
    top: 0;
 
	width: 100%;
	max-width: 100%;
	height: 100%;
    max-height: 100%;
}
 
/*Unnecessary tabs*/
#app > div > div > div > header > div > div > div > div > span > div > :nth-child(1) > :nth-child(3),
#app > div > div > div > header > div > div > div > div > span > div > :nth-child(1) > :nth-child(4)
{
    display: none;
}
 
/*Lists*/
#side > [role="tablist"]
{
    display: none;
}
 
/*Download WhatsApp for Windows*/
#side > :last-child[role="button"] *,
#app > div > div > div > :nth-child(5) > div:not(#main) > div > :nth-child(1),
#app > div > div > div > :nth-child(5) > div:not(#main) > div > :nth-child(2)
{
    display: none;
}
 
/*Separators*/
#pane-side > :nth-last-child(3)
{
    display: none;
}
 
#pane-side > :nth-child(3) > div > div > div:first-child > div > div > div > div:last-child
{
    border-top: 0
}
 
/*Popup Tooltips*/
#wa-popovers-bucket *
{
    display: none;
}
 
/*Restricted chats*/
#pane-side > :nth-child(1),
#pane-side > :nth-child(2)
{
    display: none;
}
`;
 
    const style = document.createElement('style');
    style.textContent = css;
    document.head.appendChild(style);
}