ただのにっき
2007-10-25(木) [長年日記]
■ tDiary: iPod touch/iPhone対応をもう少し & YouTube対応
以前書いた、tDiaryをiPod touch/iPhoneで見やすくするプラグインを少し改善。でも汎用的にするのはかなり難しそうだ。
# iphone-detector.rb: iPod/iPhone detector
def iphone?
return @cgi.user_agent =~ /iPhone|iPod/
end
alias ipod? iphone?
add_header_proc do
if iphone? then
%Q|
<meta name="viewport" content="width = 320" />
<style type="text/css"><!--
form.comment textarea {
width: 80%;
}
--></style>|
end
end
日記オーナーに個別対応してもらうようなものでもないし、このままcoreに入れちゃおうかしらん。あと、tdiary.confの@referer_tableにこんな行があるけど、
['^(.{50}).*$', '\1...'],
この「50」を「30」くらいにするときれいにおさまる。
あと、contribに入ってるyoutubeプラグインをiPod touch/iPhone対応にした。
<a href="youtube:動画ID">
なんて書くと、そのまま再生できるリンクになるなんて知らんかったよ。こんなのアリか。