Last active
July 1, 2026 01:32
-
-
Save khlizard/410c18f5ba514ead69a4f99425e4ccc7 to your computer and use it in GitHub Desktop.
Disable Ctrl+I Shortcut
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Disable Ctrl+I Shortcut (Stabilized) | |
| // @namespace http://tampermonkey.net/ | |
| // @version 1.1 | |
| // @description Perplexityのページ上でのCtrl+Iショートカットを、日本語入力中も含めて完全に無効化します。 | |
| // @author YourName | |
| // @match https://www.perplexity.ai/* | |
| // @run-at document-start | |
| // @grant none | |
| // ==/UserScript== | |
| (function() { | |
| 'use strict'; | |
| function blockCtrlI(event) { | |
| const isCtrlPressed = event.ctrlKey || event.metaKey; | |
| // IME入力中(event.keyが'Process', keyCodeが229)でも、物理キーcodeは'KeyI'のまま維持される特性を利用 | |
| if (isCtrlPressed && (event.key === 'i' || event.key === 'I' || event.keyCode === 73 || event.code === 'KeyI')) { | |
| // イベントのデフォルト挙動を抑制 | |
| event.preventDefault(); | |
| // 他のDOM要素および同要素の他のリスナーへの伝播を即座に停止 | |
| event.stopPropagation(); | |
| event.stopImmediatePropagation(); | |
| } | |
| } | |
| // キャプチャリングフェーズで最優先で実行 | |
| window.addEventListener('keydown', blockCtrlI, true); | |
| window.addEventListener('keypress', blockCtrlI, true); | |
| window.addEventListener('keyup', blockCtrlI, true); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment