tdiary-contrib 4.0.4 → 4.0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +6 -0
- data/Gemfile +2 -8
- data/Gemfile.lock +17 -21
- data/README.en.md +1 -1
- data/filter/commentsize.rb +1 -1
- data/filter/iplookup.rb +55 -55
- data/filter/plugin/commentsize.rb +1 -1
- data/filter/plugin/en/spambayes.rb +1 -1
- data/filter/plugin/iplookup.rb +39 -39
- data/filter/plugin/ja/antirefspam.rb +1 -1
- data/filter/plugin/ja/spambayes.rb +1 -1
- data/filter/plugin/spambayes.rb +1 -1
- data/filter/spambayes.rb +1 -1
- data/js/flickr.js +1 -1
- data/lib/bayes.rb +1 -1
- data/lib/bayes/convert.rb +1 -1
- data/lib/tdiary/contrib/version.rb +1 -1
- data/lib/wgs2tky.rb +93 -93
- data/plugin/appstore.rb +6 -6
- data/plugin/bigpresen.rb +3 -3
- data/plugin/bitly.rb +1 -1
- data/plugin/brow_si.rb +1 -1
- data/plugin/category_similar.rb +1 -1
- data/plugin/category_to_tagcloud.rb +2 -2
- data/plugin/coderay.rb +1 -1
- data/plugin/datepicker.rb +1 -1
- data/plugin/flickr.rb +2 -2
- data/plugin/git-register.rb +7 -7
- data/plugin/goo_gl.rb +7 -7
- data/plugin/google_map.rb +6 -6
- data/plugin/google_webmaster.rb +4 -4
- data/plugin/hb_footer.rb +5 -5
- data/plugin/hb_footer4sec.rb +5 -5
- data/plugin/hide_sidebar_iphone.rb +1 -1
- data/plugin/iddy.rb +1 -1
- data/plugin/image_ex.rb +17 -17
- data/plugin/image_gps.rb +3 -3
- data/plugin/inline_wiki.rb +6 -6
- data/plugin/instagr.rb +8 -8
- data/plugin/instagram.rb +1 -1
- data/plugin/ja/yo_update.rb +51 -0
- data/plugin/jquery_ui_theme.rb +8 -8
- data/plugin/jroku.rb +1 -1
- data/plugin/jyear.rb +2 -2
- data/plugin/makerss_category.rb +4 -4
- data/plugin/makerss_comment.rb +4 -4
- data/plugin/microsummary.rb +2 -2
- data/plugin/nhk_program_info.rb +2 -2
- data/plugin/picasa.rb +2 -2
- data/plugin/playstore.rb +3 -3
- data/plugin/rating.rb +10 -10
- data/plugin/recent_estraier.rb +7 -7
- data/plugin/search-bing.rb +1 -1
- data/plugin/search-google-custom.rb +1 -1
- data/plugin/search-yahoo-websearch.rb +8 -8
- data/plugin/search-yahoo.rb +1 -1
- data/plugin/section_footer2.rb +1 -1
- data/plugin/show_and_hide.rb +20 -20
- data/plugin/socialbutton.rb +2 -2
- data/plugin/tdiarytimes.rb +16 -16
- data/plugin/tdiarytimes2.rb +10 -10
- data/plugin/tdiarytimes_textstyle.rb +3 -3
- data/plugin/twitter_anywhere.rb +51 -51
- data/plugin/twitter_summary_card.rb +1 -1
- data/plugin/vote.rb +4 -4
- data/plugin/yahoo_kousei.rb +2 -2
- data/plugin/yo_update.rb +214 -0
- data/plugin/zenback.rb +2 -2
- data/spec/apple_webclip_spec.rb +6 -6
- data/util/estraier-search/estraier-register.rb +2 -2
- data/util/image-gallery/image-gallery.rb +8 -8
- data/util/image-gallery/misc/plugin/recent_image.rb +4 -4
- data/util/posttdiary/posttdiary-ex.rb +7 -7
- data/util/rast-search/rast-register.rb +1 -1
- metadata +4 -2
    
        data/plugin/search-bing.rb
    CHANGED
    
    
| @@ -41,12 +41,12 @@ def yahoo_websearch_api( q, start = 1 ) | |
| 41 41 | 
             
            	url = request_url
         | 
| 42 42 | 
             
            	appid = @conf['search-yahoo-websearch.appid']
         | 
| 43 43 | 
             
            	uri = URI::parse( @conf.base_url )
         | 
| 44 | 
            -
             | 
| 44 | 
            +
             | 
| 45 45 | 
             
            	url << "?appid=#{appid}&query=#{q}&results=20&start=#{start}&format=html&site=#{uri.host}"
         | 
| 46 46 |  | 
| 47 47 | 
             
            	proxy = @conf['proxy']
         | 
| 48 48 | 
             
            	proxy = 'http://' + proxy if proxy
         | 
| 49 | 
            -
             | 
| 49 | 
            +
             | 
| 50 50 | 
             
            	proxy_host, proxy_port = nil
         | 
| 51 51 | 
             
            	if proxy
         | 
| 52 52 | 
             
            		proxy_host = proxy_uri.host
         | 
| @@ -77,7 +77,7 @@ end | |
| 77 77 | 
             
            def search_result
         | 
| 78 78 | 
             
            	query = CGI::unescape( @cgi.params['q'][0] )
         | 
| 79 79 | 
             
            	start = CGI::unescape( @cgi.params['start'][0] || '1' ).to_i
         | 
| 80 | 
            -
             | 
| 80 | 
            +
             | 
| 81 81 | 
             
               begin
         | 
| 82 82 | 
             
            		uri = URI::parse( @conf.base_url )
         | 
| 83 83 | 
             
            		xml = yahoo_websearch_api( u( query.untaint ), start )
         | 
| @@ -89,7 +89,7 @@ def search_result | |
| 89 89 | 
             
            	rescue OpenURI::HTTPError
         | 
| 90 90 | 
             
            		return %Q|<p class="message">#$!</p>|
         | 
| 91 91 | 
             
            	end
         | 
| 92 | 
            -
             | 
| 92 | 
            +
             | 
| 93 93 | 
             
            	r = '<dl class="search-result autopagerize_page_element">'
         | 
| 94 94 | 
             
            	doc.elements.to_a( 'Result' ).each do |elem|
         | 
| 95 95 | 
             
            		url = elem.elements.to_a( 'Url' )[0].text
         | 
| @@ -100,13 +100,13 @@ def search_result | |
| 100 100 | 
             
            		r << %Q|<dd>#{search_to_html summary}</dd>|
         | 
| 101 101 | 
             
            	end
         | 
| 102 102 | 
             
            	r << '</dl>'
         | 
| 103 | 
            -
             | 
| 103 | 
            +
             | 
| 104 104 | 
             
            	r << '<div class="search-navi">'
         | 
| 105 105 | 
             
            	pos = doc.elements["/ResultSet"].attributes["firstResultPosition"]
         | 
| 106 106 | 
             
            	unless pos == '1'
         | 
| 107 107 | 
             
            		r << %Q|<a href="#{@conf.index}?q=#{u query}&start=#{pos.to_i - 20}" rel="prev"><前の20件</a> |
         | 
| 108 108 | 
             
            	end
         | 
| 109 | 
            -
             | 
| 109 | 
            +
             | 
| 110 110 | 
             
            	total = doc.elements["/ResultSet"].attributes["totalResultsAvailable"]
         | 
| 111 111 | 
             
            	ret = doc.elements["/ResultSet"].attributes["totalResultsReturned"]
         | 
| 112 112 |  | 
| @@ -114,8 +114,8 @@ def search_result | |
| 114 114 | 
             
            		r << %Q|<a href="#{@conf.index}?q=#{u query}&start=#{pos.to_i + 20}" rel="next">次の20件></a>|
         | 
| 115 115 | 
             
            	end
         | 
| 116 116 | 
             
            	r << '</div>'
         | 
| 117 | 
            -
             | 
| 117 | 
            +
             | 
| 118 118 | 
             
            	r << yahoo_websearch_attribution
         | 
| 119 | 
            -
             | 
| 119 | 
            +
             | 
| 120 120 | 
             
            	r
         | 
| 121 121 | 
             
            end
         | 
    
        data/plugin/search-yahoo.rb
    CHANGED
    
    
    
        data/plugin/section_footer2.rb
    CHANGED
    
    
    
        data/plugin/show_and_hide.rb
    CHANGED
    
    | @@ -10,63 +10,63 @@ require 'digest/md5' | |
| 10 10 |  | 
| 11 11 | 
             
            if /\A(?:latest|day|month|nyear|preview)\z/ =~ @mode
         | 
| 12 12 | 
             
               enable_js('show_and_hide.js')
         | 
| 13 | 
            -
             | 
| 13 | 
            +
             | 
| 14 14 | 
             
            end
         | 
