Added subscriber count in the channel page
This commit is contained in:
1 parent
15841cf5bf
commit
9315fa6cf7
4 files changed
+37
-3
No files matched your search
+7
-1
@@ -2,9 +2,15 @@
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
- Subscriber count in the channel page
|
||||
|
||||
## [0.21.0] - 2024-03-07
|
||||
|
||||
### Added
|
||||
|
||||
@@ -16,6 +16,7 @@ function Init()
|
||||
m.banner = m.top.findNode("banner")
|
||||
m.thumbnail = m.top.findNode("thumbnail")
|
||||
m.authorLabel = m.top.findNode("authorLabel")
|
||||
m.subCountLabel = m.top.findNode("subCountLabel")
|
||||
m.subscribeButton = m.top.findNode("subscribeButton")
|
||||
m.rowList = m.top.FindNode("rowList")
|
||||
m.rowList.focusable = true
|
||||
@@ -60,6 +61,7 @@ function OnContentSet() as void
|
||||
|
||||
' NOTE: "_author" not "author". See PlaylistContentNode.xml for explanation.
|
||||
m.authorLabel.text = content._author
|
||||
m.subCountLabel.text = content.subCountText
|
||||
m.banner.uri = content.banner
|
||||
if StringUtils.IsNullOrEmpty(content.thumbnail)
|
||||
m.thumbnail.uri = ""
|
||||
|
||||
@@ -36,6 +36,10 @@
|
||||
id="authorLabel"
|
||||
translation="[115,40]"
|
||||
font="font:MediumBoldSystemFont" />
|
||||
<Label
|
||||
id="subCountLabel"
|
||||
translation="[115,70]"
|
||||
font="font:SmallestSystemFont" />
|
||||
</Poster>
|
||||
|
||||
<Button
|
||||
|
||||
@@ -251,12 +251,34 @@ namespace InvidiousContent
|
||||
|
||||
function GetVideoCountText(item as object) as string
|
||||
videoCount = ValidInt(item.videoCount)
|
||||
return videoCount = 1 ? "1 video" : `${videoCount} videos`
|
||||
if videoCount = 1
|
||||
return "1 video"
|
||||
end if
|
||||
return `${videoCount} videos`
|
||||
end function
|
||||
|
||||
function GetChannelSubCountText(channel as object) as string
|
||||
subCount = ValidInt(channel.subCount)
|
||||
return subCount = 1 ? "1 subscriber" : `${subCount} subscribers`
|
||||
if subCount = 1
|
||||
return "1 subscriber"
|
||||
end if
|
||||
|
||||
if subCount < 1000
|
||||
return `${subCount} subscribers`
|
||||
end if
|
||||
|
||||
subCount = subCount / 1000
|
||||
if subCount < 1000
|
||||
return `${FormatFloat(subCount)}K subscribers`
|
||||
end if
|
||||
|
||||
subCount = subCount / 1000
|
||||
if subCount < 1000
|
||||
return `${FormatFloat(subCount)}M subscribers`
|
||||
end if
|
||||
|
||||
subCount = subCount / 1000
|
||||
return `${FormatFloat(subCount)}B subscribers`
|
||||
end function
|
||||
|
||||
function PlaylistGetViewCountText(playlistItem as object) as string
|
||||
|
||||
Reference in new issue
Block a user