Show
Ignore:
Timestamp:
04/29/08 00:19:25 (7 months ago)
Author:
sho
Message:

platform/tdiary/plugin/nicovideo.rb: added nicovideo_player plugin.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • platform/tdiary/plugin/nicovideo.rb

    r7792 r10697  
    55# Distributed under GPL. 
    66# 
    7 # usage: <%= nicovideo 'sm99999999' %> 
     7# usage: 
     8#    Link to the movie and show thumbnail , description...: 
     9#    <%= nicovideo 'sm99999999' %> 
     10# 
     11#    Show Inline player: 
     12#    <%= nicovideo_player 'sm99999999' %> 
     13# 
     14#    Show Inline player with size: 
     15#    <%= nicovideo_player 'sm99999999', [400,300] %> 
    816# 
    917require 'open-uri' 
     
    8088        end 
    8189end 
     90 
     91def nicovideo_player( video_id, size = nil ) 
     92        if feed? then 
     93                nicovideo( video_id ) 
     94        else 
     95                s = '' 
     96                if size then 
     97                        s = "?w=#{h size[0]}&h=#{h size[1]}" 
     98                end 
     99                %Q|<script type="text/javascript" src="http://www.nicovideo.jp/thumb_watch/#{video_id}#{s}"></script>| 
     100        end 
     101end