您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Disable WhatsApp's feature where Ctrl+Del deletes the current chat, instead of the default behavior of deleting the word after the cursor.
// ==UserScript== // @name Fix WhatsApp's Ctrl+Del hotkey // @version 1.1 // @description Disable WhatsApp's feature where Ctrl+Del deletes the current chat, instead of the default behavior of deleting the word after the cursor. // @author ajp_anton // @license MIT // @match https://web.whatsapp.com/ // @grant none // @namespace https://greasyfork.org/users/1454657 // ==/UserScript== (function() { 'use strict'; let lastInput = null; function attachListenerToInput(input) { if (!input || input._ctrlDelFixed) return; input.addEventListener('keydown', function(e) { if (e.ctrlKey && e.key === 'Delete') { e.stopPropagation(); // Block chat deletion } }, true); // Use capture phase input._ctrlDelFixed = true; // Mark this input so we don’t attach again lastInput = input; } // Observe changes in the DOM const observer = new MutationObserver(() => { const input = document.querySelector('[contenteditable="true"][data-tab="10"]'); if (input && input !== lastInput) { attachListenerToInput(input); } }); // Start observing the whole document observer.observe(document.body, { childList: true, subtree: true }); })();