| 15 15 |  | 
| 16 | 
            -
            def show_and_hide(contents, title = 'Show contents', | 
| 16 | 
            +
            def show_and_hide(contents, title = 'Show contents',
         | 
| 17 17 | 
             
                              type = :link,
         | 
| 18 18 | 
             
                              rss_title = '(Hide contents on RSS. See my page...)')
         | 
| 19 | 
            -
             | 
| 19 | 
            +
             | 
| 20 20 | 
             
               data_id = show_and_hide_id(contents)
         | 
| 21 | 
            -
             | 
| 21 | 
            +
             | 
| 22 22 | 
             
               toggle_attr = {:class => 'show_and_hide_toggle',
         | 
| 23 23 | 
             
                              :"data-showandhideid" => data_id}
         | 
| 24 | 
            -
             | 
| 24 | 
            +
             | 
| 25 25 | 
             
               dom_contents = ''
         | 
| 26 | 
            -
             | 
| 26 | 
            +
             | 
| 27 27 | 
             
               if feed? # RSS
         | 
| 28 28 | 
             
                  dom_contents = h(rss_title)
         | 
| 29 | 
            -
             | 
| 29 | 
            +
             | 
| 30 30 | 
             
               elsif type.to_s == 'button'
         | 
| 31 31 | 
             
                  toggle_attr.merge!(:value => title, :type => "button")
         | 
| 32 | 
            -
                  dom_contents = %Q|<input #{hash2attr(toggle_attr)}>| + | 
| 32 | 
            +
                  dom_contents = %Q|<input #{hash2attr(toggle_attr)}>| +
         | 
| 33 33 | 
             
                                 show_and_hide_contents(contents, data_id)
         | 
| 34 | 
            -
             | 
| 34 | 
            +
             | 
| 35 35 | 
             
               else
         | 
| 36 36 | 
             
                  toggle_attr.merge!(:href => 'javascript:void(0)')
         | 
| 37 | 
            -
                  dom_contents = %Q|<a #{hash2attr(toggle_attr)}>#{h(title)}</a>| + | 
| 37 | 
            +
                  dom_contents = %Q|<a #{hash2attr(toggle_attr)}>#{h(title)}</a>| +
         | 
| 38 38 | 
             
                                 show_and_hide_contents(contents, data_id)
         | 
| 39 | 
            -
             | 
| 39 | 
            +
             | 
| 40 40 | 
             
               end
         | 
| 41 | 
            -
             | 
| 41 | 
            +
             | 
| 42 42 | 
             
               dom_contents
         | 
| 43 | 
            -
             | 
| 43 | 
            +
             | 
| 44 44 | 
             
            end
         | 
| 45 45 |  | 
| 46 46 | 
             
            def show_and_hide_id(contents)
         | 
| 47 47 | 
             
               @@show_and_hide_counter ||= 0
         | 
| 48 48 | 
             
               @@show_and_hide_counter  += 1
         | 
| 49 | 
            -
             | 
| 49 | 
            +
             | 
| 50 50 | 
             
               "#{Time::now.strftime("%s")}_#{@@show_and_hide_counter}_#{ Digest::MD5.hexdigest(contents)}"
         | 
| 51 | 
            -
             | 
| 51 | 
            +
             | 
| 52 52 | 
             
            end
         | 
| 53 53 |  | 
| 54 54 | 
             
            def show_and_hide_contents(contents, id)
         | 
| 55 55 | 
             
               %Q|<pre class="show_and_hide" id="#{id}">#{h(contents)}</pre>|
         | 
| 56 | 
            -
             | 
| 56 | 
            +
             | 
| 57 57 | 
             
            end
         | 
| 58 58 |  | 
| 59 59 | 
             
            def hash2attr(hash)
         | 
| 60 60 | 
             
               attrs = []
         | 
| 61 | 
            -
             | 
| 61 | 
            +
             | 
| 62 62 | 
             
               hash.keys.each do |k|
         | 
| 63 63 | 
             
                  attrs << %Q|#{k}="#{hash[k]}"|
         | 
| 64 64 | 
             
               end
         | 
| 65 | 
            -
             | 
| 65 | 
            +
             | 
| 66 66 | 
             
               attrs.join(" ")
         | 
| 67 | 
            -
             | 
| 67 | 
            +
             | 
| 68 68 | 
             
            end
         | 
| 69 | 
            -
             | 
| 69 | 
            +
             | 
| 70 70 | 
             
            # Local Variables:
         | 
| 71 71 | 
             
            # mode: ruby
         | 
| 72 72 | 
             
            # indent-tabs-mode: t
         | 
    
        data/plugin/socialbutton.rb
    CHANGED
    
    | @@ -6,7 +6,7 @@ | |
| 6 6 |  | 
| 7 7 | 
             
            # enable social button names
         | 
| 8 8 | 
             
            @conf['socialbutton.enables'] ||= 'twitter,hatena,facebook_like'
         | 
| 9 | 
            -
            # screen name of the user to attribute the tweet to | 
| 9 | 
            +
            # screen name of the user to attribute the tweet to
         | 
| 10 10 | 
             
            @conf['socialbutton.twitter.via'] ||= ''
         | 
| 11 11 |  | 
| 12 12 | 
             
            def socialbutton_js_settings
         | 
| @@ -14,7 +14,7 @@ def socialbutton_js_settings | |
| 14 14 | 
             
            	enable_js('socialbutton.js')
         | 
| 15 15 | 
             
            	add_js_setting('$tDiary.plugin.socialbutton')
         | 
| 16 16 | 
             
            	# convert array to json
         | 
| 17 | 
            -
            	add_js_setting('$tDiary.plugin.socialbutton.enables', | 
| 17 | 
            +
            	add_js_setting('$tDiary.plugin.socialbutton.enables',
         | 
| 18 18 | 
             
            						%Q|["#{@conf['socialbutton.enables'].split(',').join('", "')}"]|)
         | 
| 19 19 |  | 
| 20 20 | 
             
            	if @conf['socialbutton.twitter.via'] != ''
         | 
    
        data/plugin/tdiarytimes.rb
    CHANGED
    
    | @@ -15,7 +15,7 @@ | |
| 15 15 | 
             
            # サーバが書き込み権限を持っているファイルを作ります。
         | 
| 16 16 | 
             
            #	これで日記に書き込みするごとに、tdiarytimes.pngに
         | 
| 17 17 | 
             
            #	画像を書き込みます。
         | 
| 18 | 
            -
            # | 
| 18 | 
            +
            #
         | 
| 19 19 | 
             
            # 日記上からこのpngファイルを呼び出すには、
         | 
| 20 20 | 
             
            # tDiray上からプラグインとして
         | 
| 21 21 | 
             
            # <%=tdiarytimes%>
         | 
| @@ -25,30 +25,30 @@ | |
| 25 25 | 
             
            #
         | 
| 26 26 | 
             
            # また、tdiary.confに以下のオプションを書き込むことにより、
         | 
| 27 27 | 
             
            # カスタマイズをすることが出来ます。
         | 
| 28 | 
            -
            # | 
| 28 | 
            +
            #
         | 
| 29 29 | 
             
            # @options['tdiarytimes.width'] = 400
         | 
| 30 30 | 
             
            # 四角の横幅。デフォルト値400。
         | 
| 31 31 | 
             
            # 実際に出力される画像サイズは、これに+10したサイズ。
         | 
| 32 | 
            -
            # | 
| 32 | 
            +
            #
         | 
| 33 33 | 
             
            # @options['tdiarytimes.height'] = 20
         | 
| 34 34 | 
             
            # 四角の縦幅。デフォルト値20。
         | 
| 35 35 | 
             
            # 実際に出力される画像サイズは、これに+16したサイズ。
         | 
| 36 | 
            -
            # | 
| 36 | 
            +
            #
         | 
| 37 37 | 
             
            # @options['tdiarytimes.file'] = 'tdiarytimes.png'
         | 
| 38 38 | 
             
            # 出力する画像ファイル名。デフォルトは'tdiarytimes.png'
         | 
| 39 | 
            -
            # | 
| 39 | 
            +
            #
         | 
| 40 40 | 
             
            # @options['tdiarytimes.fillcolor'] = '#444444'
         | 
| 41 41 | 
             
            # 四角の色。デフォルトは'#444444'
         | 
| 42 | 
            -
            # | 
| 42 | 
            +
            #
         | 
| 43 43 | 
             
            # @options['tdiarytimes.linecolor'] = '#ffffff'
         | 
| 44 44 | 
             
            # 縦棒の色。デフォルトは'#ffffff'
         | 
| 45 | 
            -
            # | 
| 45 | 
            +
            #
         | 
| 46 46 | 
             
            # @options['tdiarytimes.textcolor'] = '#444444'
         | 
| 47 47 | 
             
            # 文字色。デフォルトは'#444444'
         | 
| 48 | 
            -
            # | 
| 48 | 
            +
            #
         | 
| 49 49 | 
             
            # @options['tdiarytimes.text'] = 'T D I A R Y T I M E S'
         | 
| 50 50 | 
             
            # 出力する文字。デフォルトは'T D I A R Y T I M E S'。なお半角英数字のみ対応。
         | 
| 51 | 
            -
            # | 
| 51 | 
            +
            #
         | 
| 52 52 | 
             
            # @options['tdiarytimes.day'] = 30
         | 
| 53 53 | 
             
            # ログを保存する最大日数。デフォルトは30。
         | 
| 54 54 | 
             
            # この場合、30日以上経ったデータは消去され、縦棒として描画されなくなる。
         | 
| @@ -66,8 +66,8 @@ if /^(append|replace)$/ =~ @mode then | |
| 66 66 | 
             
            	linecolor = @options['tdiarytimes.linecolor'] || '#ffffff'
         | 
| 67 67 | 
             
            	textcolor = @options['tdiarytimes.textcolor'] || '#444444'
         | 
| 68 68 | 
             
            	text = @options['tdiarytimes.text'] || 'T D I A R Y T I M E S'
         | 
| 69 | 
            -
            	day = @options['tdiarytimes.day'] || 30 | 
| 70 | 
            -
             | 
| 69 | 
            +
            	day = @options['tdiarytimes.day'] || 30
         | 
| 70 | 
            +
             | 
| 71 71 | 
             
            	cache = "#{@cache_path}/tdiarytimes"
         | 
| 72 72 | 
             
            	Dir::mkdir( cache ) unless File::directory?( cache )
         | 
| 73 73 |  | 
| @@ -78,7 +78,7 @@ if /^(append|replace)$/ =~ @mode then | |
| 78 78 | 
             
            	fillcolor = image.colorAllocate(fillcolor)
         | 
| 79 79 | 
             
            	linecolor = image.colorAllocate(linecolor)
         | 
| 80 80 | 
             
            	textcolor = image.colorAllocate(textcolor)
         | 
| 81 | 
            -
             | 
| 81 | 
            +
             | 
| 82 82 | 
             
            	#帯の描画
         | 
| 83 83 | 
             
            	image.filledRectangle(5,8,width + 4,height + 7,fillcolor)
         | 
| 84 84 |  | 
| @@ -140,21 +140,21 @@ if /^(append|replace)$/ =~ @mode then | |
| 140 140 | 
             
            	pngfile = open(file, 'w')
         | 
| 141 141 | 
             
            		image.png(pngfile)
         | 
| 142 142 | 
             
            	pngfile.close
         | 
| 143 | 
            -
             | 
| 143 | 
            +
             | 
| 144 144 | 
             
            end
         | 
| 145 145 |  | 
| 146 146 | 
             
            def tdiarytimes(alt = nil)
         | 
| 147 147 | 
             
            	width = @options['tdiarytimes.width'].to_i || 400
         | 
| 148 148 | 
             
            	width += 10
         | 
| 149 | 
            -
             | 
| 149 | 
            +
             | 
| 150 150 | 
             
            	height = @options['tdiarytimes.height'].to_i || 20
         | 
| 151 151 | 
             
            	height += 16
         | 
| 152 | 
            -
             | 
| 152 | 
            +
             | 
| 153 153 | 
             
            	file = @options['tdiarytimes.file'] || 'tdiarytimes.png'
         | 
| 154 154 | 
             
            	text = @options['tdiarytimes.text'] || 'T D I A R Y T I M E S'
         | 
| 155 155 |  | 
| 156 156 | 
             
            	result = ""
         | 
| 157 | 
            -
             | 
| 157 | 
            +
             | 
| 158 158 | 
             
            	if alt
         | 
| 159 159 | 
             
            		result << %Q|<img src="#{h file}" alt="#{h alt}" width="#{width}" height="#{height}" class="tdiarytimes">|
         | 
| 160 160 | 
             
            	else
         | 
    
        data/plugin/tdiarytimes2.rb
    CHANGED
    
    | @@ -18,7 +18,7 @@ | |
| 18 18 | 
             
            # サーバが書き込み権限を持っているファイルを作ります。
         | 
| 19 19 | 
             
            #	これで日記に書き込みするごとに、tdiarytimes.pngに
         | 
| 20 20 | 
             
            #	画像を書き込みます。
         | 
| 21 | 
            -
            # | 
| 21 | 
            +
            #
         | 
| 22 22 | 
             
            # 日記上からこのpngファイルを呼び出すには、
         | 
| 23 23 | 
             
            # tDiray上からプラグインとして
         | 
| 24 24 | 
             
            # <%=tdiarytimes%>
         | 
| @@ -28,27 +28,27 @@ | |
| 28 28 | 
             
            #
         | 
| 29 29 | 
             
            # また、tdiary.confに以下のオプションを書き込むことにより、
         | 
| 30 30 | 
             
            # カスタマイズをすることが出来ます。
         | 
| 31 | 
            -
            # | 
| 31 | 
            +
            #
         | 
| 32 32 | 
             
            # @options['tdiarytimes.width'] = 400
         | 
| 33 33 | 
             
            # 四角の横幅。デフォルト値400。
         | 
| 34 34 | 
             
            # 実際に出力される画像サイズは、これに+10したサイズ。
         | 
| 35 | 
            -
            # | 
| 35 | 
            +
            #
         | 
| 36 36 | 
             
            # @options['tdiarytimes.height'] = 20
         | 
| 37 37 | 
             
            # 四角の縦幅。デフォルト値20。
         | 
| 38 38 | 
             
            # 実際に出力される画像サイズは、これに+16したサイズ。
         | 
| 39 | 
            -
            # | 
| 39 | 
            +
            #
         | 
| 40 40 | 
             
            # @options['tdiarytimes.file'] = 'tdiarytimes.png'
         | 
| 41 41 | 
             
            # 出力する画像ファイル名。デフォルトは'tdiarytimes.png'
         | 
| 42 | 
            -
            # | 
| 42 | 
            +
            #
         | 
| 43 43 | 
             
            # @options['tdiarytimes.fillcolor'] = '#444444'
         | 
| 44 44 | 
             
            # 四角の色。デフォルトは'#444444'
         | 
| 45 | 
            -
            # | 
| 45 | 
            +
            #
         | 
| 46 46 | 
             
            # @options['tdiarytimes.linecolor'] = '#ffffff'
         | 
| 47 47 | 
             
            # 縦棒の色。デフォルトは'#ffffff'
         | 
| 48 | 
            -
            # | 
| 48 | 
            +
            #
         | 
| 49 49 | 
             
            # @options['tdiarytimes.textcolor'] = '#444444'
         | 
| 50 50 | 
             
            # 文字色。デフォルトは'#444444'
         | 
| 51 | 
            -
            # | 
| 51 | 
            +
            #
         | 
| 52 52 | 
             
            # @options['tdiarytimes.fadeout'] = false
         | 
| 53 53 | 
             
            # フェードアウトするか。デフォルトはfalse。
         | 
| 54 54 | 
             
            # フェードアウトしたいときには true にすればよい。
         | 
| @@ -58,10 +58,10 @@ | |
| 58 58 | 
             
            # デフォルトではfillcolorへとフェードアウトしていく。
         | 
| 59 59 | 
             
            # ここで色を指定するとその色へとフェードアウトしていく。
         | 
| 60 60 | 
             
            # デフォルトは false
         | 
| 61 | 
            -
            # | 
| 61 | 
            +
            #
         | 
| 62 62 | 
             
            # @options['tdiarytimes.text'] = 'T D I A R Y T I M E S'
         | 
| 63 63 | 
             
            # 出力する文字。デフォルトは'T D I A R Y T I M E S'。なお半角英数字のみ対応。
         | 
| 64 | 
            -
            # | 
| 64 | 
            +
            #
         | 
| 65 65 | 
             
            # @options['tdiarytimes.day'] = 30
         | 
| 66 66 | 
             
            # ログを保存する最大日数。デフォルトは30。
         | 
| 67 67 | 
             
            # この場合、30日以上経ったデータは消去され、縦棒として描画されなくなる。
         | 
| @@ -47,7 +47,7 @@ | |
| 47 47 | 
             
            #
         | 
| 48 48 | 
             
            # オプション値の設定方法には3つの方法があり、その優先順位は次の通りです。
         | 
| 49 49 | 
             
            # <%= tdiarytimes_textstyle %> 引数指定 > tdiary.conf設定値 > デフォルト値
         | 
| 50 | 
            -
            # | 
| 50 | 
            +
            #
         | 
| 51 51 | 
             
            # entr_intervalを除いた全てのオプション値は <%= %> への引数指定により設定出来るため、
         | 
| 52 52 | 
             
            # ページにごとに意匠を変更するなど自由度の高いサイトデザインが可能です。
         | 
| 53 53 | 
             
            # 一方で、全てのオプションにデフォルト値が用意されているため、
         | 
| @@ -60,7 +60,7 @@ | |
| 60 60 | 
             
            #【書式】
         | 
| 61 61 | 
             
            # <%= tdiarytimes_textstyle init_text, entr_text, init_color, entr_color, fade_color, init_css, entr_css, title_text, fade_time %>
         | 
| 62 62 | 
             
            #
         | 
| 63 | 
            -
            #【記述例】 | 
| 63 | 
            +
            #【記述例】
         | 
| 64 64 | 
             
            # <%=tdiarytimes_textstyle "●","●","004400","66ff66","004400","background-color:#002200;font-size:9px",nil,"TEXTSTYLE!!",15 %>
         | 
| 65 65 | 
             
            #
         | 
| 66 66 | 
             
            # ※ tdiary.conf指定値、またはデフォルト値を使用したい場合は、引数に nil を指定してください。
         | 
| @@ -193,7 +193,7 @@ if /^(append|replace)$/ =~ @mode then | |
| 193 193 | 
             
            	if (Time.now.to_i - ary_data[144]) > entr_interval.to_f
         | 
| 194 194 | 
             
            		ary_data[(Time.now.strftime('%H').to_i*6 + Time.now.strftime('%M').to_f/10).to_i] = Time.now.to_i
         | 
| 195 195 | 
             
            		# 最終登録時間の記録
         | 
| 196 | 
            -
            		ary_data[144] = Time.now.to_i | 
| 196 | 
            +
            		ary_data[144] = Time.now.to_i
         | 
| 197 197 | 
             
            	end
         | 
| 198 198 |  | 
| 199 199 |  | 
    
        data/plugin/twitter_anywhere.rb
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            # -*- coding: utf-8 -*-
         | 
| 2 2 | 
             
            #
         | 
| 3 3 | 
             
            # twitter_anywhere.rb - bringing the Twitter communication platform to tDiary
         | 
| 4 | 
            -
            #  refer to the URL below. | 
| 4 | 
            +
            #  refer to the URL below.
         | 
| 5 5 | 
             
            #  https://dev.twitter.com/docs/anywhere/welcome
         | 
| 6 6 | 
             
            #
         | 
| 7 7 | 
             
            # Copyright (C) 2010-2012, tamoot <tamoot+tdiary@gmail.com>
         | 
| @@ -11,12 +11,12 @@ | |
| 11 11 | 
             
            def follow_button(account)
         | 
| 12 12 | 
             
               return not_support_anywhere unless support_anywhere?
         | 
| 13 13 | 
             
               return not_ready_anywhere   unless ready_anywhere?
         | 
| 14 | 
            -
             | 
| 14 | 
            +
             | 
| 15 15 | 
             
               if account.nil? || account == ''
         | 
| 16 16 | 
             
                  return anywhere_plugin_error("Account name is not specified.")
         | 
| 17 | 
            -
             | 
| 17 | 
            +
             | 
| 18 18 | 
             
               end
         | 
| 19 | 
            -
             | 
| 19 | 
            +
             | 
| 20 20 | 
             
               <<-FOLLOW_API
         | 
| 21 21 | 
             
               <span id="follow-twitterapi"></span>
         | 
| 22 22 | 
             
               <script type="text/javascript">
         | 
| @@ -25,96 +25,96 @@ def follow_button(account) | |
| 25 25 | 
             
                  });
         | 
