mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2023-06-08.git
synced 2024-08-15 00:53:38 +00:00
parent
1769b0fdce
commit
6c8a5a1e7f
7 changed files with 11 additions and 16 deletions
|
@ -540,7 +540,8 @@ p,
|
||||||
}
|
}
|
||||||
|
|
||||||
#descriptionWrapper {
|
#descriptionWrapper {
|
||||||
max-width: 600px;
|
max-width: 600px;
|
||||||
|
white-space: pre-wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Center the "invidious" logo on the search page */
|
/* Center the "invidious" logo on the search page */
|
||||||
|
|
|
@ -59,7 +59,7 @@ def get_about_info(ucid, locale)
|
||||||
banner = banners.try &.[-1]?.try &.["url"].as_s?
|
banner = banners.try &.[-1]?.try &.["url"].as_s?
|
||||||
|
|
||||||
description = initdata["header"]["interactiveTabbedHeaderRenderer"]["description"]["simpleText"].as_s
|
description = initdata["header"]["interactiveTabbedHeaderRenderer"]["description"]["simpleText"].as_s
|
||||||
description_html = HTML.escape(description).gsub("\n", "<br>")
|
description_html = HTML.escape(description)
|
||||||
|
|
||||||
is_family_friendly = initdata["microformat"]["microformatDataRenderer"]["familySafe"].as_bool
|
is_family_friendly = initdata["microformat"]["microformatDataRenderer"]["familySafe"].as_bool
|
||||||
allowed_regions = initdata["microformat"]["microformatDataRenderer"]["availableCountries"].as_a.map(&.as_s)
|
allowed_regions = initdata["microformat"]["microformatDataRenderer"]["availableCountries"].as_a.map(&.as_s)
|
||||||
|
@ -81,7 +81,7 @@ def get_about_info(ucid, locale)
|
||||||
# end
|
# end
|
||||||
|
|
||||||
description = initdata["metadata"]["channelMetadataRenderer"]?.try &.["description"]?.try &.as_s? || ""
|
description = initdata["metadata"]["channelMetadataRenderer"]?.try &.["description"]?.try &.as_s? || ""
|
||||||
description_html = HTML.escape(description).gsub("\n", "<br>")
|
description_html = HTML.escape(description)
|
||||||
|
|
||||||
is_family_friendly = initdata["microformat"]["microformatDataRenderer"]["familySafe"].as_bool
|
is_family_friendly = initdata["microformat"]["microformatDataRenderer"]["familySafe"].as_bool
|
||||||
allowed_regions = initdata["microformat"]["microformatDataRenderer"]["availableCountries"].as_a.map(&.as_s)
|
allowed_regions = initdata["microformat"]["microformatDataRenderer"]["availableCountries"].as_a.map(&.as_s)
|
||||||
|
|
|
@ -550,12 +550,12 @@ end
|
||||||
|
|
||||||
def parse_content(content : JSON::Any) : String
|
def parse_content(content : JSON::Any) : String
|
||||||
content["simpleText"]?.try &.as_s.rchop('\ufeff').try { |b| HTML.escape(b) }.to_s ||
|
content["simpleText"]?.try &.as_s.rchop('\ufeff').try { |b| HTML.escape(b) }.to_s ||
|
||||||
content["runs"]?.try &.as_a.try { |r| content_to_comment_html(r).try &.to_s } || ""
|
content["runs"]?.try &.as_a.try { |r| content_to_comment_html(r).try &.to_s.gsub("\n", "<br>") } || ""
|
||||||
end
|
end
|
||||||
|
|
||||||
def content_to_comment_html(content)
|
def content_to_comment_html(content)
|
||||||
comment_html = content.map do |run|
|
comment_html = content.map do |run|
|
||||||
text = HTML.escape(run["text"].as_s).gsub("\n", "<br>")
|
text = HTML.escape(run["text"].as_s)
|
||||||
|
|
||||||
if run["bold"]?
|
if run["bold"]?
|
||||||
text = "<b>#{text}</b>"
|
text = "<b>#{text}</b>"
|
||||||
|
|
|
@ -242,7 +242,7 @@ struct InvidiousPlaylist
|
||||||
end
|
end
|
||||||
|
|
||||||
def description_html
|
def description_html
|
||||||
HTML.escape(self.description).gsub("\n", "<br>")
|
HTML.escape(self.description)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -945,7 +945,7 @@ def extract_video_info(video_id : String, proxy_region : String? = nil, context_
|
||||||
# Description
|
# Description
|
||||||
|
|
||||||
description_html = video_secondary_renderer.try &.dig?("description", "runs")
|
description_html = video_secondary_renderer.try &.dig?("description", "runs")
|
||||||
.try &.as_a.try { |t| content_to_comment_html(t).gsub("\n", "<br/>") }
|
.try &.as_a.try { |t| content_to_comment_html(t) }
|
||||||
|
|
||||||
params["descriptionHtml"] = JSON::Any.new(description_html || "<p></p>")
|
params["descriptionHtml"] = JSON::Any.new(description_html || "<p></p>")
|
||||||
|
|
||||||
|
|
|
@ -74,9 +74,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="h-box">
|
<div class="h-box">
|
||||||
<div id="descriptionWrapper">
|
<div id="descriptionWrapper"><%= playlist.description_html %></div>
|
||||||
<p><%= playlist.description_html %></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% if playlist.is_a?(InvidiousPlaylist) && playlist.author == user.try &.email %>
|
<% if playlist.is_a?(InvidiousPlaylist) && playlist.author == user.try &.email %>
|
||||||
|
|
|
@ -257,14 +257,10 @@ we're going to need to do it here in order to allow for translations.
|
||||||
|
|
||||||
<div id="description-box"> <!-- Description -->
|
<div id="description-box"> <!-- Description -->
|
||||||
<% if video.description.size < 200 || params.extend_desc %>
|
<% if video.description.size < 200 || params.extend_desc %>
|
||||||
<div id="descriptionWrapper">
|
<div id="descriptionWrapper"><%= video.description_html %></div>
|
||||||
<%= video.description_html %>
|
|
||||||
</div>
|
|
||||||
<% else %>
|
<% else %>
|
||||||
<input id="descexpansionbutton" type="checkbox"/>
|
<input id="descexpansionbutton" type="checkbox"/>
|
||||||
<div id="descriptionWrapper">
|
<div id="descriptionWrapper"><%= video.description_html %></div>
|
||||||
<%= video.description_html %>
|
|
||||||
</div>
|
|
||||||
<label for="descexpansionbutton">
|
<label for="descexpansionbutton">
|
||||||
<a></a>
|
<a></a>
|
||||||
</label>
|
</label>
|
||||||
|
|
Loading…
Reference in a new issue