Skip to content

Instantly share code, notes, and snippets.

@khlizard
Last active July 1, 2026 01:32
Show Gist options
  • Select an option

  • Save khlizard/410c18f5ba514ead69a4f99425e4ccc7 to your computer and use it in GitHub Desktop.

Select an option

Save khlizard/410c18f5ba514ead69a4f99425e4ccc7 to your computer and use it in GitHub Desktop.
Disable Ctrl+I Shortcut
// ==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