| 26 26 | 
             
               </script>
         | 
| 27 27 | 
             
               FOLLOW_API
         | 
| 28 | 
            -
             | 
| 28 | 
            +
             | 
| 29 29 | 
             
            end
         | 
| 30 30 |  | 
| 31 31 | 
             
            def tweet_box(label = nil, content = nil, option = {})
         | 
| 32 32 | 
             
               return not_support_anywhere unless support_anywhere?
         | 
| 33 33 | 
             
               return not_ready_anywhere   unless ready_anywhere?
         | 
| 34 34 | 
             
               init_tweetbox
         | 
| 35 | 
            -
             | 
| 35 | 
            +
             | 
| 36 36 | 
             
               @tweetbox_opt.merge!(option)
         | 
| 37 37 | 
             
               @tweetbox_opt.merge!(:height => 120) unless option[:height].to_i > 0
         | 
| 38 38 | 
             
               @tweetbox_opt.merge!(:width  => 480) unless option[:width].to_i > 0
         | 
| 39 | 
            -
             | 
| 39 | 
            +
             | 
| 40 40 | 
             
               @tweetbox_opt.merge!(:label   => label)   if label
         | 
| 41 41 | 
             
               @tweetbox_opt.merge!(:defaultContent => content) if content
         | 
| 42 | 
            -
             | 
