Skip to content

Commit

Permalink
Removed modals.dragHandlers now handled by chatgpt.js 3.4.0 ↞ [auto…
Browse files Browse the repository at this point in the history
  • Loading branch information
kudo-sync-bot committed Dec 24, 2024
1 parent 338cbe8 commit 2e3a7dd
Showing 1 changed file with 1 addition and 31 deletions.
32 changes: 1 addition & 31 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.3
// @version 2024.12.23.4
// @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 @@ -597,36 +597,6 @@
}).observe(modalBG.parentNode, { childList: true, subtree: true })
},

dragHandlers: {
mousedown(event) { // find modal, attach listeners, init XY offsets
if (event.button != 0) return // prevent non-left-click drag
if (getComputedStyle(event.target).cursor == 'pointer') return // prevent drag on interactive elems
modals.dragHandlers.draggableElem = event.currentTarget
modals.dragHandlers.draggableElem.style.cursor = 'grabbing'
event.preventDefault(); // prevent sub-elems like icons being draggable
['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
},

mousemove(event) { // drag modal
if (modals.dragHandlers.draggableElem) {
const newX = event.clientX - modals.dragHandlers.offsetX,
newY = event.clientY - modals.dragHandlers.offsetY
Object.assign(modals.dragHandlers.draggableElem.style, { left: `${newX}px`, top: `${newY}px` })
}
},

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

about() {

// Show modal
Expand Down

0 comments on commit 2e3a7dd

Please sign in to comment.