Skip to content

Commit 2784391

Browse files
committed
Condensed keyHandler() event check in chatgpt.alert() ↞ [auto-sync from https://github.com/KudoAI/chatgpt.js]
1 parent 869d013 commit 2784391

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

starters/chrome/extension/lib/chatgpt.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,7 @@ const chatgpt = {
231231
const clickHandler = event => { // explicitly defined to support removal post-dismissal
232232
if (event.target == event.currentTarget || event.target instanceof SVGPathElement) dismissAlert(); };
233233
const keyHandler = event => { // to dismiss active alert
234-
const dismissKeys = [' ', 'Spacebar', 'Enter', 'Return', 'Escape', 'Esc'],
235-
dismissKeyCodes = [32, 13, 27];
236-
if (dismissKeys.includes(event.key) || dismissKeyCodes.includes(event.keyCode)) {
234+
if (/^(?: |Space|Enter|Return|Esc)/.test(event.key) || [32, 13, 27].includes(event.keyCode)) {
237235
for (const alertId of alertQueue) { // look to handle only if triggering alert is active
238236
const alert = document.getElementById(alertId);
239237
if (alert && alert.style.display !== 'none') { // active alert found

starters/chrome/extension/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "ChatGPT Extension",
44
"short_name": "ChatGPT 🧩",
55
"description": "A Chromium extension template to start using chatgpt.js like a boss!",
6-
"version": "2024.12.7",
6+
"version": "2024.12.19",
77
"author": "KudoAI",
88
"homepage_url": "https://github.com/KudoAI/chatgpt.js-chrome-starter",
99
"icons": {

0 commit comments

Comments
 (0)