Skip to content

Commit

Permalink
fix: seek icon console error & label misupdate (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdrani authored Sep 14, 2023
1 parent b0a5d4e commit 2964640
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/components/seek/seek-icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const createSeekIcon = type => `
>
<span
id="seek-icon-${type}-label"
style="position:absolute;z-index:-10;background:transparent;font-weight:bold;font-size:smaller;top:50%;${type =='ff'? 'left' :'right'}:50%;text-align:center;">
style="position:absolute;z-index:-10;background:transparent;font-weight:bold;font-size:small;top:46%;${type =='ff'? 'left' :'right'}:50%;text-align:center;">
</span>
<svg
fill="none"
Expand Down
2 changes: 1 addition & 1 deletion src/models/seek/seek-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default class SeekController {
}

const { shows, global, seekChecked } = data
const { rwInput, ffInput, seekCheckbox, seekLabel } = this.elements
const { rwInput, ffInput, seekCheckbox } = this.elements

rwInput.value = seekChecked ? shows.rw : global.rw
ffInput.value = seekChecked ? shows.ff : global.ff
Expand Down
15 changes: 9 additions & 6 deletions src/models/seek/seek-icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ export default class SeekIcons {
}

get seekType() {
const anchor = document.querySelector('[data-testid="CoverSlotCollapsed__container"] > 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() {
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/stores/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 2964640

Please sign in to comment.