import "pkg:/source/utils/Logging.bs" import "pkg:/source/utils/TimeUtils.bs" import "pkg:/source/utils/Types.bs" function Init() m.durationRect = m.top.FindNode("durationRect") m.durationLabel = m.top.FindNode("durationLabel") end function function OnContentSet() as void content = m.top.itemContent if content = invalid return end if m.top.title = content.title m.top.thumbnailUri = content.thumbnail if ValidInt(content.lengthSeconds) <> 0 SetDurationText(content.lengthText) m.top.durationRectVisible = true else m.top.durationRectVisible = false end if SetHighlight() end function function OnIndexSet() as void SetHighlight() end function function SetDurationText(text as string) as void m.top.duration = text label = m.durationLabel rect = m.durationRect if label = invalid or rect = invalid return end if rectParent = rect.getParent() size = label.localBoundingRect() rect.width = size.width + 16 rect.translation = [rectParent.width - rect.width, rect.translation[1]] end function function SetHighlight() as void content = m.top.itemContent if content = invalid return end if contentIndex = content.queueIndex index = m.top.index if contentIndex = index ' bs:disable-next-line LINT3023 m.top.thumbnailBlendColor = "#FFFFFFFF" m.top.highlightUri = "pkg:/images/focus_grid.9.png" else m.top.thumbnailBlendColor = "#606060FF" m.top.highlightUri = "" end if end function