mirror of
https://github.com/danbulant/dribbblish-dynamic-theme
synced 2026-05-27 05:51:55 +00:00
This commit is contained in:
parent
28d977631f
commit
b52c9f889d
1 changed files with 19 additions and 9 deletions
|
|
@ -203,6 +203,7 @@ function updateColors(colHex) {
|
||||||
setRootColor('sidebar', colHex)
|
setRootColor('sidebar', colHex)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let coverListenerInstalled = true
|
||||||
async function songchange() {
|
async function songchange() {
|
||||||
// warning popup
|
// warning popup
|
||||||
if (Spicetify.PlaybackControl.featureVersion < "1.1.57")
|
if (Spicetify.PlaybackControl.featureVersion < "1.1.57")
|
||||||
|
|
@ -214,6 +215,9 @@ async function songchange() {
|
||||||
bgImage = "/images/tracklist-row-song-fallback.svg"
|
bgImage = "/images/tracklist-row-song-fallback.svg"
|
||||||
mainColor = "#509bf5"
|
mainColor = "#509bf5"
|
||||||
updateColors(mainColor)
|
updateColors(mainColor)
|
||||||
|
coverListenerInstalled = false
|
||||||
|
} else if (!coverListenerInstalled) {
|
||||||
|
hookCoverChange(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (album_uri !== undefined && !album_uri.includes('spotify:show')) {
|
if (album_uri !== undefined && !album_uri.includes('spotify:show')) {
|
||||||
|
|
@ -260,16 +264,22 @@ function pickCoverColor(img) {
|
||||||
updateColors(mainColor)
|
updateColors(mainColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
waitForElement([".cover-art-image"], (queries) => {
|
function hookCoverChange(pick) {
|
||||||
queries[0].addEventListener('load', function() {
|
waitForElement([".cover-art-image"], (queries) => {
|
||||||
try {
|
coverListenerInstalled = true
|
||||||
pickCoverColor(queries[0])
|
if (pick) pickCoverColor(queries[0])
|
||||||
} catch (error) {
|
queries[0].addEventListener('load', function() {
|
||||||
console.log(error);
|
try {
|
||||||
setTimeout(pickCoverColor, 300, queries[0])
|
pickCoverColor(queries[0])
|
||||||
}
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
setTimeout(pickCoverColor, 300, queries[0])
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
|
hookCoverChange(false);
|
||||||
|
|
||||||
(function Startup() {
|
(function Startup() {
|
||||||
if (!Spicetify.showNotification) {
|
if (!Spicetify.showNotification) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue