mirror of
https://github.com/nuttylmao/nutty.gg.git
synced 2026-09-19 04:00:59 -04:00
Added a "Show While Paused" option
This commit is contained in:
@@ -36,6 +36,8 @@ const useCustomColors = GetBooleanParam("useCustomColors", false);
|
|||||||
const color1 = urlParams.get('color1') || '#ffffff';
|
const color1 = urlParams.get('color1') || '#ffffff';
|
||||||
const color2 = urlParams.get('color2') || '#1d1d1d';
|
const color2 = urlParams.get('color2') || '#1d1d1d';
|
||||||
|
|
||||||
|
const autoHide = GetBooleanParam("autoHide", false);
|
||||||
|
const showWhilePaused = GetBooleanParam("showWhilePaused", false);
|
||||||
const includedApplications = urlParams.get('includedApplications') || '';
|
const includedApplications = urlParams.get('includedApplications') || '';
|
||||||
const excludedApplications = urlParams.get('excludedApplications') || '';
|
const excludedApplications = urlParams.get('excludedApplications') || '';
|
||||||
const showAlbumArt = GetBooleanParam("showAlbumArt", true);
|
const showAlbumArt = GetBooleanParam("showAlbumArt", true);
|
||||||
@@ -43,7 +45,6 @@ const showProgressBar = GetBooleanParam("showProgressBar", true);
|
|||||||
const swapArtistTrack = GetBooleanParam("swapArtistTrack", false);
|
const swapArtistTrack = GetBooleanParam("swapArtistTrack", false);
|
||||||
const showPrimary = GetBooleanParam("showPrimary", true);
|
const showPrimary = GetBooleanParam("showPrimary", true);
|
||||||
const showSecondary = GetBooleanParam("showSecondary", true);
|
const showSecondary = GetBooleanParam("showSecondary", true);
|
||||||
const autoHide = GetBooleanParam("autoHide", false);
|
|
||||||
const displayDuration = GetIntParam("displayDuration", 5);
|
const displayDuration = GetIntParam("displayDuration", 5);
|
||||||
const showAnimation = urlParams.get('showAnimation') || 'slide-in-from-bottom';
|
const showAnimation = urlParams.get('showAnimation') || 'slide-in-from-bottom';
|
||||||
const hideAnimation = urlParams.get('hideAnimation') || 'slide-out-bottom';
|
const hideAnimation = urlParams.get('hideAnimation') || 'slide-out-bottom';
|
||||||
@@ -363,7 +364,7 @@ async function UpdatePlayerState(data) {
|
|||||||
for (const targetApp of includedList) {
|
for (const targetApp of includedList) {
|
||||||
targetSession = validSessions.find(s => {
|
targetSession = validSessions.find(s => {
|
||||||
const matchesApp = (s.source_app_id || "").toLowerCase().includes(targetApp);
|
const matchesApp = (s.source_app_id || "").toLowerCase().includes(targetApp);
|
||||||
const isPlaying = s.playback_info && s.playback_info.PlaybackStatus === PlaybackStatus.PLAYING;
|
const isPlaying = s.playback_info && (s.playback_info.PlaybackStatus === PlaybackStatus.PLAYING || (showWhilePaused && s.playback_info.PlaybackStatus === PlaybackStatus.PAUSED));
|
||||||
return matchesApp && isPlaying;
|
return matchesApp && isPlaying;
|
||||||
});
|
});
|
||||||
if (targetSession) break;
|
if (targetSession) break;
|
||||||
@@ -387,7 +388,7 @@ async function UpdatePlayerState(data) {
|
|||||||
|
|
||||||
// Priority 2: If the current session isn't available/valid, find any session that is currently playing
|
// Priority 2: If the current session isn't available/valid, find any session that is currently playing
|
||||||
if (!targetSession || targetSession.playback_info.PlaybackStatus !== PlaybackStatus.PLAYING) {
|
if (!targetSession || targetSession.playback_info.PlaybackStatus !== PlaybackStatus.PLAYING) {
|
||||||
const playingSession = validSessions.find(s => s.playback_info && s.playback_info.PlaybackStatus === PlaybackStatus.PLAYING);
|
const playingSession = validSessions.find(s => s.playback_info && (s.playback_info.PlaybackStatus === PlaybackStatus.PLAYING || (showWhilePaused && s.playback_info.PlaybackStatus === PlaybackStatus.PAUSED)));
|
||||||
if (playingSession) {
|
if (playingSession) {
|
||||||
targetSession = playingSession;
|
targetSession = playingSession;
|
||||||
}
|
}
|
||||||
@@ -411,7 +412,7 @@ async function UpdatePlayerState(data) {
|
|||||||
|
|
||||||
// 1. Check if playback status has changed and update visibility accordingly
|
// 1. Check if playback status has changed and update visibility accordingly
|
||||||
if (playbackInfo.PlaybackStatus !== CurrentPlaybackStatus) {
|
if (playbackInfo.PlaybackStatus !== CurrentPlaybackStatus) {
|
||||||
if (playbackInfo.PlaybackStatus === PlaybackStatus.PLAYING)
|
if (playbackInfo.PlaybackStatus === PlaybackStatus.PLAYING || (showWhilePaused && playbackInfo.PlaybackStatus === PlaybackStatus.PAUSED))
|
||||||
SetVisibility(true);
|
SetVisibility(true);
|
||||||
else
|
else
|
||||||
SetVisibility(false);
|
SetVisibility(false);
|
||||||
@@ -421,7 +422,7 @@ async function UpdatePlayerState(data) {
|
|||||||
|
|
||||||
// 2. Check if the track name/artist have changed - this is our indicator that the next track has loaded
|
// 2. Check if the track name/artist have changed - this is our indicator that the next track has loaded
|
||||||
// Only proceed if the player state is actively playing audio
|
// Only proceed if the player state is actively playing audio
|
||||||
if (CurrentPlaybackStatus == PlaybackStatus.PLAYING) {
|
if (CurrentPlaybackStatus == PlaybackStatus.PLAYING || (showWhilePaused && CurrentPlaybackStatus == PlaybackStatus.PAUSED)) {
|
||||||
const newTrackKey = `${mediaProps.Title}-${mediaProps.Artist}-${mediaProps.Thumbnail}`;
|
const newTrackKey = `${mediaProps.Title}-${mediaProps.Artist}-${mediaProps.Thumbnail}`;
|
||||||
if (newTrackKey !== CurrentSongKey) {
|
if (newTrackKey !== CurrentSongKey) {
|
||||||
ChangeTrack(mediaProps, accentColorPalette); // Now trigger your cross-fade logic here!
|
ChangeTrack(mediaProps, accentColorPalette); // Now trigger your cross-fade logic here!
|
||||||
|
|||||||
@@ -150,6 +150,22 @@
|
|||||||
"showIf": "useCustomColors",
|
"showIf": "useCustomColors",
|
||||||
"group": "Appearance"
|
"group": "Appearance"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "autoHide",
|
||||||
|
"label": "Auto-Hide on Track Change",
|
||||||
|
"description": "If enabled, the widget will show for a set duration whenever a new track starts.",
|
||||||
|
"type": "checkbox",
|
||||||
|
"defaultValue": false,
|
||||||
|
"group": "General"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "showWhilePaused",
|
||||||
|
"label": "Show While Paused",
|
||||||
|
"description": "If enabled, the widget will be visible even when the track is paused.",
|
||||||
|
"type": "checkbox",
|
||||||
|
"defaultValue": false,
|
||||||
|
"group": "General"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "includedApplications",
|
"id": "includedApplications",
|
||||||
"label": "Included Apps",
|
"label": "Included Apps",
|
||||||
@@ -208,14 +224,6 @@
|
|||||||
"defaultValue": true,
|
"defaultValue": true,
|
||||||
"group": "General"
|
"group": "General"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"id": "autoHide",
|
|
||||||
"label": "Auto-Hide on Track Change",
|
|
||||||
"description": "If enabled, the widget will show for a set duration whenever a new track starts.",
|
|
||||||
"type": "checkbox",
|
|
||||||
"defaultValue": false,
|
|
||||||
"group": "General"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"id": "displayDuration",
|
"id": "displayDuration",
|
||||||
"label": "Display Duration (seconds)",
|
"label": "Display Duration (seconds)",
|
||||||
|
|||||||
Reference in New Issue
Block a user