mirror of
https://github.com/danbulant/dribbblish-dynamic-theme
synced 2026-05-27 05:51:55 +00:00
add funtionality for #62
This commit is contained in:
parent
1ecc7c6b89
commit
13aba2b6c4
3 changed files with 69 additions and 28 deletions
|
|
@ -365,14 +365,14 @@ function pickCoverColor(img) {
|
||||||
|
|
||||||
function hookCoverChange(pick) {
|
function hookCoverChange(pick) {
|
||||||
waitForElement([".cover-art-image"], (queries) => {
|
waitForElement([".cover-art-image"], (queries) => {
|
||||||
coverListenerInstalled = true
|
coverListenerInstalled = true;
|
||||||
if (pick && queries[0].complete && queries[0].naturalHeight !== 0) pickCoverColor(queries[0])
|
if (pick && queries[0].complete && queries[0].naturalHeight !== 0) pickCoverColor(queries[0]);
|
||||||
queries[0].addEventListener('load', function() {
|
queries[0].addEventListener("load", function () {
|
||||||
try {
|
try {
|
||||||
pickCoverColor(queries[0])
|
pickCoverColor(queries[0]);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error);
|
||||||
setTimeout(pickCoverColor, 300, queries[0])
|
setTimeout(pickCoverColor, 300, queries[0]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -382,28 +382,31 @@ hookCoverChange(false);
|
||||||
|
|
||||||
(function Startup() {
|
(function Startup() {
|
||||||
if (!Spicetify.showNotification) {
|
if (!Spicetify.showNotification) {
|
||||||
setTimeout(Startup, 300)
|
setTimeout(Startup, 300);
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
// Check latest release
|
// Check latest release
|
||||||
fetch('https://api.github.com/repos/JulienMaille/dribbblish-dynamic-theme/releases/latest').then(response => {
|
fetch("https://api.github.com/repos/JulienMaille/dribbblish-dynamic-theme/releases/latest")
|
||||||
return response.json()
|
.then((response) => {
|
||||||
}).then(data => {
|
return response.json();
|
||||||
|
})
|
||||||
|
.then((data) => {
|
||||||
if (data.tag_name > current) {
|
if (data.tag_name > current) {
|
||||||
upd = document.createElement("div")
|
upd = document.createElement("div");
|
||||||
upd.innerText = `Theme UPD v${data.tag_name} avail.`
|
upd.innerText = `Theme UPD v${data.tag_name} avail.`;
|
||||||
upd.classList.add("ellipsis-one-line", "main-type-finale")
|
upd.classList.add("ellipsis-one-line", "main-type-finale");
|
||||||
upd.setAttribute("title", `Changes: ${data.name}`)
|
upd.setAttribute("title", `Changes: ${data.name}`);
|
||||||
upd.style.setProperty("color", "var(--spice-button-active)");
|
upd.style.setProperty("color", "var(--spice-button-active)");
|
||||||
document.querySelector(".main-userWidget-box").append(upd)
|
document.querySelector(".main-userWidget-box").append(upd);
|
||||||
document.querySelector(".main-userWidget-box").classList.add("update-avail")
|
document.querySelector(".main-userWidget-box").classList.add("update-avail");
|
||||||
new Spicetify.Menu.Item("Update Dribbblish", false, () => window.open("https://github.com/JulienMaille/dribbblish-dynamic-theme/blob/main/README.md#install--update", "_blank")).register();
|
new Spicetify.Menu.Item("Update Dribbblish", false, () => window.open("https://github.com/JulienMaille/dribbblish-dynamic-theme/blob/main/README.md#install--update", "_blank")).register();
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
|
||||||
// Do something for an error here
|
|
||||||
})
|
})
|
||||||
Spicetify.showNotification("Applied system " + (systemDark ? "dark" : "light") + " theme.")
|
.catch((err) => {
|
||||||
})()
|
// Do something for an error here
|
||||||
|
console.error(err);
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
|
||||||
/* translucid background cover */
|
/* translucid background cover */
|
||||||
document.styleSheets[0].insertRule(`
|
document.styleSheets[0].insertRule(`
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ class ConfigMenu {
|
||||||
elem.setAttribute("type", options.type);
|
elem.setAttribute("type", options.type);
|
||||||
elem.innerHTML = /* html */ `
|
elem.innerHTML = /* html */ `
|
||||||
<h2 class="x-settings-title main-type-cello${!options.description ? " no-desc" : ""}" as="h2">${options.name}</h2>
|
<h2 class="x-settings-title main-type-cello${!options.description ? " no-desc" : ""}" as="h2">${options.name}</h2>
|
||||||
<label class="main-type-mesto" as="label" for="dribbblish-config-input-${options.key}" style="color: var(--spice-subtext);">${options.description}</label>
|
<label class="main-type-mesto" as="label" for="dribbblish-config-input-${options.key}">${options.description}</label>
|
||||||
<label class="x-toggle-wrapper x-settings-secondColumn">
|
<label class="x-toggle-wrapper x-settings-secondColumn">
|
||||||
${options.input}
|
${options.input}
|
||||||
</label>
|
</label>
|
||||||
|
|
@ -336,6 +336,25 @@ waitForElement(["#main"], () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
DribbblishShared.config.register({
|
||||||
|
type: "select",
|
||||||
|
data: ["Dribbblish", "Spotify"],
|
||||||
|
key: "playerControlsStyle",
|
||||||
|
name: "Player Controls Style",
|
||||||
|
description: "Style of the Player Controls. Selecting Spotify basically changes Play / Pause back to the center",
|
||||||
|
defaultValue: 0,
|
||||||
|
onChange: (val) => {
|
||||||
|
switch (val) {
|
||||||
|
case 0:
|
||||||
|
document.getElementById("main").setAttribute("player-controls", "dribbblish");
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
document.getElementById("main").setAttribute("player-controls", "spotify");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function waitForElement(els, func, timeout = 100) {
|
function waitForElement(els, func, timeout = 100) {
|
||||||
|
|
|
||||||
21
user.css
21
user.css
|
|
@ -836,7 +836,8 @@ li.GlueDropTarget {
|
||||||
#dribbblish-config .dribbblish-config-container {
|
#dribbblish-config .dribbblish-config-container {
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
position: relative;
|
position: relative;
|
||||||
max-width: 80%;
|
min-width: 400px;
|
||||||
|
max-width: 30%;
|
||||||
background-color: rgba(var(--spice-rgb-main), 0.9);
|
background-color: rgba(var(--spice-rgb-main), 0.9);
|
||||||
backdrop-filter: blur(3px);
|
backdrop-filter: blur(3px);
|
||||||
padding: 20px 15px;
|
padding: 20px 15px;
|
||||||
|
|
@ -897,6 +898,7 @@ li.GlueDropTarget {
|
||||||
#dribbblish-config .dribbblish-config-item > .main-type-mesto {
|
#dribbblish-config .dribbblish-config-item > .main-type-mesto {
|
||||||
grid-area: description;
|
grid-area: description;
|
||||||
height: min-content;
|
height: min-content;
|
||||||
|
color: var(--spice-subtext);
|
||||||
}
|
}
|
||||||
|
|
||||||
#dribbblish-config .dribbblish-config-item > .x-settings-secondColumn {
|
#dribbblish-config .dribbblish-config-item > .x-settings-secondColumn {
|
||||||
|
|
@ -957,6 +959,23 @@ li.GlueDropTarget {
|
||||||
color: var(--spice-button);
|
color: var(--spice-button);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Spotify style player bar */
|
||||||
|
#main[player-controls=spotify] .main-nowPlayingBar-left {
|
||||||
|
order: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#main[player-controls=spotify] .main-nowPlayingBar-center {
|
||||||
|
order: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#main[player-controls=spotify] .main-nowPlayingWidget-nowPlaying {
|
||||||
|
justify-content: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
#main[player-controls=spotify] .player-controls {
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
/** Main container */
|
/** Main container */
|
||||||
.contentSpacing,
|
.contentSpacing,
|
||||||
.artist-artistDiscography-headerContainer {
|
.artist-artistDiscography-headerContainer {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue