tdiary 4.1.3 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +24 -25
  3. data/js/amazon.js +5 -35
  4. data/js/amazon_bitly.js +43 -0
  5. data/lib/tdiary/admin.rb +0 -8
  6. data/lib/tdiary/configuration.rb +5 -5
  7. data/lib/tdiary/core_ext.rb +5 -3
  8. data/lib/tdiary/dispatcher/index_main.rb +10 -16
  9. data/lib/tdiary/dispatcher/update_main.rb +8 -18
  10. data/lib/tdiary/filter/spam.rb +2 -2
  11. data/lib/tdiary/plugin/00default.rb +13 -37
  12. data/lib/tdiary/plugin/en/00default.rb +30 -32
  13. data/lib/tdiary/plugin/en/05referer.rb +4 -4
  14. data/lib/tdiary/plugin/ja/00default.rb +28 -31
  15. data/lib/tdiary/plugin/ja/05referer.rb +4 -4
  16. data/lib/tdiary/version.rb +1 -1
  17. data/lib/tdiary/view.rb +0 -4
  18. data/misc/plugin/amazon.rb +4 -2
  19. data/misc/plugin/amazon/amazonimg.rb +1 -1
  20. data/misc/plugin/category.rb +12 -20
  21. data/misc/plugin/category_autocomplete.rb +1 -1
  22. data/misc/plugin/comment_emoji_autocomplete.rb +1 -2
  23. data/misc/plugin/edit_today.rb +5 -9
  24. data/misc/plugin/en/pb-show.rb +2 -2
  25. data/misc/plugin/en/tb-show.rb +4 -4
  26. data/misc/plugin/hide-mail-field.rb +2 -2
  27. data/misc/plugin/image.rb +1 -3
  28. data/misc/plugin/ja/pb-show.rb +2 -2
  29. data/misc/plugin/ja/tb-show.rb +4 -4
  30. data/misc/plugin/my-ex.rb +0 -4
  31. data/misc/plugin/my-sequel.rb +10 -10
  32. data/misc/plugin/pb-show.rb +0 -6
  33. data/misc/plugin/ping.rb +1 -1
  34. data/misc/plugin/random_google.rb +12 -12
  35. data/misc/plugin/recent_rss.rb +3 -2
  36. data/misc/plugin/speed_comment.rb +1 -1
  37. data/misc/plugin/tb-show.rb +0 -6
  38. data/misc/plugin/weather.rb +3 -7
  39. data/spec/acceptance/save_conf_dnsbl_spec.rb +2 -2
  40. data/spec/core/core_ext_spec.rb +7 -0
  41. data/spec/plugin/plugin_helper.rb +3 -9
  42. metadata +4 -14
  43. data/views/i.category.rhtml +0 -6
  44. data/views/i.conf.rhtml +0 -14
  45. data/views/i.day.rhtml +0 -28
  46. data/views/i.diary.rhtml +0 -17
  47. data/views/i.footer.rhtml +0 -2
  48. data/views/i.header.rhtml +0 -3
  49. data/views/i.latest.rhtml +0 -24
  50. data/views/i.month.rhtml +0 -39
  51. data/views/i.search.rhtml +0 -5
  52. data/views/i.update.rhtml +0 -40
  53. data/views/i.update.rhtml.en +0 -40
@@ -65,7 +65,7 @@ def amazon_call_ecs( asin, country = nil )
65
65
  url << "&ResponseGroup=Medium"
66
66
  url << "&Version=#{@amazon_require_version}"
67
67
 
68
- timeout( 10 ) do
68
+ Timeout::timeout( 10 ) do
69
69
  open( url, proxy: @proxy ) {|f| f.read}
70
70
  end
71
71
  end
@@ -54,23 +54,18 @@ def category_anchor(category)
54
54
  else
55
55
  ""
56
56
  end
57
- if @category_icon[category] and !@cgi.mobile_agent?
57
+ if @category_icon[category]
58
58
  %Q|<a href="#{h @index}?#{period_string}category=#{u category}" title="#{h category}"><img class="category" src="#{h @category_icon_url}#{h @category_icon[category]}" alt="#{h category}"></a>|
59
59
  else
