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 11f9c94 commit 62453c8
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
// @description:zu Ziba itshala lokucabanga okuzoshintshwa ngokuzenzakalelayo uma ukubuka chatgpt.com
// @author Adam Lui
// @namespace https://github.com/adamlui
// @version 2024.12.23.1
// @version 2024.12.23.2
// @license MIT
// @icon https://media.autoclearchatgpt.com/images/icons/openai/black/icon48.png?a8868ef
// @icon64 https://media.autoclearchatgpt.com/images/icons/openai/black/icon64.png?a8868ef
Expand Down Expand Up @@ -568,7 +568,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 @@ -584,8 +585,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 62453c8

Please sign in to comment.