mirror of
https://github.com/iv-org/invidious.git
synced 2026-09-06 00:52:45 -05:00
Make hashtags in video titles clickable
This commit is contained in:
parent
f755969050
commit
1832a12d29
@ -386,6 +386,18 @@ def parse_link_endpoint(endpoint : JSON::Any, text : String, video_id : String)
|
||||
return text
|
||||
end
|
||||
|
||||
def linkify_hashtags(title : String) : String
|
||||
String.build do |str|
|
||||
pos = 0
|
||||
title.scan(/#([a-zA-Z0-9_]+)/) do |match|
|
||||
str << title[pos...match.begin(0)]
|
||||
str << %(<a href="/hashtag/#{URI.encode_path(match[1])}">#{match[0]}</a>)
|
||||
pos = match.end(0)
|
||||
end
|
||||
str << title[pos..]
|
||||
end
|
||||
end
|
||||
|
||||
def encrypt_ecb_without_salt(data, key)
|
||||
cipher = OpenSSL::Cipher.new("aes-128-ecb")
|
||||
cipher.encrypt
|
||||
|
||||
@ -93,7 +93,11 @@ we're going to need to do it here in order to allow for translations.
|
||||
|
||||
<div class="h-box">
|
||||
<h1>
|
||||
<%= title %>
|
||||
<% if video.title.matches?(/#\w/) %>
|
||||
<%= linkify_hashtags(title) %>
|
||||
<% else %>
|
||||
<%= title %>
|
||||
<% end %>
|
||||
<% if params.listen %>
|
||||
<a title="<%=I18n.translate(locale, "Video mode")%>" id="link-iv-listen" data-base-url="/watch?<%= env.params.query %>&listen=0" href="/watch?<%= env.params.query %>&listen=0">
|
||||
<i class="icon ion-ios-videocam"></i>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user