diff options
author | (quasar) nebula <towerofnix@gmail.com> | 2021-07-17 21:43:22 -0300 |
---|---|---|
committer | (quasar) nebula <towerofnix@gmail.com> | 2021-07-17 21:43:22 -0300 |
commit | c30367f90211e6cfa61482bb68f829ee210e5cb6 (patch) | |
tree | a969bf45b36f442d4a2d6e96c1ed89542c312020 /ui.js | |
parent | 8f0ccabc8b12465771f770508fd0786baf49a518 (diff) |
auto expand/collapse timestamps (for SQP)
Diffstat (limited to 'ui.js')
-rw-r--r-- | ui.js | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/ui.js b/ui.js index c62f93a..b67fc8d 100644 --- a/ui.js +++ b/ui.js @@ -549,6 +549,18 @@ class AppElement extends FocusElement { } } + // Unfortunately, there isn't really any reliable way to make these work if + // the containing queue isn't of the selected queue player. + const timestampData = track && this.getTimestampData(track) + if (timestampData && queuePlayer === this.SQP) { + this.queueListingElement.expandTimestamps(track) + } + + const oldTimestampData = oldTrack && this.getTimestampData(oldTrack) + if (oldTimestampData && queuePlayer === this.SQP) { + this.queueListingElement.collapseTimestamps(oldTrack) + } + if (track && this.enableAutoDJ) { queuePlayer.setVolumeMultiplier(0.5); const message = 'now playing: ' + getNameWithoutTrackNumber(track); @@ -1943,7 +1955,7 @@ class AppElement extends FocusElement { if (isTimestamp && selectedIndex === playingIndex) { const selectedTimestampIndex = timestampData.indexOf(selectedInput.data) - const found = timestampData.findIndex(ts => ts.timestamp > timeData.curSecTotal) + const found = timestampData.findIndex(ts => ts.timestamp > trackPassedSec) const playingTimestampIndex = (found >= 0 ? found - 1 : 0) const distance = Math.abs(selectedTimestampIndex - playingTimestampIndex) @@ -2232,8 +2244,11 @@ class GrouplikeListingElement extends Form { expandTimestamps(item) { if (this.grouplike && this.grouplike.items.includes(item)) { - this.expandedTimestamps.push(item) - this.buildTimestampItems() + const ET = this.expandedTimestamps + if (!ET.includes(item)) { + this.expandedTimestamps.push(item) + this.buildTimestampItems() + } } } |