Changeset 37123 for platform/tdiary

Show
Ignore:
Timestamp:
03/30/10 14:34:32 (3 years ago)
Author:
sho
Message:

moved style to core/theme/base.css.

Location:
platform/tdiary/plugin
Files:
2 modified

Legend:

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

    r34374 r37123  
    2424require 'timeout' 
    2525require 'rexml/document' 
     26 
     27def nicovideo_player_js 
     28        <<-HTML 
     29        <script type="text/javascript"><!-- 
     30        function nicovideoPlayer( video_id ) { 
     31                document.getElementById( "thumbnail-" + video_id ).style.display = "none"; 
     32                document.getElementById( "player-" + video_id ).style.display = "inline"; 
     33                return false; 
     34        } 
     35        function nicovideoThumbnail( video_id ) { 
     36                document.getElementById( "thumbnail-" + video_id ).style.display = "inline"; 
     37                document.getElementById( "player-" + video_id ).style.display = "none"; 
     38                return false; 
     39        } 
     40        //--></script> 
     41        HTML 
     42end 
     43 
     44add_header_proc do 
     45        nicovideo_player_js 
     46end 
    2647 
    2748def nicovideo_call_api( video_id ) 
     
    6485end 
    6586 
    66 def nicovideo( video_id, label = nil, link = nil ) 
    67         begin 
    68                 @conf.to_native( nicovideo_inline( nicovideo_call_api( video_id ).elements, label, link ), 'UTF-8' ) 
    69         rescue ::Errno::ENOENT 
    70                 "<strong>Sorry, #{video_id} was deleted.</strong>" 
    71         rescue Timeout::Error, OpenURI::HTTPError, SecurityError 
    72                 nicovideo_iframe( video_id ) 
    73         end 
    74 end 
    75  
    7687def nicovideo_player( video_id, size = [544,384] ) 
    7788        if feed? or @conf.mobile_agent? or @conf.iphone? then 
     
    8596        end 
    8697end 
     98 
     99def nicovideo( video_id, label = nil, link = 'INLINE_PLAYER' ) 
     100        begin 
     101                r = '' 
     102                r << %Q|<div id="thumbnail-#{video_id}">| 
     103                thumb = @conf.to_native( nicovideo_inline( nicovideo_call_api( video_id ).elements, label, link ), 'UTF-8' ) 
     104                thumb.gsub!( /"INLINE_PLAYER"/, %Q|"#" onclick="return nicovideoPlayer( '#{video_id}' );"| ) 
     105                r << thumb 
     106                r << '</div>' 
     107                if feed? or @conf.mobile_agent? then 
     108                        r.gsub!( /<a .*?>/, '' ) 
     109                        r.gsub!( /<\/a>/, '' ) 
     110                else 
     111                        r << %Q|<div id="player-#{video_id}" style="display:none;background-color:#000;margin-left:2em;">| 
     112                        r << %Q|<a name="player-#{video_id}">| 
     113                        r << nicovideo_player( video_id, [544,384] ) 
     114                        r << %Q|</a>| 
     115                        r << %Q|<div class="nicovideo-player-close"><a href="#" onclick="return nicovideoThumbnail( '#{video_id}' )">Close Player</a></div>| 
     116                        r << %Q|</div>| 
     117                end 
     118                r 
     119        rescue ::Errno::ENOENT 
     120                "<strong>Sorry, #{video_id} was deleted.</strong>" 
     121        rescue Timeout::Error, OpenURI::HTTPError, SecurityError 
     122                nicovideo_iframe( video_id ) 
     123        end 
     124end 
     125 
     126#def nicovideo( video_id, label = nil, link = nil ) 
     127#       begin 
     128#               @conf.to_native( nicovideo_inline( nicovideo_call_api( video_id ).elements, label, link ), 'UTF-8' ) 
     129#       rescue ::Errno::ENOENT 
     130#               "<strong>Sorry, #{video_id} was deleted.</strong>" 
     131#       rescue Timeout::Error, OpenURI::HTTPError, SecurityError 
     132#               nicovideo_iframe( video_id ) 
     133#       end 
     134#end 
     135 
  • platform/tdiary/plugin/profile.rb

    r37046 r37123  
    171171 
    172172PROFILE_VERSION = '20090909' 
    173 add_header_proc do 
    174   html = <<-EOS 
    175   <style type="text/css"> 
    176     div.profile { 
    177       margin: 1em; 
    178       text-align: center; 
    179       border: solid 1px #999; 
    180     } 
    181     div.profile img { 
    182       border: none; 
    183     } 
    184     div.profile span { 
    185       font-size: 0.9em; 
    186       display: block; 
    187     } 
    188   </style> 
    189   EOS 
    190 end 
    191173 
    192174def profile(id, service = :twitter, options = {})