fixes #1249
This commit is contained in:
@@ -17,13 +17,17 @@ module PostsHelper
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def wordbreakify(string)
|
||||||
|
string.gsub(/(.{15})/, "\\1<wbr>")
|
||||||
|
end
|
||||||
|
|
||||||
def post_source_tag(post)
|
def post_source_tag(post)
|
||||||
if post.source =~ %r!http://img\d+\.pixiv\.net/img/([^\/]+)/!
|
if post.source =~ %r!http://img\d+\.pixiv\.net/img/([^\/]+)/!
|
||||||
text = "pixiv/#{$1}"
|
text = "pixiv/<wbr>#{wordbreakify($1)}"
|
||||||
source_link = link_to(text, post.normalized_source)
|
source_link = link_to(text, post.normalized_source)
|
||||||
source_search = "source:#{text}/"
|
source_search = "source:#{text}/"
|
||||||
elsif post.source =~ %r!http://i\d\.pixiv\.net/img\d+/img/([^\/]+)/!
|
elsif post.source =~ %r!http://i\d\.pixiv\.net/img\d+/img/([^\/]+)/!
|
||||||
text = "pixiv/#{$1}"
|
text = "pixiv/<wbr>#{wordbreakify($1)}"
|
||||||
source_link = link_to(text, post.normalized_source)
|
source_link = link_to(text, post.normalized_source)
|
||||||
source_search = "source:#{text}/"
|
source_search = "source:#{text}/"
|
||||||
elsif post.source =~ %r{\Ahttps?://}
|
elsif post.source =~ %r{\Ahttps?://}
|
||||||
|
|||||||
Reference in New Issue
Block a user