Skip to content

Commit 117c19d

Browse files
committed
Improved chatgpt.alert() performance
± Merged early return conditions - Rid laggy `willChange` prop + Made `transition` more specific ↞ [auto-sync from https://github.com/KudoAI/chatgpt.js]
1 parent c203043 commit 117c19d

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

starters/chrome/extension/lib/chatgpt.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,14 @@ const chatgpt = {
127127

128128
drag: {
129129
mousedown(event) { // find modal, update styles, attach listeners, init XY offsets
130-
if (event.button != 0) return // prevent non-left-click drag
131-
if (!/auto|default/.test(getComputedStyle(event.target).cursor))
132-
return // prevent drag on interactive elems
130+
if ( // prevent drag when...
131+
event.button != 0 // non-left-click
132+
|| !/auto|default/.test(getComputedStyle(event.target).cursor) // cursor changed
133+
) return
133134
chatgpt.draggingModal = event.currentTarget
134135
event.preventDefault() // prevent sub-elems like icons being draggable
135136
Object.assign(chatgpt.draggingModal.style, {
136-
transition: '0.1s', willChange: 'transform', transform: 'scale(1.05)' })
137+
transition: 'transform 0.1s ease', transform: 'scale(1.05)' })
137138
document.body.style.cursor = 'grabbing' // update cursor
138139
;[...chatgpt.draggingModal.children] // prevent hover FX if drag lags behind cursor
139140
.forEach(child => child.style.pointerEvents = 'none')
@@ -153,7 +154,7 @@ const chatgpt = {
153154

154155
mouseup() { // restore styles/pointer events, remove listeners, reset chatgpt.draggingModal
155156
Object.assign(chatgpt.draggingModal.style, { // restore styles
156-
cursor: 'inherit', transition: 'inherit', willChange: 'auto', transform: 'scale(1)' })
157+
cursor: 'inherit', transition: 'inherit', transform: 'scale(1)' })
157158
document.body.style.cursor = '' // restore cursor
158159
;[...chatgpt.draggingModal.children] // restore pointer events
159160
.forEach(child => child.style.pointerEvents = '')

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": "2025.10.13.2",
6+
"version": "2025.10.15",
77
"homepage_url": "https://github.com/KudoAI/chatgpt.js-chrome-starter",
88
"icons": { "16": "icons/icon16.png", "32": "icons/icon32.png", "64": "icons/icon64.png", "128": "icons/icon128.png" },
99
"permissions": ["activeTab", "storage"],

0 commit comments

Comments
 (0)