| 42 | 
            +
             | 
| 43 43 | 
             
               %Q|<span id="tweetbox"></span>|
         | 
| 44 | 
            -
             | 
| 44 | 
            +
             | 
| 45 45 | 
             
            end
         | 
| 46 46 |  | 
| 47 47 | 
             
            def twitter_anywhere_settings
         | 
| 48 48 | 
             
               enable_js('twitter_anywhere.js')
         | 
| 49 49 | 
             
               add_js_setting('$tDiary.plugin.twitter_anywhere')
         | 
| 50 | 
            -
             | 
| 50 | 
            +
             | 
| 51 51 | 
             
               selectors = @conf['twitter_anywhere.hovercards.selectors'].split(',').collect do |selector|
         | 
| 52 52 | 
             
                  %Q|"#{selector.strip}"|
         | 
| 53 53 | 
             
               end
         | 
| 54 54 | 
             
               add_js_setting('$tDiary.plugin.twitter_anywhere.selectors',
         | 
| 55 55 | 
             
                              "[#{selectors.join(',')}]" )
         | 
| 56 | 
            -
             | 
| 56 | 
            +
             | 
| 57 57 | 
             
               expanded = '{}'
         | 
| 58 58 | 
             
               if @conf['twitter_anywhere.hovercards.expand_default'] == 'true'
         | 