60
60
  %Q|[<a href="#{h @index}?#{period_string}category=#{u category}" title="#{h category}">#{h category}</a>]|
61
61
  end
62
62
  end
63
63
 
64
- def category_navi_anchor(info, label, mobile = false)
65
- if mobile then
66
- "|#{info.make_anchor(label)}"
67
- else
68
- ((!label.nil?) && label.empty?) ? '' : %Q[<span class="adminmenu">#{info.make_anchor(label)}</span>\n]
69
- end
64
+ def category_navi_anchor(info, label)
65
+ ((!label.nil?) && label.empty?) ? '' : %Q[<span class="adminmenu">#{info.make_anchor(label)}</span>\n]
70
66
  end
71
67
 
72
68
  def category_navi
73
- mobile = @cgi.mobile_agent?
74
69
  info = Category::Info.new(@cgi, @years, @conf)
75
70
  mode = info.mode
76
71
 
@@ -79,23 +74,21 @@ def category_navi
79
74
  when :year, :half, :quarter, :month
80
75
  all_diary = Category::Info.new(@cgi, @years, @conf, year: -1, month: -1)
81
76
  all = Category::Info.new(@cgi, @years, @conf, category: ['ALL'], year: -1, month: -1)
82
- result << category_navi_anchor(info.prev, @conf['category.prev_' + mode.to_s], mobile)
83
- result << category_navi_anchor(info.next, @conf['category.next_' + mode.to_s], mobile)
84
- unless mobile then
85
- result << category_navi_anchor(all_diary, @conf['category.all_diary'])
86
- result << category_navi_anchor(all, @conf['category.all'])
87
- end
77
+ result << category_navi_anchor(info.prev, @conf['category.prev_' + mode.to_s])
78
+ result << category_navi_anchor(info.next, @conf['category.next_' + mode.to_s])
79
+ result << category_navi_anchor(all_diary, @conf['category.all_diary'])
80
+ result << category_navi_anchor(all, @conf['category.all'])
88
81
  when :all
89
82
  year = Category::Info.new(@cgi, @years, @conf, year: Time.now.year.to_s)
90
83
  half = Category::Info.new(@cgi, @years, @conf, year: Time.now.year.to_s, month: "#{((Time.now.month - 1) / 6 + 1)}H")
91
84
  quarter = Category::Info.new(@cgi, @years, @conf, year: Time.now.year.to_s, month: "#{((Time.now.month - 1) / 3 + 1)}Q")
92
85
  month = Category::Info.new(@cgi, @years, @conf, year: Time.now.year.to_s, month: '%02d' % Time.now.month)
93
- result << category_navi_anchor(year, @conf['category.this_year'], mobile)
94
- result << category_navi_anchor(half, @conf['category.this_half'], mobile)
95
- result << category_navi_anchor(quarter, @conf['category.this_quarter'], mobile)
96
- result << category_navi_anchor(month, @conf['category.this_month'], mobile)
86
+ result << category_navi_anchor(year, @conf['category.this_year'])
87
+ result << category_navi_anchor(half, @conf['category.this_half'])
88
+ result << category_navi_anchor(quarter, @conf['category.this_quarter'])
89
+ result << category_navi_anchor(month, @conf['category.this_month'])
97
90
  end
98
- if !info.category.include?('ALL') and !mobile then
91
+ if !info.category.include?('ALL') then
99
92
  all_category = Category::Info.new(@cgi, @years, @conf, category: ['ALL'])
100
93
  result << category_navi_anchor(all_category, @conf['category.all_category'])
101
94
  end
@@ -172,7 +165,6 @@ def category_dropdown_list(label = nil, multiple = nil)
172
165
  info = Category::Info.new(@cgi, @years, @conf)
173
166
  category = info.category
174
167
  if category.empty?
175
- return '' if @cgi.mobile_agent?
176
168
  category = ['ALL']
177
169
  end
178
170
 
@@ -7,7 +7,7 @@
7
7
  # You can redistribute it and/or modify it under GPL2 or any later version.
8
8
  #
9
9
 
10
- if !@cgi.mobile_agent? && /\A(?:form|preview|append|edit|update)\z/ =~ @mode
10
+ if /\A(?:form|preview|append|edit|update)\z/ =~ @mode
11
11
  add_header_proc do
12
12
  %Q|<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css"/>|
13
13
  end
@@ -7,7 +7,7 @@
7
7
  # You can redistribute it and/or modify it under GPL2 or any later version.
8
8
  #
9
9
 
10
- if !@cgi.mobile_agent? && /\A(?:day)\z/ =~ @mode
10
+ if /\A(?:day)\z/ =~ @mode
11
11
  add_header_proc do
12
12
  %Q|<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css"/>|
13
13
  end
@@ -15,7 +15,6 @@ if !@cgi.mobile_agent? && /\A(?:day)\z/ =~ @mode
15
15
  enable_js('//ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js')
16
16
  enable_js('caretposition.js')
17
17
  enable_js('comment_emoji_autocomplete.js')
18
-
19
18
  end
20
19
 
21
20
  # Local Variables:
@@ -16,15 +16,11 @@ def edit_today_link( date, title )
16
16
  unless /^(day|preview)$/ =~ @mode
17
17
  edit_today_init
18
18
  caption = @conf['edit_today.caption']
19
- unless @cgi.mobile_agent?
20
- <<-HTML
21
- #{title}\n<span class="edit-today">
22
- <a href="#{@update}?edit=true;#{date.strftime( 'year=%Y;month=%m;day=%d' )}" title="#{edit_today_edit_label( date )}" rel="nofollow">#{caption}</a>
23
- </span>
24
- HTML
25
- else
26
- title
27
- end
19
+ <<-HTML
20
+ #{title}\n<span class="edit-today">
21
+ <a href="#{@update}?edit=true;#{date.strftime( 'year=%Y;month=%m;day=%d' )}" title="#{edit_today_edit_label( date )}" rel="nofollow">#{caption}</a>
22
+ </span>
23
+ HTML
28
24
  else
29
25
  title
30
26
  end
@@ -5,10 +5,10 @@ def pingback_total( total ); "(Total: #{total})"; end
5
5
  def pb_show_conf_html
6
6
  <<-"HTML"
7
7
  <h3 class="subtitle">Pingback anchor</h3>
8
- #{"<p>Pingback anchor is inserted into begining of each Pingbacks from other weblogs. So You can specify '&lt;span class=\"tanchor\"&gt;_&lt;/span&gt;\">', image anchor will be shown Image anchor by themes.</p>" unless @cgi.mobile_agent?}
8
+ <p>Pingback anchor is inserted into begining of each Pingbacks from other weblogs. So You can specify '&lt;span class="tanchor"&gt;_&lt;/span&gt;">', image anchor will be shown Image anchor by themes.</p>
9
9
  <p><input name="trackback_anchor" value="#{ h(@conf['trackback_anchor'] || @conf.comment_anchor ) }" size="40"></p>
10
10
  <h3 class="subtitle">Number of Pingbacks</h3>
11
- #{"<p>In Latest or Month mode, you can specify number of visible Pingbacks. So in Dayly mode, all of Pingbacks are shown.</p>" unless @cgi.mobile_agent?}
11
+ <p>In Latest or Month mode, you can specify number of visible Pingbacks. So in Dayly mode, all of Pingbacks are shown.</p>
12
12
  <p><input name="trackback_limit" value="#{ h( @conf['trackback_limit'] || @conf.comment_limit )}" size="3"> Pingbacks</p>
13
13
  HTML
14
14
  end
@@ -4,10 +4,10 @@
4
4
  def tb_show_conf_html
5
5
  <<-"HTML"
6
6
  <h3 class="subtitle">TrackBack anchor</h3>
7
- #{"<p>TrackBack anchor is inserted into begining of each TrackBacks from other weblogs. So You can specify '&lt;span class=\"tanchor\"&gt;_&lt;/span&gt;\">', image anchor will be shown Image anchor by themes.</p>" unless @cgi.mobile_agent?}
7
+ <p>TrackBack anchor is inserted into begining of each TrackBacks from other weblogs. So You can specify '&lt;span class="tanchor"&gt;_&lt;/span&gt;">', image anchor will be shown Image anchor by themes.</p>
8
8
  <p><input name="trackback_anchor" value="#{ h(@conf['trackback_anchor'] || @conf.comment_anchor ) }" size="40"></p>
9
9
  <h3 class="subtitle">TrackBack display style</h3>
10
- #{"<p>In Latest or Month mode, you can specify style of trackbacks displayed.</p>" unless @cgi.mobile_agent?}
10
+ <p>In Latest or Month mode, you can specify style of trackbacks displayed.</p>
11
11
  <p><select name="trackback_shortview_mode">
12
12
  #{ [["num_in_reflist", "Show number of TrackBacks in referer list (always)"],
13
13
  ["num_in_reflist_if_exists", "Show number of TrackBacks in referer list (if exists)"],
@@ -17,10 +17,10 @@ def tb_show_conf_html
17
17
  }.to_s }
18
18
  </select></p>
19
19
  <h3 class="subtitle">Number of TrackBacks</h3>
20
- #{"<p>In Latest or Month mode, you can specify number of visible TrackBacks. So in Dayly mode, all of TrackBacks are shown.</p>" unless @cgi.mobile_agent?}
20
+ <p>In Latest or Month mode, you can specify number of visible TrackBacks. So in Dayly mode, all of TrackBacks are shown.</p>
21
21
  <p><input name="trackback_limit" value="#{ h( @conf['trackback_limit'] || @conf.comment_limit )}" size="3"> TrackBacks</p>
22
22
  <h3 class="subtitle">Show TrackBack URL</h3>
23
- #{"<p>In Latest or Month mode, you can specify TrackBack URL will be shown or not in each days.</p>" unless @cgi.mobile_agent?}
23
+ <p>In Latest or Month mode, you can specify TrackBack URL will be shown or not in each days.</p>
24
24
  <p><select name="trackback_disp_pingurl">
25
25
  <option value="true" #{'selected' if @conf['trackback_disp_pingurl']}>Show</options>
26
26
  <option value="false" #{'selected' if !@conf['trackback_disp_pingurl']}>Hide</options>
@@ -8,7 +8,7 @@
8
8
  # Distributed under GPL2 or any later version.
9
9
  #
10
10
  add_header_proc do
11
- if @mode == 'day' and not @cgi.mobile_agent? then
11
+ if @mode == 'day'
12
12
  <<-STYLE
13
13
  <style type="text/css"><!--
14
14
  form.comment div.mail { display: none; }
@@ -20,7 +20,7 @@ add_header_proc do
20
20
  end
21
21
 
22
22
  add_footer_proc do
23
- if @mode == 'day' and not @cgi.mobile_agent? then
23
+ if @mode == 'day'
24
24
  <<-SCRIPT
25
25
  <script type="text/javascript"><!--
26
26
  document.getElementsByName("mail")[0].value = "";
data/misc/plugin/image.rb CHANGED
@@ -73,9 +73,7 @@ def image( id, alt = 'image', thumbnail = nil, size = nil, place = 'photo' )
73
73
  image = image_list( @image_date )[id.to_i]
74
74
  image_t = image_list( @image_date )[thumbnail.to_i] if thumbnail
75
75
  end
76
- if @cgi.smartphone? then
77
- size = ''
78
- elsif size
76
+ if size
79
77
  if size.kind_of?(Array)
80
78
  if size.length > 1
81
79
  size = %Q| width="#{h size[0]}" height="#{h size[1]}"|
@@ -7,10 +7,10 @@ def pingback_total( total ); "(全#{total}件)"; end
7
7
  def pb_show_conf_html
8
8
  <<-"HTML"
9
9
  <h3 class="subtitle">Pingback アンカー</h3>
10
- #{"<p>他のweblogからのPingbackの先頭に挿入される、リンク用のアンカー文字列を指定します。なお「&lt;span class=\"tanchor\"&gt;_&lt;/span&gt;」を指定すると、テーマによっては自動的に画像アンカーがつくようになります。</p>" unless @cgi.mobile_agent?}
10
+ <p>他のweblogからのPingbackの先頭に挿入される、リンク用のアンカー文字列を指定します。なお「&lt;span class="tanchor"&gt;_&lt;/span&gt;」を指定すると、テーマによっては自動的に画像アンカーがつくようになります。</p>
11
11
  <p><input name="pingback_anchor" value="#{ h(@conf['pingback_anchor'] || @conf.comment_anchor ) }" size="40"></p>
12
12
  <h3 class="subtitle">Pingback リスト表示数</h3>
13
- #{"<p>最新もしくは月別表示時に表示する、Pingbackの最大件数を指定します。なお、日別表示時にはここの指定にかかわらず最大100件のPingbackが表示されます。</p>" unless @cgi.mobile_agent?}
13
+ <p>最新もしくは月別表示時に表示する、Pingbackの最大件数を指定します。なお、日別表示時にはここの指定にかかわらず最大100件のPingbackが表示されます。</p>
14
14
  <p>最大<input name="pingback_limit" value="#{ h(@conf['pingback_limit'] || @conf.comment_limit ) }" size="3">件</p>
15
15
  HTML
16
16
  end
@@ -5,10 +5,10 @@
5
5
  def tb_show_conf_html
6
6
  <<-"HTML"
7
7
  <h3 class="subtitle">TrackBack アンカー</h3>
8
- #{"<p>他のweblogからのTrackBackの先頭に挿入される、リンク用のアンカー文字列を指定します。なお「&lt;span class=\"tanchor\"&gt;_&lt;/span&gt;」を指定すると、テーマによっては自動的に画像アンカーがつくようになります。</p>" unless @cgi.mobile_agent?}
8
+ <p>他のweblogからのTrackBackの先頭に挿入される、リンク用のアンカー文字列を指定します。なお「&lt;span class="tanchor"&gt;_&lt;/span&gt;」を指定すると、テーマによっては自動的に画像アンカーがつくようになります。</p>
9
9
  <p><input name="trackback_anchor" value="#{ h(@conf['trackback_anchor'] || @conf.comment_anchor ) }" size="40"></p>
10
10
  <h3 class="subtitle">TrackBack 表示方法</h3>
11
- #{"<p>最新もしくは月別時の表示方法を指定します。</p>" unless @cgi.mobile_agent?}
11
+ <p>最新もしくは月別時の表示方法を指定します。</p>
12
12
  <p><select name="trackback_shortview_mode">
13
13
  #{ [["num_in_reflist", "リンク元一欄に数を表示(常に)"],
14
14
  ["num_in_reflist_if_exists",
@@ -19,10 +19,10 @@ def tb_show_conf_html
19
19
  }.to_s }
