Skip to content

Instantly share code, notes, and snippets.

@daiiz
Last active March 28, 2024 02:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daiiz/01eb7b26e842e2baaf3c4ad96a47725b to your computer and use it in GitHub Desktop.
Save daiiz/01eb7b26e842e2baaf3c4ad96a47725b to your computer and use it in GitHub Desktop.
Google AI Studioでの日本語入力体験を改善するブックマークレット
/**
* 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