From 296464028df71a2407b8e8a27c9303b3ccdfca42 Mon Sep 17 00:00:00 2001 From: charles Date: Thu, 14 Sep 2023 17:46:38 -0600 Subject: [PATCH] fix: seek icon console error & label misupdate (#117) --- src/components/seek/seek-icon.js | 2 +- src/models/seek/seek-controller.js | 2 +- src/models/seek/seek-icon.js | 15 +++++++++------ src/stores/data.js | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/components/seek/seek-icon.js b/src/components/seek/seek-icon.js index 39533331..b937a3ca 100644 --- a/src/components/seek/seek-icon.js +++ b/src/components/seek/seek-icon.js @@ -9,7 +9,7 @@ export const createSeekIcon = type => ` > + style="position:absolute;z-index:-10;background:transparent;font-weight:bold;font-size:small;top:46%;${type =='ff'? 'left' :'right'}:50%;text-align:center;"> div > a') - const contextType = anchor?.getAttribute('data-context-item-type') + const anchor = document.querySelector('[data-testid="context-item-info-title"] > span > a') + // album, track, episode, chapter + const contextType = anchor?.getAttribute('href')?.split('/')?.at(1) - return contextType == 'track' ? 'global' : 'shows' + return ['track', 'album'].includes(contextType) ? 'global' : 'shows' } removeIcons() { @@ -90,10 +91,12 @@ export default class SeekIcons { this.#spotifySeekIcons = { ff: spotifyFFIcon, rw: spotifyRWIcon } - if (spotifyRWIcon.style.display == 'none') return + if (spotifyRWIcon?.style?.display == 'none') return - spotifyRWIcon.style.display = 'none' - spotifyFFIcon.style.display = 'none' + if (spotifyRWIcon && spotifyFFIcon) { + spotifyRWIcon.style.display = 'none' + spotifyFFIcon.style.display = 'none' + } } #handleSeekButton(e) { diff --git a/src/stores/data.js b/src/stores/data.js index 575458b1..7b806b71 100644 --- a/src/stores/data.js +++ b/src/stores/data.js @@ -19,7 +19,7 @@ class DataStore { Object.keys(response).forEach(key => { const value = response[key] - if (!['enabled', 'globals'].includes(key) && !value.hasOwnProperty('isSkipped')) { + if (!['enabled', 'globals', 'chorus-seek'].includes(key) && !value.hasOwnProperty('isSkipped')) { const endTime = value?.endTime value.isSkipped = endTime == 0 }