From d3252b6467f03e4d053c3d11cb23f95a3f6bf0a8 Mon Sep 17 00:00:00 2001 From: amd64fox <62529699+amd64fox@users.noreply.github.com> Date: Fri, 11 Aug 2023 02:02:40 +0300 Subject: [PATCH] themes for full screen lyrics - added static themes for full screen lyrics #363 --- Install.ps1 | 52 +++++++++++++++++++++++++++++++++----------- patches/patches.json | 14 +++++++++--- 2 files changed, 50 insertions(+), 16 deletions(-) diff --git a/Install.ps1 b/Install.ps1 index 6625e1b..930e272 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -403,6 +403,21 @@ function Unlock-Folder { } } } +function Mod-F { + param( + [string] $template, + [object[]] $arguments + ) + + $result = $template + for ($i = 0; $i -lt $arguments.Length; $i++) { + $placeholder = "{${i}}" + $value = $arguments[$i] + $result = $result -replace [regex]::Escape($placeholder), $value + } + + return $result +} function downloadSp() { @@ -937,8 +952,14 @@ function Helper($paramname) { if ([version]$offline -lt [version]"1.1.99.871") { $lyrics = "lyricscolor1"; $contents = $lyrics } if ([version]$offline -ge [version]"1.1.99.871") { $lyrics = "lyricscolor2"; $contents = $lyrics } - # xpui-routes-lyrics.js + # xpui.js or xpui-routes-lyrics.js if ([version]$offline -ge [version]"1.1.99.871") { + + $full_previous = Mod-F -template $webjson.others.$lyrics.add[0] -arguments $pasttext + $full_current = Mod-F -template $webjson.others.$lyrics.add[1] -arguments $current + $full_next = Mod-F -template $webjson.others.$lyrics.add[2] -arguments $next + $full_lyrics = Mod-F -template $webjson.others.$lyrics.add[3] -arguments $full_previous, $full_current, $full_next + $webjson.others.$lyrics.add[3] = $full_lyrics $webjson.others.$lyrics.replace[1] = '$1' + '"' + $pasttext + '"' $webjson.others.$lyrics.replace[2] = '$1' + '"' + $current + '"' $webjson.others.$lyrics.replace[3] = '$1' + '"' + $next + '"' @@ -951,6 +972,9 @@ function Helper($paramname) { else { $webjson.others.$lyrics.match = $webjson.others.$lyrics.match | Where-Object { $_ -ne $webjson.others.$lyrics.match[7] } } + if ([version]$offline -ge [version]"1.2.3.1107") { + $webjson.others.$lyrics.replace[8] = $webjson.others.$lyrics.replace[8] -f $background + } } # xpui-routes-lyrics.css @@ -1454,18 +1478,20 @@ If ($test_spa) { extract -counts 'more' -name '*.js' -helper 'MinJs' # xpui.css - if ($new_theme -or !($premium)) { - if (!($premium)) { - # Hide download icon on different pages - $css += $webjson.others.downloadicon.add - # Hide submenu item "download" - $css += $webjson.others.submenudownload.add - # Hide very high quality streaming - $css += $webjson.others.veryhighstream.add - } - - if ($null -ne $css ) { extract -counts 'one' -method 'zip' -name 'xpui.css' -add $css } + if (!($premium)) { + # Hide download icon on different pages + $css += $webjson.others.downloadicon.add + # Hide submenu item "download" + $css += $webjson.others.submenudownload.add + # Hide very high quality streaming + $css += $webjson.others.veryhighstream.add } + # Full screen lyrics + if ($lyrics_stat -and [version]$offline -ge [version]"1.2.3.1107") { + $css += $webjson.others.lyricscolor2.add[3] + } + if ($null -ne $css ) { extract -counts 'one' -method 'zip' -name 'xpui.css' -add $css } + # Old UI fix $contents = "fix-old-theme" @@ -1549,4 +1575,4 @@ if ($block_update) { extract -counts 'exe' -helper 'BlockUpdate' } # Start Spotify if ($start_spoti) { Start-Process -WorkingDirectory $spotifyDirectory -FilePath $spotifyExecutable } -Write-Host ($lang).InstallComplete`n -ForegroundColor Green +Write-Host ($lang).InstallComplete`n -ForegroundColor Green \ No newline at end of file diff --git a/patches/patches.json b/patches/patches.json index 5411a3a..68d7325 100644 --- a/patches/patches.json +++ b/patches/patches.json @@ -915,6 +915,12 @@ "fr": "1.1.99", "to": "" }, + "add": [ + " .npv-lyrics__text-wrapper--previous .npv-lyrics__text {color:{0} !important;}", + " .npv-lyrics__text-wrapper--current .npv-lyrics__text {color:{0} !important;}", + " .npv-lyrics__text-wrapper--next .npv-lyrics__text {color:{0} !important;}", + "{0}{1}{2}" + ], "match": [ "(.--lyrics-color-background.:(..|..colors.)background)", "(.--lyrics-color-passed.:)(..passed|.{5,8}fromCSS.+?RGBA\\))", @@ -923,7 +929,8 @@ "(.--lyrics-color-background.:)((..|..colors.)background)", "(.--lyrics-color-hover.:)(\"xxx\")", "(.--lyrics-color-maxmatch.:)(\"xxx\")", - "(color:)(.{1,4}colors.text)(},children:.{1,8}get\\(\"web-player.lyrics.unsynced\"\\))" + "(color:)(.{1,4}colors.text)(},children:.{1,8}get\\(\"web-player.lyrics.unsynced\"\\))", + "\\?(.{1,2}\\.colors.background):" ], "replace": [ "$1,\"--lyrics-color-hover\":\"xxx\",\"--lyrics-color-maxmatch\":\"xxx\"", @@ -933,7 +940,8 @@ "", "", "", - "" + "", + "?\"{0}\":" ] }, "fixcsslyricscolor2": { @@ -1167,4 +1175,4 @@ "replace": "min:250,max:400" } } -} +} \ No newline at end of file