Disable CMD+S

Prevents websites from intercepting the CMD+S (Save) shortcut on Mac

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Disable CMD+S
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Prevents websites from intercepting the CMD+S (Save) shortcut on Mac
// @author       Ben Whaley
// @grant        none
// @license      MIT
// @match        https://www.example.com
// ==/UserScript==

(function() {
    'use strict';

    function handleKeyDown(event) {
        // Check for CMD+S (metaKey is the Command key on Mac)
        if (event.metaKey && event.key === 's') {
            event.stopPropagation();
            console.log('Tampermonkey script intercepted CMD+S');
        }
    }

    document.addEventListener('keydown', handleKeyDown, true);

    function createCustomEventHandler() {
        const originalAddEventListener = EventTarget.prototype.addEventListener;

        EventTarget.prototype.addEventListener = function(type, listener, options) {
            if (type === 'keydown') {
                const wrappedListener = function(event) {
                    if (event.metaKey && event.key === 's') {
                        return;
                    }
                    return listener.apply(this, arguments);
                };

                return originalAddEventListener.call(this, type, wrappedListener, options);
            }

            return originalAddEventListener.call(this, type, listener, options);
        };
    }

    createCustomEventHandler();

    console.log('Tampermonkey script loaded: CMD+S shortcut interceptor');
})();