20
20
  </select></p>
21
21
  <h3 class="subtitle">TrackBack リスト表示数</h3>
22
- #{"<p>最新もしくは月別表示時に表示する、TrackBackの最大件数を指定します。なお、日別表示時にはここの指定にかかわらず最大100件のTrackBackが表示されます。</p>" unless @cgi.mobile_agent?}
22
+ <p>最新もしくは月別表示時に表示する、TrackBackの最大件数を指定します。なお、日別表示時にはここの指定にかかわらず最大100件のTrackBackが表示されます。</p>
23
23
  <p>最大<input name="trackback_limit" value="#{ h( @conf['trackback_limit'] || @conf.comment_limit )}" size="3">件</p>
24
24
  <h3 class="subtitle">TrackBack URL の表示設定</h3>
25
- #{"<p>最新もしくは月別表示時に TrackBackURL を表示するかどうかを指定します。</p>" unless @cgi.mobile_agent?}
25
+ <p>最新もしくは月別表示時に TrackBackURL を表示するかどうかを指定します。</p>
26
26
  <p><select name="trackback_disp_pingurl">
27
27
  <option value="true" #{'selected' if @conf['trackback_disp_pingurl']}>表示</options>
28
28
  <option value="false" #{'selected' if !@conf['trackback_disp_pingurl']}>非表示</options>
