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