Skip to content

Commit

Permalink
Renamed event args of forEach loops in modals.handlers.drag typ…
Browse files Browse the repository at this point in the history
…e methods to `eventType` for better clarity ↞ [auto-sync from https://github.com/adamlui/ai-web-extensions]
  • Loading branch information
kudo-sync-bot committed Dec 23, 2024
1 parent 2439e15 commit f415d2b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions chatgpt/chatgpt-auto-refresh/chatgpt-auto-refresh.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@
// @description:zu *NGOKUPHEPHA* susa ukusetha kabusha ingxoxo yemizuzu eyi-10 + amaphutha enethiwekhi ahlala njalo + Ukuhlolwa kwe-Cloudflare ku-ChatGPT.
// @author Adam Lui
// @namespace https://github.com/adamlui
// @version 2024.12.23.1
// @version 2024.12.23.2
// @license MIT
// @icon https://media.chatgptautorefresh.com/images/icons/openai/black/icon48.png?c56f963
// @icon64 https://media.chatgptautorefresh.com/images/icons/openai/black/icon64.png?c56f963
Expand Down Expand Up @@ -607,7 +607,8 @@
modals.dragHandlers.draggableElem = event.currentTarget
modals.dragHandlers.draggableElem.style.cursor = 'grabbing'
event.preventDefault(); // prevent sub-elems like icons being draggable
['mousemove', 'mouseup'].forEach(event => document.addEventListener(event, modals.dragHandlers[event]))
['mousemove', 'mouseup'].forEach(eventType =>
document.addEventListener(eventType, modals.dragHandlers[eventType]))
const draggableElemRect = modals.dragHandlers.draggableElem.getBoundingClientRect()
modals.dragHandlers.offsetX = event.clientX - draggableElemRect.left +21
modals.dragHandlers.offsetY = event.clientY - draggableElemRect.top +12
Expand All @@ -623,8 +624,8 @@

mouseup() { // remove listeners, reset modals.dragHandlers.draggableElem
modals.dragHandlers.draggableElem.style.cursor = 'inherit';
['mousemove', 'mouseup'].forEach(event =>
document.removeEventListener(event, modals.dragHandlers[event]))
['mousemove', 'mouseup'].forEach(eventType =>
document.removeEventListener(eventType, modals.dragHandlers[eventType]))
modals.dragHandlers.draggableElem = null
}
},
Expand Down

0 comments on commit f415d2b

Please sign in to comment.