Hiding ad-like sections

- attempt to hide ad-like sections from the homepage
https://github.com/SpotX-CLI/SpotX-Win/issues/195
This commit is contained in:
amd64fox
2022-12-06 08:47:53 +03:00
parent ee520a32b6
commit 63447c9671
+31 -6
View File
@@ -1,9 +1,12 @@
param param
( (
[Parameter(HelpMessage = 'Remove podcasts/episodes/audiobooks from homepage.')] [Parameter(HelpMessage = 'Hiding podcasts/episodes/audiobooks from homepage.')]
[switch]$podcasts_off, [switch]$podcasts_off,
[Parameter(HelpMessage = 'Do not remove podcasts/episodes/audiobooks from homepage.')] [Parameter(HelpMessage = 'Hiding Ad-like sections from the homepage')]
[switch]$adsections_off,
[Parameter(HelpMessage = 'Do not hiding podcasts/episodes/audiobooks from homepage.')]
[switch]$podcasts_on, [switch]$podcasts_on,
[Parameter(HelpMessage = 'Block Spotify automatic updates.')] [Parameter(HelpMessage = 'Block Spotify automatic updates.')]
@@ -1030,12 +1033,20 @@ function Helper($paramname) {
} }
"OffPodcasts" { "OffPodcasts" {
# Turn off podcasts # Turn off podcasts
if ($offline -le "1.1.92.647") { $contents = "podcastsoff" }
if ($offline -ge "1.1.93.896" -and $offline -le "1.1.96.785") { $contents = "podcastsoff2" }
if ($offline -ge "1.1.97.952") { $contents = "podcastsoff3" }
$n = $js $n = $js
if ($offline -le "1.1.92.647") { $podcats = "podcastsoff" }
if ($offline -ge "1.1.93.896" -and $offline -le "1.1.96.785") { $podcats = "podcastsoff2" }
if ($offline -ge "1.1.97.952") { $podcats = "podcastsoff3" }
$name = "patches.json.others." $name = "patches.json.others."
$contents = $podcats $json = $webjson.others
}
"OffAdSections" {
# Hiding Ad-like sections from the homepage
if ($offline -le "1.1.96.785") { $webjson.others.adsectionsoff.replace = '$1 if ($3' + $webjson.others.adsectionsoff.replace }
else { $webjson.others.adsectionsoff.replace = '$1 if ($4' + $webjson.others.adsectionsoff.replace }
$n = $js
$name = "patches.json.others."
$contents = "adsectionsoff"
$json = $webjson.others $json = $webjson.others
} }
"OffRujs" { "OffRujs" {
@@ -1309,6 +1320,13 @@ if (Test-Path $xpui_js_patch) {
extract -counts 'one' -method 'nonezip' -name $js -helper 'OffPodcasts' extract -counts 'one' -method 'nonezip' -name $js -helper 'OffPodcasts'
} }
# Hiding Ad-like sections from the homepage
if ($adsections_off) {
if ($offline -ge "1.1.93.896" -and $offline -le "1.1.97.962") { $js = 'home-v2.js' }
if ($offline -ge "1.1.98.683") { $js = 'xpui.js' }
extract -counts 'one' -method 'nonezip' -name $js -helper 'OffAdSections'
}
# Static color for lyrics # Static color for lyrics
if ($lyrics_stat) { if ($lyrics_stat) {
if ($offline -lt "1.1.99.871") { if ($offline -lt "1.1.99.871") {
@@ -1424,6 +1442,13 @@ If (Test-Path $xpui_spa_patch) {
extract -counts 'one' -method 'zip' -name $js -helper 'OffPodcasts' extract -counts 'one' -method 'zip' -name $js -helper 'OffPodcasts'
} }
# Hiding Ad-like sections from the homepage
if ($adsections_off) {
if ($offline -ge "1.1.93.896" -and $offline -le "1.1.97.962") { $js = 'home-v2.js' }
if ($offline -ge "1.1.98.683") { $js = 'xpui.js' }
extract -counts 'one' -method 'zip' -name $js -helper 'OffAdSections'
}
# Hide Collaborators icon # Hide Collaborators icon
if (!($hide_col_icon_off) -and !($exp_spotify)) { if (!($hide_col_icon_off) -and !($exp_spotify)) {
extract -counts 'one' -method 'zip' -name 'xpui-routes-playlist.js' -helper 'Collaborators' extract -counts 'one' -method 'zip' -name 'xpui-routes-playlist.js' -helper 'Collaborators'