| 59 59 | 
             
                  expanded = '{"expanded":true}'
         | 
| 60 | 
            -
             | 
| 60 | 
            +
             | 
| 61 61 | 
             
               end
         | 
| 62 62 | 
             
               add_js_setting('$tDiary.plugin.twitter_anywhere.hovercards')
         | 
| 63 63 | 
             
               add_js_setting('$tDiary.plugin.twitter_anywhere.hovercards.expand_default',
         | 
| 64 64 | 
             
                              expanded)
         | 
| 65 | 
            -
             | 
| 65 | 
            +
             | 
| 66 66 | 
             
            end
         | 
| 67 67 |  | 
| 68 68 |  | 
| 69 | 
            -
            add_header_proc do | 
| 69 | 
            +
            add_header_proc do
         | 
| 70 70 |  | 
| 71 71 | 
             
               if /\A(?:latest|day|month|nyear|preview)\z/ =~ @mode
         | 
| 72 | 
            -
             | 
| 72 | 
            +
             | 
| 73 73 | 
             
                  if ready_anywhere?
         | 
| 74 74 | 
             
                     %Q|<script src="http://platform.twitter.com/anywhere.js?id=#{h @conf['twitter_anywhere.id']}&v=1"></script>|
         | 
| 75 | 
            -
             | 
