-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
50c1d6b
commit 9feab2f
Showing
10 changed files
with
81 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1 @@ | ||
console.log("%cSpotOn Started", "font-size: 40px; padding-bottom: 3px; color: white; text-shadow: -1px -1px #2e51a2, 1px -1px #2e51a2, -1px 1px #2e51a2, 1px 1px #2e51a2, 2px 2px #2e51a2, 3px 3px #2e51a2;"); | ||
|
||
// Select the parent element that is consistent and won't change. | ||
const container = document.body; | ||
|
||
let lastLoggedSong = ""; // Variable to keep track of the last logged song name. | ||
|
||
// Function to handle mutation observations | ||
const handleMutations = (mutations) => { | ||
const liveRegionElement = document.querySelector('span[aria-live="polite"][role="status"]'); | ||
if (!liveRegionElement) return; | ||
|
||
const liveRegionText = liveRegionElement.textContent.trim(); | ||
// Check if the song name has changed since the last log and is not blank. | ||
if (liveRegionText && liveRegionText !== lastLoggedSong) { | ||
console.log(liveRegionText); | ||
lastLoggedSong = liveRegionText; // Update the last logged song name. | ||
} | ||
}; | ||
|
||
// Create a MutationObserver to observe changes in the container. | ||
const observer = new MutationObserver((mutations) => { | ||
// Check if any mutation is related to childList or subtree. | ||
const isRelevantMutation = mutations.some(mutation => mutation.type === "childList" || mutation.type === "subtree"); | ||
if (isRelevantMutation) { | ||
handleMutations(mutations); | ||
} | ||
}); | ||
|
||
// Start observing the container for changes in child elements and subtree. | ||
observer.observe(container, { | ||
childList: true, | ||
subtree: true, | ||
characterData: true | ||
}); | ||
|
||
// This should be called when your application or the relevant part of your page is unloaded or no longer needs the observer. | ||
function disconnectObserver() { | ||
observer.disconnect(); | ||
console.log("MutationObserver disconnected to avoid memory leaks."); | ||
} | ||
// May lead to errors, add log to check when disconnected. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
.os-content [data-testid="NPV_Panel_OpenDiv"]> :last-child:has([data-testid="play-next-button"]) { display: none !important; } | ||
.Ai_McRq9wJEYK21w8nX_.qbOrWcMUhSri1nPkZLQA { display: none !important; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
.contentSpacing [data-testid="track-list"] [role="row"] [aria-label="Duration"],.contentSpacing [data-testid="track-list"] [role="presentation"] [role="columnheader"],.koyeY6AgGRPmyPITi7yO,.contentSpacing [data-testid="track-list"] [role="presentation"]:has([role="columnheader"]) { display: none !important; } | ||
.koyeY6AgGRPmyPITi7yO { display: none !important; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
zyeJ9w99yrvGokL3BsMc rX_OmqCngvY5ZCoYBZgb { display: none !important; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.bjB8WZd0Ev30ZFbiScDm { display: none !important } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters