From b1a76f09a50849520ab20335d46b9610c49ae903 Mon Sep 17 00:00:00 2001 From: Rudis Muiznieks Date: Fri, 28 Apr 2023 21:42:51 -0500 Subject: [PATCH] playing queued item re-queues currently playing episode --- site/radiostasis.js | 10 ++++++++++ src/Playlist.ts | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/site/radiostasis.js b/site/radiostasis.js index 55a6a35..4e2ebb8 100644 --- a/site/radiostasis.js +++ b/site/radiostasis.js @@ -491,6 +491,14 @@ var Playlist = /** @class */ (function () { this.queueTab.classList.remove('expanded'); } }; + Playlist.prototype.reQueueNowPlaying = function () { + var currentEpisode = this.nowPlayingEpisodeHandler + ? this.nowPlayingEpisodeHandler() + : null; + if (currentEpisode) { + this.unshiftEpisodes([currentEpisode]); + } + }; Playlist.prototype.createQueueListItem = function (episode, withControls) { var _this = this; if (withControls === void 0) { withControls = true; } @@ -512,6 +520,7 @@ var Playlist = /** @class */ (function () { playBtn.href = '#'; playBtn.innerHTML = 'Play Now'; playBtn.addEventListener('click', function () { + _this.reQueueNowPlaying(); if (_this.playEpisodeHandler) _this.playEpisodeHandler(episode); }); @@ -530,6 +539,7 @@ var Playlist = /** @class */ (function () { text: message, gravity: 'bottom', position: 'right', + stopOnFocus: false, style: { marginBottom: '10ex', background: '#090', diff --git a/src/Playlist.ts b/src/Playlist.ts index 82e5acc..2174469 100644 --- a/src/Playlist.ts +++ b/src/Playlist.ts @@ -208,6 +208,15 @@ class Playlist { } } + private reQueueNowPlaying(): void { + const currentEpisode = this.nowPlayingEpisodeHandler + ? this.nowPlayingEpisodeHandler() + : null; + if (currentEpisode) { + this.unshiftEpisodes([currentEpisode]); + } + } + private createQueueListItem( episode: Episode, withControls = true @@ -230,6 +239,7 @@ class Playlist { playBtn.href = '#'; playBtn.innerHTML = 'Play Now'; playBtn.addEventListener('click', () => { + this.reQueueNowPlaying(); if (this.playEpisodeHandler) this.playEpisodeHandler(episode); }); const remBtn = document.createElement('a'); @@ -248,6 +258,7 @@ class Playlist { text: message, gravity: 'bottom', position: 'right', + stopOnFocus: false, style: { marginBottom: '10ex', background: '#090',