| 75 | 
            +
             | 
| 76 76 | 
             
                  else
         | 
| 77 77 | 
             
                     ''
         | 
| 78 | 
            -
             | 
| 78 | 
            +
             | 
| 79 79 | 
             
                  end
         | 
| 80 | 
            -
             | 
| 80 | 
            +
             | 
| 81 81 | 
             
               end
         | 
| 82 | 
            -
             | 
| 82 | 
            +
             | 
| 83 83 | 
             
            end
         | 
| 84 84 |  | 
| 85 85 | 
             
            def init_tweetbox
         | 
| 86 86 | 
             
               @tweetbox_json_opt ||= []
         | 
| 87 87 | 
             
               @tweetbox_opt ||= {}
         | 
| 88 | 
            -
             | 
| 88 | 
            +
             | 
| 89 89 | 
             
            end
         | 
| 90 90 |  | 
| 91 91 | 
             
            add_footer_proc do |date|
         | 
| 92 | 
            -
             | 
| 92 | 
            +
             | 
| 93 93 | 
             
               if /\A(?:latest|day|month|nyear|preview)\z/ =~ @mode
         | 
| 94 | 
            -
             | 
| 94 | 
            +
             | 
| 95 95 | 
             
                  if ready_anywhere?
         | 
| 96 | 
            -
             | 
| 96 | 
            +
             | 
| 97 97 | 
             
                     init_tweetbox
         | 
| 98 | 
            -
             | 
| 98 | 
            +
             | 
| 99 99 | 
             
                     @tweetbox_opt.each_pair do |k, v|
         | 
| 100 100 | 
             
                        @tweetbox_json_opt << "\"#{k}\":\"#{v}\""
         | 
| 101 | 
            -
             | 
| 101 | 
            +
             | 
| 102 102 | 
             
                     end
         | 
| 103 | 
            -
             | 
| 103 | 
            +
             | 
| 104 104 | 
             
                     tweet_box_call =  %Q|<script type="text/javascript">\n|
         | 
| 105 105 | 
             
                     tweet_box_call << %Q|<!--\n|
         | 
