消除js Remove JS Button

在当前页添加一个删除指定的html标签的按钮,点击后会自动删除JS。

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         消除js Remove JS Button
// @namespace    消除js Remove JS Button
// @license      yagizaMJ
// @version      1.1.1
// @description  在当前页添加一个删除指定的html标签的按钮,点击后会自动删除JS。
// @AuThor       yagizaMJ
// @match        *://*/*
// @grant        none
// ==/UserScript==
 
(function() {
    'use strict';
 
    function removeTags(tagNames) {
        tagNames.forEach(function(tagName) {
            // 获取所有指定标签
            var elements = document.querySelectorAll(tagName);
 
            // 遍历所有的指定标签并移除它们
            elements.forEach(function(element) {
                element.parentNode.removeChild(element);
            });
        });
    }
 
    // 创建按钮元素
    var removeButton = document.createElement('button');
    removeButton.textContent = 'Remove JS';
    removeButton.style.position = 'fixed';
    removeButton.style.top = '250px';
    removeButton.style.right = '20px';
    removeButton.style.zIndex = '9999';
 
    // 将按钮添加到页面上
    document.body.appendChild(removeButton);
 
    // 添加按钮点击事件
    removeButton.addEventListener('click', function() {
        // 调用函数删除 <a> 和 <h1> 标签
        removeTags(['link', 'script']);
 
        // 移除按钮自身
        removeButton.parentNode.removeChild(removeButton);
    });
 
    // 隐藏按钮的右键菜单
    removeButton.addEventListener('contextmenu', function(event) {
        event.preventDefault();
        removeButton.style.display = 'none';
    });
 
    // 当文档双击时,恢复按钮
    document.addEventListener('dblclick', function() {
        removeButton.style.display = 'block';
    });
})();