Last active
March 28, 2024 02:25
-
-
Save daiiz/01eb7b26e842e2baaf3c4ad96a47725b to your computer and use it in GitHub Desktop.
Google AI Studioでの日本語入力体験を改善するブックマークレット
This file contains 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
/** | |
* Enterキーで送信されないようにする。 | |
* 代わりにCmd(Ctrl)+Enterキーで送信する。 | |
* | |
* Author : daiiz | |
* License : MIT | |
* 最終動作確認: 2024/3/28 11:00 JST | |
*/ | |
javascript:(function () { | |
if (location.origin !== "https://aistudio.google.com") { | |
return; | |
} | |
const x = document.querySelector("#chat-input-field"); | |
x.addEventListener( | |
"keydown", | |
(e) => { | |
if (e.key.toLowerCase() === "enter") { | |
if (e.metaKey || e.ctrlKey) { | |
const b = document.querySelector( | |
'.testing-request button[aria-label="Run"]' | |
); | |
window.requestAnimationFrame(() => { | |
b.click(); | |
}); | |
} else { | |
e.preventDefault(); | |
e.stopPropagation(); | |
} | |
} | |
}, | |
true | |
); | |
console.log("done :)"); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment