From 985506abee3d6771a60c978c42fc2621db77c2ee Mon Sep 17 00:00:00 2001 From: Stephan Yelle Date: Sun, 21 Dec 2025 19:08:44 -0500 Subject: [PATCH] Update samy.functions.ps1 --- samy.functions.ps1 | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/samy.functions.ps1 b/samy.functions.ps1 index 4900be2..e8ff7f1 100644 --- a/samy.functions.ps1 +++ b/samy.functions.ps1 @@ -136,5 +136,38 @@ function Initialize-NuGetProvider { } } + function Invoke-DisableAnimations { + param($Context) + + try { + $selected = @() + + if ($Context -and $Context.Request -and $Context.Request.HttpMethod -eq 'POST') { + $raw = (New-Object IO.StreamReader $Context.Request.InputStream).ReadToEnd() + if (-not [string]::IsNullOrWhiteSpace($raw)) { + $data = $raw | ConvertFrom-Json + if ($data.checkedValues) { $selected = @($data.checkedValues) } + } + } + + # If nothing selected, you decide the default. + # I usually default to "all", since the master checkbox implies intent. + if ($selected.Count -eq 0) { + $selected = @('window','taskbar','menus') + } + + # If you already have a single function that disables everything: + # you can just call it when any suboption is selected. + # OR implement per-suboption logic if you want true granularity. + Disable-Animations + + Write-LogHybrid "Disable Animations applied. Selected: $($selected -join ', ')" Success Tweaks -LogToEvent + Send-Text $Context "Disable Animations applied: $($selected -join ', ')" + } + catch { + Write-LogHybrid "Disable Animations failed: $($_.Exception.Message)" Error Tweaks -LogToEvent + Send-Text $Context "ERROR: $($_.Exception.Message)" + } + } #endregion App handlers