| 106 106 | 
             
                     tweet_box_call << %Q|   showTweetBox({#{@tweetbox_json_opt.join(',')}});\n|
         | 
| 107 107 | 
             
                     tweet_box_call << %Q|//-->\n|
         | 
| 108 108 | 
             
                     tweet_box_call << %Q|</script>\n|
         | 
| 109 | 
            -
             | 
| 109 | 
            +
             | 
| 110 110 | 
             
                  else
         | 
| 111 111 | 
             
                     ''
         | 
| 112 | 
            -
             | 
| 112 | 
            +
             | 
| 113 113 | 
             
                  end
         | 
| 114 | 
            -
             | 
| 114 | 
            +
             | 
| 115 115 | 
             
               else
         | 
| 116 116 | 
             
                  ''
         | 
| 117 | 
            -
             | 
| 117 | 
            +
             | 
| 118 118 | 
             
               end
         | 
| 119 119 | 
             
            end
         | 
| 120 120 |  | 
| @@ -122,68 +122,68 @@ add_conf_proc( 'twitter_anywhere', 'Twitter Anywhere' ) do | |
| 122 122 | 
             
               if @mode == 'saveconf' then
         | 
| 123 123 | 
             
                  @conf['twitter_anywhere.id'] = @cgi.params['twitter_anywhere.id'][0]
         | 
| 124 124 | 
             
                  @conf['twitter_anywhere.hovercards.selectors'] = @cgi.params['twitter_anywhere.hovercards.selectors'][0]
         | 
| 125 | 
            -
                  @conf['twitter_anywhere.hovercards.expand_default'] = @cgi.params['twitter_anywhere.hovercards.expand_default'][0] | 
| 126 | 
            -
             | 
| 125 | 
            +
                  @conf['twitter_anywhere.hovercards.expand_default'] = @cgi.params['twitter_anywhere.hovercards.expand_default'][0]
         | 
| 126 | 
            +
             | 
| 127 127 | 
             
               end
         | 
| 128 | 
            -
             | 
| 128 | 
            +
             | 
| 129 129 | 
             
               expand_true  = ""
         | 
| 130 130 | 
             
               expand_false = "selected"
         | 
| 131 | 
            -
             | 
| 131 | 
            +
             | 
| 132 132 | 
             
               if @conf['twitter_anywhere.hovercards.expand_default'] == "true"
         | 
| 133 133 | 
             
                  expand_true  = "selected"
         | 
| 134 134 | 
             
                  expand_false = ""
         | 
| 135 | 
            -
             | 
| 135 | 
            +
             | 
| 136 136 | 
             
               end
         | 
| 137 | 
            -
             | 
| 137 | 
            +
             | 
| 138 138 | 
             
               <<-HTML
         | 
| 139 139 | 
             
               <h3 class="subtitle">Consumer key</h3>
         | 
| 140 | 
            -
             | 
| 140 | 
            +
             | 
| 141 141 | 
             
               <p><input name="twitter_anywhere.id" value="#{h @conf['twitter_anywhere.id']}" size="70"></p>
         | 
| 142 | 
            -
               <p>Register your tDiary and get Consumer key. | 
| 142 | 
            +
               <p>Register your tDiary and get Consumer key.
         | 
| 143 143 | 
             
               <a href="http://dev.twitter.com/anywhere">Go Twitter OAuth settings.</a></p>
         | 
| 144 | 
            -
             | 
| 144 | 
            +
             | 
| 145 145 | 
             
               <h3 class="subtitle">Rending Hovercards</h3>
         | 
| 146 | 
            -
             | 
| 146 | 
            +
             | 
| 147 147 | 
             
               <h4>CSS Selector To limit the scope of where Hovercards appear</h4>
         | 
| 148 148 | 
             
               <p><input name="twitter_anywhere.hovercards.selectors" value="#{h @conf['twitter_anywhere.hovercards.selectors']}" size="70"></p>
         | 
| 149 149 | 
             
               <p>example) div.section p, div.commentshort p, div.commentbody p</p>
         | 
| 150 | 
            -
             | 
| 150 | 
            +
             | 
| 151 151 | 
             
               <h4>Expanded by Default</h4>
         | 
| 152 152 | 
             
               <p><select name="twitter_anywhere.hovercards.expand_default">
         | 
| 153 153 | 
             
               <option value="true"  #{expand_true}>true</option>
         | 
| 154 154 | 
             
               <option value="false" #{expand_false}>false</option>
         | 
| 155 155 | 
             
               </select></p>
         | 
| 156 156 | 
             
               HTML
         | 
| 157 | 
            -
             | 
| 157 | 
            +
             | 
| 158 158 | 
             
            end
         | 
| 159 159 |  | 
| 160 160 | 
             
            def support_anywhere?
         | 
| 161 161 | 
             
               return false if @conf.mobile_agent? || feed?
         | 
| 162 162 | 
             
               return true
         | 
| 163 | 
            -
             | 
| 163 | 
            +
             | 
| 164 164 | 
             
            end
         | 
| 165 165 |  | 
| 166 166 | 
             
            def ready_anywhere?
         | 
| 167 | 
            -
               if @conf['twitter_anywhere.id'] && @conf['twitter_anywhere.id'].size > 0 | 
| 167 | 
            +
               if @conf['twitter_anywhere.id'] && @conf['twitter_anywhere.id'].size > 0
         | 
| 168 168 | 
             
                  return true
         | 
| 169 | 
            -
             | 
| 169 | 
            +
             | 
| 170 170 | 
             
               end
         | 
| 171 | 
            -
             | 
| 171 | 
            +
             | 
| 172 172 | 
             
               return false
         | 
| 173 | 
            -
             | 
| 173 | 
            +
             | 
| 174 174 | 
             
            end
         | 
| 175 175 |  | 
| 176 176 |  | 
| 177 177 | 
             
            def not_support_anywhere
         | 
| 178 | 
            -
               '[Twitter@Anywhere] not support this environment.' | 
| 179 | 
            -
             | 
| 178 | 
            +
               '[Twitter@Anywhere] not support this environment.'
         | 
| 179 | 
            +
             | 
| 180 180 | 
             
            end
         | 
| 181 181 |  | 
| 182 182 | 
             
            def not_ready_anywhere
         | 
| 183 183 | 
             
               anywhere_plugin_error(
         | 
| 184 184 | 
             
                  "Twitter consumer Key not specified.",
         | 
| 185 185 | 
             
                  %Q|<a href="http://dev.twitter.com/anywhere">Go Twitter OAuth settings.</a>|)
         | 
| 186 | 
            -
             | 
| 186 | 
            +
             | 
| 187 187 | 
             
            end
         | 
| 188 188 |  | 
| 189 189 | 
             
            def anywhere_plugin_error(message, detail= '')
         | 
| @@ -193,7 +193,7 @@ def anywhere_plugin_error(message, detail= '') | |
| 193 193 | 
             
               <p>#{detail}</p>
         | 
| 194 194 | 
             
               </div>
         | 
| 195 195 | 
             
               PLUGIN_ERROR
         | 
| 196 | 
            -
             | 
| 196 | 
            +
             | 
| 197 197 | 
             
            end
         | 
| 198 198 |  | 
| 199 199 | 
             
            if /\A(?:latest|day|month|nyear|preview)\z/ =~ @mode
         |