Changeset 22134

Show
Ignore:
Timestamp:
10/26/08 02:47:44 (5 years ago)
Author:
drry
Message:
  • fixed missing vars.
  • et cetera.
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/ruby/hiki/plugins/tmethod.rb

    • Property svn:mime-type set to text/plain; charset=EUC-JP
    r18586 r22134  
    11# tmethod.rb $Revision: 1.00 $ 
    22# 
    3 # tmethod : �������ǿʹԤ����ⶶ�᥽�åɡ����������������� 
     3# tmethod : クリックで進行する「高橋メソッド」風巨大文字プレゼンテーションを挿入 
    44# 
    5 �ѥ��� : 
    6 #  str : �ʸ��"|"�ϥ��饤�ɤζ��ꡢ"/"�ϥ��饤������ԤȤʤ롣 
    7 #   "|"��|"����������ϡ����\"����ƥ��������ס� 
    8 #  width : ���饤�ɤ���������ꡣ(�ǥե��� : 480) 
    9 #  height : ���饤�ɤι⤵���ԥ�������ꡣ(�ǥե��� : 320) 
     5パラメタ : 
     6#  str : 本文。"|"はスライドの区切り、"/"はスライド内の改行となる。 
     7#   "|"と"|"を表示する場合には、前に"\"をつけてエスケープ。 
     8#  width : スライドの幅。ピクセルで指定。(デフォルト : 480) 
     9#  height : スライドの高さ。ピクセルで指定。(デフォルト : 320) 
    1010# 
    11 # ����� {{tmethod('����������������/ŷ��')}} 
     11# 記述例 : {{tmethod('こんに/ちは|今日は/いい/天気')}} 
    1212# 
    13 # ʸ�������ϡ�ɽ���ƥ����Ȥȥ��饤�ɤΥ������˹礦�褦��ưŪ������������ 
    14 # JavaScript + DHTML�����������Τǡ������ˤ��Ƥ�������������Ȥ⤢������ 
    15 # �¤�tDiary �Υץ饰������ƺ����Τ�ܤ��Τޤ�Ǥ��������ʤ����� 
     13# 文字のサイズは、表示テキストとスライドのサイズに合うよう自動的に調整されます。 
     14# JavaScript + DHTMLを用いて動かすので、閲覧環境によっては表示されないこともあります。 
     15# 実は tDiary のプラグインとして作ったのをほぼそのまんまです。ごめんなさい。 
    1616# 
    17 # Copyright (c) 2006 Maripo Goda  
     17# Copyright (c) 2006 Maripo Goda 
    1818# mailto:madin@madin.jp 
    1919# Document URL http://www.madin.jp/works/plugin.html 
     
    2222@tmethodID = 0; 
    2323 
    24 def tmethod (str='', width='480',height='320') 
     24def tmethod (str='', width='480', height='320') 
    2525        scriptID = 'bp' + @tmethodID.to_s; #str.crypt('takahashi').slice(2..4) 
    2626        @tmethodID += 1; 
    2727 
    28         presen_ary = str.gsub("\\/",'⁄').gsub("\\|","&\#65073").split(/\|/); 
     28        presen_ary = str.gsub("\\/", '⁄').gsub("\\|", "&#65073").split(/\|/); 
    2929        presen_ary.collect!{|s| 
    30                 s = '"' + s.gsub('/','<br>') + '"' 
     30                s = '"' + s.gsub('/', '<br>') + '"' 
    3131        } 
    3232        presen_str = presen_ary.join(',') 
     
    3636<!-- 
    3737t#{scriptID} = 0; 
    38 w#{scriptID}=#{width}; 
    39 h#{scriptID}="#{height}"; 
     38w#{scriptID} = #{width}; 
     39h#{scriptID} = "#{height}"; 
    4040msg#{scriptID} = new Array(#{presen_str}); 
    4141function #{scriptID} () { 
    4242        if (t#{scriptID} < msg#{scriptID}.length) { 
    43                 msgArr = msg#{scriptID}[t#{scriptID}].split('<br>'); 
     43                msgArr = msg#{scriptID}[t#{scriptID}].split("<br>"); 
    4444                maxPx = h#{scriptID} * 0.8; 
    4545                for (t = 0; t < msgArr.length; t ++) { 
     
    4747                } 
    4848                maxPx = Math.min(maxPx, Math.floor(h#{scriptID} * 0.8 / msgArr.length)); 
    49                 with (document.getElementById("#{scriptID}")) {  
     49                with (document.getElementById("#{scriptID}")) { 
    5050                        innerHTML = msg#{scriptID}[t#{scriptID}]; 
    5151                        style.fontSize = maxPx+"px"; 
     
    5757                t#{scriptID} = 0; 
    5858                with (document.getElementById("#{scriptID}")) { 
    59                         innerHTML = "��EPLAY��; 
    60                         style.fontSize = '100%'; 
    61                         style.top = '50%'; 
     59                        innerHTML = "《REPLAY》"; 
     60                        style.fontSize = "100%"; 
     61                        style.top = "50%"; 
    6262                } 
    6363        } 
    6464} 
    6565 
    66 function countLength (str)  
    67         { 
    68         len = 0; 
    69         for (i = 0; i < str.length; i++) { 
     66function countLength (str) { 
     67        var len = 0; 
     68        for (var i = 0, l = str.length; i < l; i ++) { 
    7069                len ++; 
    7170                if (escape(str.charAt(i)).length > 3) { 
    72                         len ++ 
     71                        len ++; 
    7372                } 
    7473        } 
    7574        return Math.max(len, 1); 
    7675} 
    77 --> 
     76//--> 
    7877</script> 
    7978 
    8079<noscript><p>JavaScript Required.</p></noscript> 
    81 <div class="bigpresen" style="text-align:center; position:relative; width:#{width}px; height:#{height}px; background:#fff;border:ridge 4px #ccc;" onclick="#{scriptID}()"> 
     80<div class="bigpresen" style="text-align:center; position:relative; width:#{width}px; height:#{height}px; background:#fff; border:4px ridge #ccc;" onclick="#{scriptID}()"> 
    8281 
    83 <span id="#{scriptID}" style="width:100%; position:absolute; top:50%; left:0; line-height:100%; color:black; font-family:'�ͣ��Х����å�', sans-serif;">��TART��/span> 
     82<span id="#{scriptID}" style="width:100%; position:absolute; top:50%; left:0; line-height:100%; color:black; font-family:'MS Pゴシック', sans-serif;">《START》</span> 
    8483 
    8584</div>