~ubuntu-branches/ubuntu/saucy/tdiary/saucy-proposed

« back to all changes in this revision

Viewing changes to contrib2/plugin/youtube.rb

  • Committer: Bazaar Package Importer
  • Author(s): Daigo Moriwaki
  • Date: 2011-04-11 21:53:16 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20110411215316-ih4gt4q8p29d2wf8
Tags: 3.0.1-1
* New upstream release (Closes: #542801, #594947)
* debian/control:
 - Bumped up Standards-Version to 3.9.1.
 - Updated version dependency.
* debian/tdiary-setup.rb: Followed the upstream changes, incorporating js and
  index.fcgi

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# youtube.rb: YouTube plugin for tDiary
 
3
#
 
4
# Copyright (C) 2010 by TADA Tadashi <t@tdtds.jp>
 
5
#
 
6
# usage: <%= youtube 'VIDEO_ID' %>
 
7
#
 
8
def youtube( video_id, size = [425,350] )
 
9
        if @conf.mobile_agent? or feed? then
 
10
                %Q|<div class="youtube"><a href="http://www.youtube.com/watch?v=#{video_id}">YouTube (#{video_id})</a></div>|
 
11
        elsif defined?( :smartphone? ) and @conf.smartphone?
 
12
                size = [240, 194]
 
13
                <<-TAG
 
14
                <iframe class="youtube-player" type="text/html" width="#{size[0]}" height="#{size[1]}" src="http://www.youtube.com/embed/#{video_id}" frameborder="0">
 
15
                </iframe>
 
16
                <div class="youtube"><a href="http://www.youtube.com/watch?v=#{video_id}">YouTube (#{video_id})</a></div>
 
17
                TAG
 
18
        else
 
19
                <<-TAG
 
20
                <iframe class="youtube-player" type="text/html" width="#{size[0]}" height="#{size[1]}" src="http://www.youtube.com/embed/#{video_id}" frameborder="0">
 
21
                </iframe>
 
22
                TAG
 
23
        end
 
24
end