Update samy.functions.ps1
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user