您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Collapse the contacts sidebar when you click the header.
// ==UserScript== // @name WhatsApp Collapse // @namespace alexchandel // @version 1.1 // @description Collapse the contacts sidebar when you click the header. // @author Alex Chandel // @match https://web.whatsapp.com/ // @grant none // ==/UserScript== /* jshint esversion: 6 */ window.addEventListener('load', function() { 'use strict'; const toggleContacts = function (e) { // main header, side header, or side header div. const side = document.getElementById('side').parentElement if (e.target.tagName === 'HEADER' && (e.target.parentElement.id === 'main' || e.target.parentElement.id === 'side') || e.target.parentElement.tagName === 'HEADER' && e.target.parentElement.parentElement.id === 'side' || document.getElementById('main') == null && side.nextElementSibling.contains(e.target)) { if (side.style.display !== 'none') { // collapse side.style.display = 'none' side.previousElementSibling.children[0].style.display = 'none' const text = document.querySelector('#main > footer .selectable-text') if (text != null) text.focus() } else { side.style.display = '' side.previousElementSibling.children[0].style.display = '' } } } document.getElementById('app').addEventListener('click', toggleContacts, {'passive': true}) })