Bind Delete Key to Delete Button in Rabbit Hole

Binds the Delete key to trigger SVG trash button click in rabbit hole

2024-10-05 기준 버전입니다. 최신 버전을 확인하세요.

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name         Bind Delete Key to Delete Button in Rabbit Hole
// @namespace    http://tampermonkey.net/
// @license      GNU GPLv3
// @version      1.0
// @description  Binds the Delete key to trigger SVG trash button click in rabbit hole
// @author       You
// @match        *://hole.rabbit.tech/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Function to trigger a click on the second SVG button
    function triggerDeleteAction() {
        try {
            // Select the div containing the buttons
            const container = document.querySelector('div.ml\\:flex.hidden.items-center.space-x-2');
            if (container) {
                // Select all SVG buttons within the container
                const svgButtons = container.querySelectorAll('svg');
                if (svgButtons.length > 1) {
                    // Click the second button
                    svgButtons[1].dispatchEvent(new MouseEvent('click', { bubbles: true }));
                } else {
                    console.error('Second SVG button not found');
                }
            } else {
                console.error('Container not found');
            }
        } catch (error) {
            console.error('Error triggering delete action:', error);
        }
    }

    // Add event listener for keydown events
    document.addEventListener('keydown', function(event) {
        if (event.key === 'Delete') {
            triggerDeleteAction();
            event.preventDefault(); // Prevent default behavior if necessary
        }
    });
})();