Merge pull request #204 from JulienMaille/patch-1

Update dribbblish-dynamic.js
This commit is contained in:
morpheusthewhite 2020-11-27 07:41:24 +01:00 committed by GitHub
commit 52bfa30b85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -170,19 +170,12 @@ function LightenDarkenColor(hex, amt) {
return '#'+newColor.toString(16);
}
var nearTrackSpan = null
var nearArtistSpan = null
var mainColor = getComputedStyle(document.documentElement).getPropertyValue('--modspotify_main_fg')
var mainColor2 = getComputedStyle(document.documentElement).getPropertyValue('--modspotify_main_bg')
var isLightBg = isLight(mainColor2)
var lastDoc = null
waitForElement([".track"], (queries) => {
nearTrackSpan = document.createElement("span");
nearTrackSpan.id = "dribbblish-track-info";
queries[0].append(nearTrackSpan);
});
waitForElement([".artist"], (queries) => {
nearArtistSpan = document.createElement("span");
nearArtistSpan.id = "dribbblish-album-info";
@ -267,7 +260,6 @@ async function songchange() {
album_date = album_date.toLocaleString('default', album_date>recent_date ? { year: 'numeric', month: 'short' } : { year: 'numeric' })
album_link = "<a title=\""+Spicetify.Player.data.track.metadata.album_title+"\" href=\""+album_uri+"\" data-uri=\""+album_uri+"\" data-interaction-target=\"album-name\" class=\"tl-cell__content\">"+Spicetify.Player.data.track.metadata.album_title+"</a>"
if (nearTrackSpan!==null) nearTrackSpan.innerText = " • " + Spicetify.Player.data.track.metadata.popularity + "%"
if (nearArtistSpan!==null) nearArtistSpan.innerHTML = " — " + album_link + " • " + album_date
//waitForElement([".album-art__artist-name"], (queries) => {
@ -275,11 +267,9 @@ async function songchange() {
//}, 1000)
} else if (Spicetify.Player.data.track.metadata.album_track_number==0) {
// podcast?
nearTrackSpan.innerText = ""
nearArtistSpan.innerText = Spicetify.Player.data.track.metadata.album_title
} else if (Spicetify.Player.data.track.metadata.is_local=="true") {
// local?
nearTrackSpan.innerText = ""
nearArtistSpan.innerText = Spicetify.Player.data.track.metadata.album_title
} else {
// When clicking a song from the homepage, songChange is fired with half empty metadata