data/misc/plugin/my-ex.rb CHANGED
@@ -12,8 +12,6 @@
12
12
  # Copyright (c) 2002 TADA Tadashi <sho@spc.gr.jp>
13
13
  # Distributed under the GPL2 or any later version.
14
14
 
15
- unless @cgi.mobile_agent?
16
-
17
15
  def my( a, str, title = nil )
18
16
  date, frag = a.scan( /(\d{4}|\d{6}|\d{8}|\d{8}-\d+)[^\d]*(?:#?([pct]\d+))?$/ )[0]
19
17
  anc = frag ? "#{date}#{frag}" : date
@@ -58,8 +56,6 @@ def my( a, str, title = nil )
58
56
  end
59
57
  end
60
58
 
61
- end
62
-
63
59
  # Local Variables:
64
60
  # mode: ruby
65
61
  # indent-tabs-mode: t
@@ -101,15 +101,15 @@ _END
101
101
  end
102
102
 
103
103
  # returns an HTML sniplet for configuration interface
104
- def html(restore_default_label, mobile = false)
104
+ def html(restore_default_label)
105
105
  return @default_hash.keys.sort_by{|k| @default_hash[k][:index]}.map{|k|
106
- idattr = mobile ? '' : %Q| id="#{h k.to_s}"|
107
- idattr_reset = mobile ? '' : %Q| id="#{h k.to_s}.reset"|
108
- uncheck = mobile ? '' : ' onfocus="uncheck(this)"'
109
- restore = mobile ? '' : ' onchange="restore(this)" onclick="restore(this)"'
106
+ idattr = %Q| id="#{h k.to_s}"|
107
+ idattr_reset = %Q| id="#{h k.to_s}.reset"|
108
+ uncheck = ' onfocus="uncheck(this)"'
109
+ restore = ' onchange="restore(this)" onclick="restore(this)"'
110
110
  r = %Q|\t<h3 class="subtitle">#{h @default_hash[k][:title]}</h3>\n|
111
111
  description = @default_hash[k][:description]
112
- r += %Q|\t<p>#{h description}</p>\n| if description and not mobile
112
+ r += %Q|\t<p>#{h description}</p>\n| if description
113
113
  unless @default_hash[k][:textarea]
114
114
  r += %Q|\t<p><input name="#{h k.to_s}"#{idattr} type="text" value="#{h(Conf.to_native(self[k]))}"#{uncheck}>|
115
115
  else
@@ -443,7 +443,7 @@ _END
443
443
  #{@my_sequel_conf.handler_block}
444
444
  <h3>#{@my_sequel_plugin_name}</h3>
445
445
  #{@my_sequel_description}
446
- #{@my_sequel_conf.html(@my_sequel_restore_default_label, @cgi.mobile_agent?).chomp}
446
+ #{@my_sequel_conf.html(@my_sequel_restore_default_label).chomp}
447
447
  _HTML
448
448
  end
449
449
 
@@ -453,7 +453,7 @@ _HTML
453
453
  # activate this plugin if header procs are called
454
454
  # - This avoids being called from makerss.rb
455
455
  add_header_proc do
456
- if not bot? and not @cgi.mobile_agent? then
456
+ unless bot?
457
457
  @my_sequel_active = true
458
458
  @my_sequel.restore(@diaries.keys)
459
459
  MySequel.css(@my_sequel_conf[:inner_css])
@@ -497,7 +497,7 @@ _HTML
497
497
  # show sequels when leaving a section
498
498
  add_section_leave_proc do
499
499
  r = ''
500
- if @my_sequel_active and @my_sequel_date and @my_sequel_anchor and not bot? and not @cgi.mobile_agent? then
500
+ if @my_sequel_active and @my_sequel_date and @my_sequel_anchor and not bot? then
501
501
  r = @my_sequel.html(@my_sequel_anchor, @my_sequel_conf[:date_format], @my_sequel_conf[:label]){|src_anchor, anchor_str|
502
502
  my_sequel_orig_my(src_anchor, anchor_str)
503
503
  }
@@ -510,7 +510,7 @@ _HTML
510
510
  add_body_leave_proc do
511
511
  r = ''
512
512
  if @my_sequel_active and @my_sequel_date then
513
- if not bot? and not @cgi.mobile_agent? then
513
+ unless bot?
514
514
  r = @my_sequel.html(@my_sequel_anchor, @my_sequel_conf[:date_format], @my_sequel_conf[:label]){|src_anchor, anchor_str|
515
515
  my_sequel_orig_my(src_anchor, anchor_str)
516
516
  }
@@ -19,9 +19,6 @@
19
19
  #
20
20
  #
21
21
 
22
- # running on only non mobile mode
23
- unless @cgi.mobile_agent? then
24
-
25
22
  #
26
23
  # hide Pingbacks in TSUKKOMI
27
24
  #
@@ -128,9 +125,6 @@ def pingbacks_of_today_long( diary, limit = 100 )
128
125
  r
129
126
  end
130
127
 
131
- # running on only non mobile mode
132
- end # unless mobile_agent?
133
-
134
128
  #
135
129
  # show Pingback ping URL
136
130
  #
data/misc/plugin/ping.rb CHANGED
@@ -40,7 +40,7 @@ def ping( list )
40
40
  next unless u.host
41
41
  threads << Thread.start( u, xml ) do |u, xml|
42
42
  begin
43
- timeout( @conf['ping.timeout'].to_i ) do
43
+ Timeout::timeout( @conf['ping.timeout'].to_i ) do
44
44
  Net::HTTP.start( u.host, u.port ) do |http|
45
45
  http.post( u.path, xml, 'Content-Type' => 'text/xml' )
46
46
  end
@@ -57,7 +57,7 @@ def random_google_init
57
57
  end
58
58
  end
59
59
 
60
- if /(latest|day)/ === @mode and !bot? and !@cgi.mobile_agent?
60
+ if /(latest|day)/ === @mode and !bot?
61
61
  add_body_enter_proc do |date|
62
62
  random_google_init
63
63
 
@@ -108,7 +108,7 @@ add_conf_proc('RandomGoogle', '関連するかもしれないページ検索') d
108
108
 
109
109
  r = <<-HTML
110
110
  <h3 class="subtitle">キーワードの数</h3>
111
- #{"<p>日記本文から抽出するキーワードの数</p>" unless @cgi.mobile_agent?}
111
+ <p>日記本文から抽出するキーワードの数</p>
112
112
  <p><select name="random_google_n">
113
113
  HTML
114
114
 
@@ -119,27 +119,27 @@ add_conf_proc('RandomGoogle', '関連するかもしれないページ検索') d
119
119
  </select></p>
120
120
 
121
121
  <h3 class="subtitle">表示関連</h3>
122
- #{"<p>googleへのリンクを示す文字列とリンクの上にマウスポインタを置いた時にポップアップする文字列を指定します.文字列中の $1 は抽出されたキーワードで置換されます.</p>" unless @cgi.mobile_agent?}
122
+ <p>googleへのリンクを示す文字列とリンクの上にマウスポインタを置いた時にポップアップする文字列を指定します.文字列中の $1 は抽出されたキーワードで置換されます.</p>
123
123
  <p>リンク:<input name="random_google_caption" size="70" value="#{h @conf['random_google.caption']}"></p>
124
124
  <p>ポップアップ:<input name="random_google_popup" size="70" value="#{h @conf['random_google.popup']}"></p>
125
125
 
126
126
  <h3 class="subtitle">追加するキーワード</h3>
127
- #{"<p>追加したいキーワードを指定します.複数指定する場合はキーワードをスペースで区切って指定してください.</p>" unless @cgi.mobile_agent?}
128
- #{"<p>例)</p><pre>-site:example.com</pre>" unless @cgi.mobile_agent?}
127
+ <p>追加したいキーワードを指定します.複数指定する場合はキーワードをスペースで区切って指定してください.</p>
128
+ <p>例)</p><pre>-site:example.com</pre>
129
129
  <p><input name="random_google_append" size="70" value="#{h @conf['random_google.append']}"></p>
130
130
 
131
131
  <h3 class="subtitle">除外するキーワード</h3>
132
- #{"<p>除外したいキーワードを指定します.複数指定する場合はキーワードをスペースで区切って指定してください.</p>" unless @cgi.mobile_agent?}
133
- #{"<p>例)</p><pre>a the</pre>" unless @cgi.mobile_agent?}
132
+ <p>除外したいキーワードを指定します.複数指定する場合はキーワードをスペースで区切って指定してください.</p>
133
+ <p>例)</p><pre>a the</pre>
134
134
  <p><input name="random_google_exception" size="70" value="#{h @conf['random_google.exception']}"></p>
135
135
  HTML
136
136
 
137
137
  unless @conf.secure
138
138
  r << <<-HTML
139
139
  <h3 class="subtitle">形態素解析器の利用</h3>
140
- #{"<p>キーワードの抽出に形態素解析器を利用するかどうかを指定します.形態素解析器を使用しない場合は/([亜-瑤]{2,}|[ァ-ヶー]{2,}|[0-9A-Za-z]{2,})/という正規表現でキーワードを抽出しますが,あまり精度はよくありません.</p>" unless @cgi.mobile_agent?}
141
- #{"<p>ChasenやMeCabが標準パスにインストールされていない場合は「場所を指定する」を選択し,下の「形態素解析器のパス」で形態素解析器を絶対パスで指定して下さい.</p>" unless @cgi.mobile_agent?}
142
- #{"<p>ChasenやMeCab以外の形態素解析器を利用したい場合も同様に「場所を指定する」を選択し,下の「形態素解析器のパス」で形態素解析器を絶対パスで指定して下さい.最初のカラムに形態素が出力され,かつ同じ行にその形態素の品詞(「名詞」等)が出力されるような形態素解析器であれば利用可能です.</p>" unless @cgi.mobile_agent?}
140
+ <p>キーワードの抽出に形態素解析器を利用するかどうかを指定します.形態素解析器を使用しない場合は/([亜-瑤]{2,}|[ァ-ヶー]{2,}|[0-9A-Za-z]{2,})/という正規表現でキーワードを抽出しますが,あまり精度はよくありません.</p>
141
+ <p>ChasenやMeCabが標準パスにインストールされていない場合は「場所を指定する」を選択し,下の「形態素解析器のパス」で形態素解析器を絶対パスで指定して下さい.</p>
142
+ <p>ChasenやMeCab以外の形態素解析器を利用したい場合も同様に「場所を指定する」を選択し,下の「形態素解析器のパス」で形態素解析器を絶対パスで指定して下さい.最初のカラムに形態素が出力され,かつ同じ行にその形態素の品詞(「名詞」等)が出力されるような形態素解析器であれば利用可能です.</p>
143
143
  <p><select name="random_google_analyzer">
144
144
  <option value="chasen"#{@conf['random_google.analyzer'] == "chasen" ? " selected" : ""}>ChaSenを利用する</option>
145
145
  <option value="mecab"#{@conf['random_google.analyzer'] == "mecab" ? " selected" : ""}>MeCabを利用する</option>
@@ -148,8 +148,8 @@ add_conf_proc('RandomGoogle', '関連するかもしれないページ検索') d
148
148
  </select></p>
149
149
 
150
150
  <h3 class="subtitle">形態素解析器のパス</h3>
151
- #{"<p>利用する形態素解析器を絶対パスで指定します.</p>" unless @cgi.mobile_agent?}
152
- #{"<p>例)</p><pre>/usr/local/bin/chasen</pre>" unless @cgi.mobile_agent?}
151
+ <p>利用する形態素解析器を絶対パスで指定します.</p>
152
+ <p>例)</p><pre>/usr/local/bin/chasen</pre>
153
153
  <p><input name="random_google_analyzer_path" size="70" value="#{h @conf['random_google.analyzer_path']}"></p>
