VanishIt

透過快速 Alt+右鍵操作,輕鬆讓任何頁面元素消失。

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         VanishIt
// @namespace    https://greasyfork.org/en/users/1451802
// @version      1.1
// @description  Make any page element disappear effortlessly using a quick Alt+Right-click.
// @description:de   Lassen Sie jedes Element der Seite mühelos verschwinden – mit einem schnellen Alt+Rechtsklick.
// @description:es   Haz desaparecer cualquier elemento de la página sin esfuerzo con un rápido Alt+Clic derecho.
// @description:fr   Faites disparaître n'importe quel élément de la page en un clin d'œil grâce à un rapide Alt+Clic droit.
// @description:it   Fai sparire qualsiasi elemento della pagina senza sforzo usando un rapido Alt+Clic destro.
// @description:ru   С легкостью заставьте любой элемент страницы исчезнуть с помощью быстрого Alt+правого клика.
// @description:zh-CN   通过快速 Alt+右键操作,让任何页面元素轻松消失。
// @description:zh-TW   透過快速 Alt+右鍵操作,輕鬆讓任何頁面元素消失。
// @description:ja   Alt+右クリックを使って、どんなページ要素も簡単に消し去ります。
// @description:ko   빠른 Alt+우클릭으로 페이지의 모든 요소를 손쉽게 제거합니다.
// @author       NormalRandomPeople (https://github.com/NormalRandomPeople)
// @match        *://*/*
// @grant        none
// @icon         https://www.svgrepo.com/show/253495/erase-clean.svg
// @compatible      chrome
// @compatible      firefox
// @compatible      opera
// @compatible      edge
// @compatible      brave
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    const customMenu = document.createElement('div');
    customMenu.style.position = 'fixed';
    customMenu.style.zIndex = 2147483647;
    customMenu.style.pointerEvents = 'auto';
    customMenu.style.backgroundColor = '#fff';
    customMenu.style.border = '1px solid #ccc';
    customMenu.style.padding = '5px 10px';
    customMenu.style.boxShadow = '2px 2px 6px rgba(0,0,0,0.2)';
    customMenu.style.fontFamily = 'Arial, sans-serif';
    customMenu.style.fontSize = '14px';
    customMenu.style.cursor = 'pointer';
    customMenu.style.display = 'none';
    customMenu.textContent = 'Destroy';
    customMenu.addEventListener('mouseover', () => {
        customMenu.style.backgroundColor = '#eee';
    });
    customMenu.addEventListener('mouseout', () => {
        customMenu.style.backgroundColor = '#fff';
    });

    document.documentElement.appendChild(customMenu);
    let targetElement = null;

    document.addEventListener('contextmenu', (e) => {
        if (e.altKey) {
            e.preventDefault();
            e.stopPropagation();
            targetElement = e.target;
            customMenu.style.top = `${e.clientY}px`;
            customMenu.style.left = `${e.clientX}px`;
            customMenu.style.display = 'block';
        } else {
            customMenu.style.display = 'none';
        }
    }, true);

    document.addEventListener('click', () => {
        customMenu.style.display = 'none';
    }, true);

    customMenu.addEventListener('click', (e) => {
        if (targetElement && targetElement.parentNode) {
            targetElement.parentNode.removeChild(targetElement);
        }
        customMenu.style.display = 'none';
        e.stopPropagation();
    });

    document.addEventListener('keydown', (e) => {
        if (e.key === 'Escape') {
            customMenu.style.display = 'none';
        }
    }, true);

})();