Select & Delete

deletes selected elements. shift+click: select or deselect, ctrl+click: delete.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Select & Delete
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  deletes selected elements. shift+click: select or deselect, ctrl+click: delete.
// @author       listfilterjay
// @match        *://*/*
// @grant        none
// @require      http://code.jquery.com/jquery-latest.min.js
// ==/UserScript==

(function() {
    'use strict';

    function clickCheck(e) {
        if(e.shiftKey||e.ctrlKey) {
            e.preventDefault(); // prevents links from opening.
            e.stopPropagation(); // prevents events from affecting parent elements.
            if(e.shiftKey) {
                console.log("shift");
                if(jQuery(this).hasClass("delete-select")) {
                    jQuery(this).removeClass("delete-select");
                }else {
                    jQuery(this).addClass("delete-select");
                }
            }
            if(e.ctrlKey) {
                console.log("ctrl");
                if(jQuery(this).hasClass("delete-select")) {
                    jQuery(this).remove();
                }
            }
        }
    }
    jQuery("*").click(clickCheck);

    // defintion of css for the red border around selected elements.
    const selectCss =
`<style type="text/css">
    .delete-select {
        border: 2px red solid !important;
    }
</style>`;
    jQuery(document.body).append(selectCss);
    console.log("select & delete script is active.");

})();