154
154
  HTML
155
155
  end
@@ -76,6 +76,7 @@ class InvalidResourceError < StandardError; end
76
76
  class RSSNotModified < StandardError; end
77
77
 
78
78
  require 'time'
79
+ require 'timeout'
79
80
  require 'net/http'
80
81
  require 'uri/generic'
81
82
  require 'rss/parser'
@@ -150,7 +151,7 @@ def recent_rss_fetch_rss(uri, cache_time)
150
151
  px_host, px_port = (@conf['proxy'] || '').split( /:/ )
151
152
  px_port = 80 if px_host and !px_port
152
153
  begin
153
- timeout( 10 ) do
154
+ Timeout::timeout( 10 ) do
154
155
  res = Net::HTTP::Proxy( px_host, px_port ).get_response( uri )
155
156
  case res
156
157
  when Net::HTTPSuccess
@@ -164,7 +165,7 @@ def recent_rss_fetch_rss(uri, cache_time)
164
165
  raise InvalidResourceError
165
166
  end
166
167
  end
167
- rescue TimeoutError, SocketError, StandardError
168
+ rescue Timeout::Error, SocketError, StandardError
168
169
  raise InvalidResourceError
169
170
  end
170
171
  rss
@@ -20,7 +20,7 @@
20
20
  =end
21
21
 
22
22
  add_body_leave_proc do |date|
23
- if /latest|month/ =~ @mode and not @cgi.mobile_agent? then
23
+ if /latest|month/ =~ @mode
24
24
  @conf['speed_comment.name_size'] = 20 unless @conf['speed_comment.name_size']
25
25
  @conf['speed_comment.body_size'] = 40 unless @conf['speed_comment.body_size']
26
26
  r = ""
@@ -27,9 +27,6 @@
27
27
  # end
28
28
  #
29
29
 
30
- # running on only non mobile mode
31
- unless @cgi.mobile_agent? then
32
-
33
30
  #
34
31
  # show TrackBack ping URL
35
32
  #
@@ -180,9 +177,6 @@ def trackbacks_of_today_long( diary, limit = -1 )
180
177
  r
181
178
  end
182
179
 
183
- # running on only non mobile mode
184
- end # unless mobile_agent?
185
-
186
180
  # configurations
187
181
  @conf['trackback_anchor'] ||= @conf.comment_anchor
188
182
  @conf['trackback_limit'] ||= @conf.comment_limit