WhatsApp Web - Clean UI

Fix & debloat WhatsApp Web's interface

当前为 2025-05-06 提交的版本,查看 最新版本

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

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

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

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

您需要先安装一款用户脚本管理器扩展,例如 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);
}