Update samy.ps1
This commit is contained in:
49
samy.ps1
49
samy.ps1
@@ -719,54 +719,6 @@ function Get-SamyTasks {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Initialize-SamyTasks {
|
|
||||||
[CmdletBinding()]
|
|
||||||
param(
|
|
||||||
[Parameter(Mandatory = $true)]
|
|
||||||
[string]$Url,
|
|
||||||
|
|
||||||
[Parameter(Mandatory = $true)]
|
|
||||||
[object[]]$FallbackTasks
|
|
||||||
)
|
|
||||||
|
|
||||||
$tasks = Get-SamyTasks -Url $Url
|
|
||||||
if (-not $tasks) {
|
|
||||||
$tasks = @($FallbackTasks)
|
|
||||||
Write-LogHybrid "Using embedded fallback tasks ($($tasks.Count))" Info UI -LogToEvent
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Write-LogHybrid "Loaded remote tasks ($($tasks.Count))" Success UI -LogToEvent
|
|
||||||
}
|
|
||||||
|
|
||||||
# Ensure every task has a tooltip (default to Label) + safe escaping for title=''
|
|
||||||
foreach ($t in $tasks) {
|
|
||||||
$tooltip = $null
|
|
||||||
if ($t.PSObject.Properties.Name -contains 'Tooltip') {
|
|
||||||
$tooltip = [string]$t.Tooltip
|
|
||||||
}
|
|
||||||
|
|
||||||
if ([string]::IsNullOrWhiteSpace($tooltip)) {
|
|
||||||
$tooltip = [string]$t.Label
|
|
||||||
}
|
|
||||||
|
|
||||||
# Minimal HTML escaping for attribute usage
|
|
||||||
$tooltip = $tooltip -replace '&', '&'
|
|
||||||
$tooltip = $tooltip -replace "'", '''
|
|
||||||
$tooltip = $tooltip -replace '"', '"'
|
|
||||||
$tooltip = $tooltip -replace '<', '<'
|
|
||||||
$tooltip = $tooltip -replace '>', '>'
|
|
||||||
|
|
||||||
if ($t.PSObject.Properties.Name -contains 'Tooltip') {
|
|
||||||
$t.Tooltip = $tooltip
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$t | Add-Member -NotePropertyName Tooltip -NotePropertyValue $tooltip -Force
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $tasks
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion Remote Assets + Task Loading
|
#endregion Remote Assets + Task Loading
|
||||||
|
|
||||||
|
|
||||||
@@ -796,7 +748,6 @@ function Initialize-SamyTasks {
|
|||||||
# HandlerFn → the PowerShell function to invoke
|
# HandlerFn → the PowerShell function to invoke
|
||||||
# Page → which tab/page it appears on
|
# Page → which tab/page it appears on
|
||||||
|
|
||||||
# Embedded fallback (keep your current list here)
|
|
||||||
|
|
||||||
$Global:SamyTasks = Get-SamyTasks -Url $Script:SamyTasksUrl
|
$Global:SamyTasks = Get-SamyTasks -Url $Script:SamyTasksUrl
|
||||||
if (-not $Global:SamyTasks) {
|
if (-not $Global:SamyTasks) {
|
||||||
|
|||||||
Reference in New Issue
Block a user