Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
LosTigeros authored Sep 13, 2024
1 parent 64014db commit 24e1138
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions Extensions/fullAppDisplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ body.video-full-screen.video-full-screen--hide-ui {

const progressDivRef = useRef(null);
const [isDragging, setIsDragging] = useState(false);

useEffect(() => {
if (isDragging) {
return;
Expand All @@ -333,7 +333,7 @@ body.video-full-screen.video-full-screen--hide-ui {
Spicetify.Player.addEventListener("onprogress", update);
return () => Spicetify.Player.removeEventListener("onprogress", update);
}, [isDragging]);

// Handle click on progress bar to set progress
const handleClick = (e) => {
const container = progressDivRef.current;
Expand All @@ -347,7 +347,7 @@ body.video-full-screen.video-full-screen--hide-ui {
Spicetify.Player.seek(newProgress);
setProgress(newProgress);
};

// Handle dragging functionality
const handleMouseDown = () => setIsDragging(true);
const handleMouseMove = (e) => {
Expand All @@ -369,7 +369,7 @@ body.video-full-screen.video-full-screen--hide-ui {
Spicetify.Player.seek(progress);
setIsDragging(false);
};

// Attach mousemove and mouseup listeners when dragging starts
useEffect(() => {
if (isDragging) {
Expand All @@ -379,16 +379,16 @@ body.video-full-screen.video-full-screen--hide-ui {
window.removeEventListener("mousemove", handleMouseMove);
window.removeEventListener("mouseup", handleMouseUp);
}

return () => {
window.removeEventListener("mousemove", handleMouseMove);
window.removeEventListener("mouseup", handleMouseUp);
};
}, [isDragging]);

// Calculate the thumb position
const thumbPosition = (progress / duration) * 100;

return react.createElement(
"div",
{ id: "fad-progress-container" },
Expand All @@ -406,13 +406,11 @@ body.video-full-screen.video-full-screen--hide-ui {
react.createElement(
"div",
{ id: "fad-progress-inner" },
react.createElement(
"div", {
id: "fad-thumb",
onMouseDown: handleMouseDown,
}
)
),
react.createElement("div", {
id: "fad-thumb",
onMouseDown: handleMouseDown,
})
)
),
react.createElement("span", { id: "fad-duration" }, Spicetify.Player.formatTime(duration))
);
Expand Down

0 comments on commit 24e1138

Please sign in to comment.