fixes #80: Clicking Pixiv source address at the information panel

This commit is contained in:
albert
2011-09-16 10:58:02 -04:00
parent 5ee7bcd51b
commit fbc1fb1f51
2 changed files with 16 additions and 2 deletions

View File

@@ -319,6 +319,20 @@ class Post < ActiveRecord::Base
"Safe"
end
end
def normalized_source
if source =~ /pixiv\.net\/img\//
img_id = source[/(\d+)(_s|_m|(_big)?_p\d+)?\.[\w\?]+\s*$/, 1]
if $2 =~ /_p/
"http://www.pixiv.net/member_illust.php?mode=manga&illust_id=#{img_id}"
else
"http://www.pixiv.net/member_illust.php?mode=medium&illust_id=#{img_id}"
end
else
source
end
end
end
module TagMethods