forked from midou/invidious
show member icon, hide deleted emojis, fix non-custom emojis
This commit is contained in:
parent
d03a62641f
commit
76ad4e8026
@ -405,6 +405,7 @@
|
|||||||
"YouTube comment permalink": "YouTube comment permalink",
|
"YouTube comment permalink": "YouTube comment permalink",
|
||||||
"permalink": "permalink",
|
"permalink": "permalink",
|
||||||
"`x` marked it with a ❤": "`x` marked it with a ❤",
|
"`x` marked it with a ❤": "`x` marked it with a ❤",
|
||||||
|
"Member": "Member",
|
||||||
"Audio mode": "Audio mode",
|
"Audio mode": "Audio mode",
|
||||||
"Video mode": "Video mode",
|
"Video mode": "Video mode",
|
||||||
"Playlists": "Playlists",
|
"Playlists": "Playlists",
|
||||||
|
@ -328,11 +328,21 @@ def template_youtube_comments(comments, locale, thin_mode, is_replies = false)
|
|||||||
end
|
end
|
||||||
|
|
||||||
author_name = HTML.escape(child["author"].as_s)
|
author_name = HTML.escape(child["author"].as_s)
|
||||||
|
member_icon = ""
|
||||||
if child["verified"]?.try &.as_bool && child["authorIsChannelOwner"]?.try &.as_bool
|
if child["verified"]?.try &.as_bool && child["authorIsChannelOwner"]?.try &.as_bool
|
||||||
author_name += " <i class=\"icon ion ion-md-checkmark-circle\"></i>"
|
author_name += " <i class=\"icon ion ion-md-checkmark-circle\"></i>"
|
||||||
elsif child["verified"]?.try &.as_bool
|
elsif child["verified"]?.try &.as_bool
|
||||||
author_name += " <i class=\"icon ion ion-md-checkmark\"></i>"
|
author_name += " <i class=\"icon ion ion-md-checkmark\"></i>"
|
||||||
end
|
end
|
||||||
|
if child["isMember"]?.try &.as_bool
|
||||||
|
member_icon = "<img
|
||||||
|
alt=\"\"
|
||||||
|
src=\"/ggpht#{URI.parse(child["memberIconUrl"].as_s).request_target}\"
|
||||||
|
width=\"16\"
|
||||||
|
height=\"16\"
|
||||||
|
title=\"#{translate(locale, "Member")}\"
|
||||||
|
/>"
|
||||||
|
end
|
||||||
html << <<-END_HTML
|
html << <<-END_HTML
|
||||||
<div class="pure-g" style="width:100%">
|
<div class="pure-g" style="width:100%">
|
||||||
<div class="channel-profile pure-u-4-24 pure-u-md-2-24">
|
<div class="channel-profile pure-u-4-24 pure-u-md-2-24">
|
||||||
@ -343,6 +353,7 @@ def template_youtube_comments(comments, locale, thin_mode, is_replies = false)
|
|||||||
<b>
|
<b>
|
||||||
<a class="#{child["authorIsChannelOwner"] == true ? "channel-owner" : ""}" href="#{child["authorUrl"]}">#{author_name}</a>
|
<a class="#{child["authorIsChannelOwner"] == true ? "channel-owner" : ""}" href="#{child["authorUrl"]}">#{author_name}</a>
|
||||||
</b>
|
</b>
|
||||||
|
#{member_icon}
|
||||||
<p style="white-space:pre-wrap">#{child["contentHtml"]}</p>
|
<p style="white-space:pre-wrap">#{child["contentHtml"]}</p>
|
||||||
END_HTML
|
END_HTML
|
||||||
|
|
||||||
@ -678,13 +689,17 @@ def content_to_comment_html(content, video_id : String? = "")
|
|||||||
text = "<b>#{text}</b>" if run["bold"]?
|
text = "<b>#{text}</b>" if run["bold"]?
|
||||||
text = "<s>#{text}</s>" if run["strikethrough"]?
|
text = "<s>#{text}</s>" if run["strikethrough"]?
|
||||||
text = "<i>#{text}</i>" if run["italics"]?
|
text = "<i>#{text}</i>" if run["italics"]?
|
||||||
|
if run["emoji"]?
|
||||||
|
if run["emoji"]["isCustomEmoji"]?.try &.as_bool
|
||||||
if emojiImage = run.dig?("emoji", "image")
|
if emojiImage = run.dig?("emoji", "image")
|
||||||
emojiAlt = emojiImage.dig?("accessibility", "accessibilityData", "label").try &.as_s || text
|
emojiAlt = emojiImage.dig?("accessibility", "accessibilityData", "label").try &.as_s || text
|
||||||
emojiThumb = emojiImage["thumbnails"][0]
|
emojiThumb = emojiImage["thumbnails"][0]
|
||||||
emojiUrl = "/ggpht#{URI.parse(emojiThumb["url"].as_s).request_target}"
|
text = "<img alt=\"#{emojiAlt}\" src=\"/ggpht#{URI.parse(emojiThumb["url"].as_s).request_target}\" title=\"#{emojiAlt}\" width=\"#{emojiThumb["width"]}\" height=\"#{emojiThumb["height"]}\" style=\"margin-right:2px;margin-left:2px;\"/>"
|
||||||
emojiWidth = emojiThumb["width"]
|
else
|
||||||
emojiHeight = emojiThumb["height"]
|
# Hide deleted channel emoji
|
||||||
text = "<img alt=\"#{emojiAlt}\" src=\"#{emojiUrl}\" width=\"#{emojiWidth}\" height=\"#{emojiHeight}\" style=\"margin-right:2px;margin-left:2px;\" />"
|
text = ""
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
text
|
text
|
||||||
|
Loading…
Reference in New Issue
Block a user