tdiary-contrib 4.1.1 → 4.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cb4987d60e60c9a3130d9883de1ad14d41105c87
4
- data.tar.gz: 0cc0f6d11ef5e64a16ad5c77273439f5a8eefa3a
3
+ metadata.gz: 7410e628979a4cbc25c8a0aa882935065c5364f2
4
+ data.tar.gz: 6f9b381d1c3c7d7d108ee5b6b5e0ba604d2f4962
5
5
  SHA512:
6
- metadata.gz: 1dec6581b5097a1c9a4d1bcea6bab76387ba319fb2628b657eae092b27bca6c257d9847cb030e35a2e46222605d648de4503eea259310c5ecf0910b0b864e133
7
- data.tar.gz: 7739d7edcc96fb474a81e25008482f568c55ab8e1daf59c3091226e4b76ab7e5022cc875b6370fe9965e9e26ffbe78c9ec81265e6f89f8628ba0534fb61b4160
6
+ metadata.gz: d270a15ecf5b5409a0e706bc800dbd08ff8919f8f8032e4b38d96d3a92ea0009475b23fcc2c68f2ba529b2aae3cd9c94503247f72f07269e756d1511993a8244
7
+ data.tar.gz: 1c981dc013b58bdf3dd221541435c72caa2644f758bff3b83f8e82b2303a2f3625cab4ec14f12b90509e2abecb960266bbca0fd572e0a2e435c1a0156bb466e8
data/Gemfile CHANGED
@@ -3,5 +3,10 @@ source 'https://rubygems.org'
3
3
  gem 'tdiary', '~> 4.1.0'
4
4
 
5
5
  gem 'rake'
6
- gem 'rspec'
7
- gem 'simplecov'
6
+
7
+ group :test do
8
+ gem 'rspec'
9
+ gem 'simplecov'
10
+ gem 'webmock'
11
+ gem 'pry'
12
+ end
data/Gemfile.lock CHANGED
@@ -1,37 +1,54 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
+ addressable (2.3.7)
5
+ coderay (1.1.0)
6
+ crack (0.4.2)
7
+ safe_yaml (~> 1.0.0)
4
8
  diff-lcs (1.2.5)
5
9
  docile (1.1.5)
10
+ method_source (0.8.2)
6
11
  multi_json (1.10.1)
12
+ pry (0.10.1)
13
+ coderay (~> 1.1.0)
14
+ method_source (~> 0.8.1)
15
+ slop (~> 3.4)
7
16
  rake (10.4.2)
8
- rspec (3.1.0)
9
- rspec-core (~> 3.1.0)
10
- rspec-expectations (~> 3.1.0)
11
- rspec-mocks (~> 3.1.0)
12
- rspec-core (3.1.7)
13
- rspec-support (~> 3.1.0)
14
- rspec-expectations (3.1.2)
17
+ rspec (3.2.0)
18
+ rspec-core (~> 3.2.0)
19
+ rspec-expectations (~> 3.2.0)
20
+ rspec-mocks (~> 3.2.0)
21
+ rspec-core (3.2.0)
22
+ rspec-support (~> 3.2.0)
23
+ rspec-expectations (3.2.0)
15
24
  diff-lcs (>= 1.2.0, < 2.0)
16
- rspec-support (~> 3.1.0)
17
- rspec-mocks (3.1.3)
18
- rspec-support (~> 3.1.0)
19
- rspec-support (3.1.2)
25
+ rspec-support (~> 3.2.0)
26
+ rspec-mocks (3.2.0)
27
+ diff-lcs (>= 1.2.0, < 2.0)
28
+ rspec-support (~> 3.2.0)
29
+ rspec-support (3.2.1)
30
+ safe_yaml (1.0.4)
20
31
  simplecov (0.9.1)
21
32
  docile (~> 1.1.0)
22
33
  multi_json (~> 1.0)
23
34
  simplecov-html (~> 0.8.0)
24
35
  simplecov-html (0.8.0)
25
- tdiary (4.1.0.20141126)
36
+ slop (3.6.0)
37
+ tdiary (4.1.1)
26
38
  bundler (~> 1.3)
27
39
  thor (~> 0.18)
28
40
  thor (0.19.1)
41
+ webmock (1.20.4)
42
+ addressable (>= 2.3.6)
43
+ crack (>= 0.3.2)
29
44
 
30
45
  PLATFORMS
31
46
  ruby
32
47
 
33
48
  DEPENDENCIES
49
+ pry
34
50
  rake
35
51
  rspec
36
52
  simplecov
37
53
  tdiary (~> 4.1.0)
54
+ webmock
data/js/picasa.js CHANGED
@@ -80,7 +80,7 @@ $(function () {
80
80
  var timerId = this.setErrorHandler();
81
81
  var self = this;
82
82
  $.ajax({
83
- url: 'http://picasaweb.google.com/data/feed/api/user/' + this.userId,
83
+ url: '//picasaweb.google.com/data/feed/api/user/' + this.userId,
84
84
  data: 'alt=json-in-script&max-results=25&thumbsize=128c&start-index=' + this.album_start_index,
85
85
  dataType: 'jsonp',
86
86
  success: function (data) {
@@ -99,7 +99,7 @@ $(function () {
99
99
  getPhotos: function (albumId, fn) {
100
100
  var timerId = this.setErrorHandler();
101
101
  $.ajax({
102
- url: 'http://picasaweb.google.com/data/feed/api/user/' + this.userId + '/albumid/' + albumId,
102
+ url: '//picasaweb.google.com/data/feed/api/user/' + this.userId + '/albumid/' + albumId,
103
103
  data: 'alt=json-in-script&imgmax=' + this.imgMax + '&thumbsize=200',
104
104
  dataType: 'jsonp',
105
105
  success: function (data) {
@@ -113,7 +113,7 @@ $(function () {
113
113
  var timerId = this.setErrorHandler();
114
114
  var self = this;
115
115
  $.ajax({
116
- url: 'http://picasaweb.google.com/data/feed/api/user/' + this.userId,
116
+ url: '//picasaweb.google.com/data/feed/api/user/' + this.userId,
117
117
  data: 'alt=json-in-script&imgmax=' + this.imgMax + '&thumbsize=200&kind=photo&max-results=25&start-index=' + this.recently_uploaded_photo_start_index,
118
118
  dataType: 'jsonp',
119
119
  success: function (data) {
@@ -1,5 +1,5 @@
1
1
  module TDiary
2
2
  class Contrib
3
- VERSION = "4.1.1"
3
+ VERSION = "4.1.2"
4
4
  end
5
5
  end
data/plugin/datepicker.rb CHANGED
@@ -12,9 +12,9 @@
12
12
  return if feed? || @conf.mobile_agent?
13
13
 
14
14
  if /\A(?:form|preview|append|edit|update)\z/ =~ @mode
15
- enable_js('http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js')
15
+ enable_js('//ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js')
16
16
  if @conf.lang == 'ja'
17
- enable_js('http://ajax.googleapis.com/ajax/libs/jqueryui/1/i18n/jquery.ui.datepicker-ja.min.js')
17
+ enable_js('//ajax.googleapis.com/ajax/libs/jqueryui/1/i18n/jquery.ui.datepicker-ja.min.js')
18
18
  end
19
19
  enable_js('datepicker.js')
20
20
  end
data/plugin/flickr.rb CHANGED
@@ -38,17 +38,17 @@ def flickr(photo_id, size = nil, place = 'flickr')
38
38
  return '[ERROR] flickr.rb: API Key is not specified.'
39
39
  end
40
40
  size ||= @conf['flickr.default_size']
41
- size = 'small' if @conf.iphone?
41
+ size = 'small' if @conf.smartphone?
42
42
  photo = flickr_photo_info(photo_id.to_s, size)
43
43
  unless photo
44
44
  return '[ERROR] flickr.rb: failed to get photo.'
45
45
  end
46
46
 
47
- if @cgi.mobile_agent?
47
+ if @conf.mobile_agent?
48
48
  body = %Q|<a href="#{photo[:src]}" class="flickr">#{photo[:title]}</a>|
49
49
  else
50
50
  body = %Q|<a href="#{photo[:page]}" class="flickr"><img title="#{photo[:title]}" alt="#{photo[:title]}" src="#{photo[:src]}" class="#{place}"|
51
- unless @conf.iphone?
51
+ unless @conf.smartphone?
52
52
  body << %Q| width="#{photo[:width]}"| if photo[:width]
53
53
  body << %Q| height="#{photo[:height]}"| if photo[:height]
54
54
  end
data/plugin/google_map.rb CHANGED
@@ -7,7 +7,6 @@
7
7
  # You can redistribute it and/or modify it under GPL2.
8
8
  #
9
9
 
10
-
11
10
  def google_map(lat, lon, params = {})
12
11
  params.merge!(:lat => lat, :lon => lon)
13
12
  google_map_common(params)
@@ -19,48 +18,53 @@ def google_geomap(address, params = {})
19
18
  end
20
19
 
21
20
  def google_map_common(params)
22
- init_gmap_data
23
- if feed?
24
- require 'cgi'
25
- query = params[:lat] && params[:lon] ? "#{params[:lat]},#{params[:lon]}" : params[:address]
26
- url = %Q|http://maps.google.com/maps?q=#{CGI::escape(query)}|
27
- return %Q|<a href="#{url}">#{url}</a>|
28
- end
29
- return 'not support this environment.' if @conf.mobile_agent?
30
-
21
+ params[:id] ||= ''
22
+ params[:lat] ||= 0.0
23
+ params[:lon] ||= 0.0
24
+ params[:address] ||= nil
31
25
  params[:zoom] ||= 10
32
26
  params[:html] ||= nil
33
27
  params[:title] ||= nil
34
28
  params[:width] ||= 320
35
29
  params[:height] ||= 240
36
- params[:address] ||= nil
37
30
  params[:type] ||= :ROADMAP
38
31
  params[:overview]||= false
39
32
 
40
- dom_id = "#{@date.strftime("%Y%m")}_#{@gmap_count}"
33
+ if feed?
34
+ require 'cgi'
35
+ query = params[:lat] && params[:lon] ? "#{params[:lat]},#{params[:lon]}" : params[:address]
36
+ url = %Q|http://maps.google.com/maps?q=#{CGI::escape(query)}|
37
+ return %Q|<a href="#{url}">#{url}</a>|
38
+ end
39
+ return 'not support this environment.' if @conf.mobile_agent?
40
+
41
+ dom_id = "#{@gmap_date.strftime("%Y%m%d")}_#{@gmap_count}"
41
42
  params.merge!(:id => dom_id)
42
43
  params.merge!(:width => 240, :height => 180) if @conf.iphone?
43
44
  @gmap_data << params
44
45
  @gmap_count += 1
46
+
45
47
  %Q|<div class="gmap" id="#{dom_id}" style="width : #{params[:width]}px; height : #{params[:height]}px;"></div>|
46
48
  end
47
49
 
48
-
49
50
  add_header_proc do
50
51
  if /\A(?:latest|day|month|nyear|preview)\z/ =~ @mode
51
52
  %Q|<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=#{!@conf.smartphone?.nil?}"></script>\n|
52
53
  end
53
54
  end
54
55
 
55
-
56
+ add_body_enter_proc do |date|
57
+ @gmap_data = []
58
+ @gmap_date = date
59
+ @gmap_count = 0
60
+ ''
61
+ end
56
62
 
57
63
  add_body_leave_proc do |date|
58
- init_gmap_data
59
64
  gmap_scripts = ''
60
65
  if !feed? && @gmap_data.any?
61
66
  gmap_scripts = %Q|<script type="text/javascript">\n<!--\n|
62
- while @gmap_data.any?
63
- data = @gmap_data.shift
67
+ @gmap_data.each do |data|
64
68
  if data[:address]
65
69
  gmap_scripts << google_geomap_script(data)
66
70
  else
@@ -72,42 +76,39 @@ add_body_leave_proc do |date|
72
76
  gmap_scripts
73
77
  end
74
78
 
75
- def init_gmap_data
76
- @gmap_data ||= []
77
- @gmap_count ||= 0
78
- end
79
-
80
79
  def google_map_script(hash)
81
80
  str = ''
82
81
  str << %Q|google.maps.event.addDomListener(window, 'load', function() {\n|
83
- str << %Q| var mapdiv = document.getElementById("#{hash[:id]}");\n|
84
- str << %Q| var myOptions = {\n|
85
- str << %Q| zoom: #{hash[:zoom]},\n|
86
- str << %Q| overviewMapControl: #{hash[:overview]},\n|
87
- str << %Q| overviewMapControlOptions: {\n|
82
+ str << %Q| var mapdiv = document.getElementById("#{hash[:id]}");\n|
83
+ str << %Q| if(mapdiv){\n|
84
+ str << %Q| var myOptions = {\n|
85
+ str << %Q| zoom: #{hash[:zoom]},\n|
86
+ str << %Q| overviewMapControl: #{hash[:overview]},\n|
87
+ str << %Q| overviewMapControlOptions: {\n|
88
88
  str << %Q| opened: #{hash[:overview]}\n|
89
- str << %Q| },\n|
90
- str << %Q| center: new google.maps.LatLng(#{hash[:lat]}, #{hash[:lon]}),\n|
91
- str << %Q| mapTypeId: google.maps.MapTypeId.#{hash[:type]},\n|
92
- str << %Q| scaleControl: true\n|
89
+ str << %Q| },\n|
90
+ str << %Q| center: new google.maps.LatLng(#{hash[:lat]}, #{hash[:lon]}),\n|
91
+ str << %Q| mapTypeId: google.maps.MapTypeId.#{hash[:type]},\n|
92
+ str << %Q| scaleControl: true\n|
93
93
  str << %Q| };\n|
94
- str << %Q| var gMap = new google.maps.Map(mapdiv, myOptions);\n|
94
+ str << %Q| var gMap = new google.maps.Map(mapdiv, myOptions);\n|
95
95
  # set Marker
96
96
  if hash[:title]
97
- str << %Q| var marker = new google.maps.Marker({\n|
98
- str << %Q| position: new google.maps.LatLng(#{hash[:lat]}, #{hash[:lon]}),\n|
99
- str << %Q| map: gMap,\n|
100
- str << %Q| title: '#{hash[:title]}'\n|
101
- str << %Q| });\n|
97
+ str << %Q| var marker = new google.maps.Marker({\n|
98
+ str << %Q| position: new google.maps.LatLng(#{hash[:lat]}, #{hash[:lon]}),\n|
99
+ str << %Q| map: gMap,\n|
100
+ str << %Q| title: '#{hash[:title]}'\n|
101
+ str << %Q| });\n|
102
102
  # set InfoWindow
103
103
  if hash[:html]
104
- str << %Q| var infowindow = new google.maps.InfoWindow({\n|
105
- str << %Q| content: '<span style="color: #000000;">#{hash[:html]}</span>',\n|
106
- str << %Q| size: new google.maps.Size(350, 200)\n|
107
- str << %Q| });\n|
108
- str << %Q| infowindow.open(gMap, marker);\n|
104
+ str << %Q| var infowindow = new google.maps.InfoWindow({\n|
105
+ str << %Q| content: '<span style="color: #000000;">#{hash[:html]}</span>',\n|
106
+ str << %Q| size: new google.maps.Size(350, 200)\n|
107
+ str << %Q| });\n|
108
+ str << %Q| infowindow.open(gMap, marker);\n|
109
109
  end # :html
110
110
  end # :title
111
+ str << %Q| };\n|
111
112
  str << %Q|});\n|
112
113
 
113
114
  str
@@ -116,44 +117,46 @@ end
116
117
  def google_geomap_script(hash)
117
118
  str = ''
118
119
  str << %Q|google.maps.event.addDomListener(window, 'load', function() {\n|
119
- str << %Q| var geocoder = new google.maps.Geocoder();\n|
120
- str << %Q| if(geocoder) {\n|
121
- str << %Q| geocoder.geocode( { 'address': '#{hash[:address]}'}, function(results, status) {\n|
122
- str << %Q| if (status == google.maps.GeocoderStatus.OK) {\n|
123
- str << %Q| var geoLat = results[0].geometry.location;\n|
124
- str << %Q| var mapdiv = document.getElementById("#{hash[:id]}");\n|
125
- str << %Q| var myOptions = {\n|
126
- str << %Q| zoom: #{hash[:zoom]},\n|
127
- str << %Q| overviewMapControl: #{hash[:overview]},\n|
128
- str << %Q| overviewMapControlOptions: {\n|
129
- str << %Q| opened: #{hash[:overview]}\n|
130
- str << %Q| },\n|
131
- str << %Q| center: geoLat,\n|
132
- str << %Q| mapTypeId: google.maps.MapTypeId.#{hash[:type]},\n|
133
- str << %Q| scaleControl: true\n|
134
- str << %Q| };\n|
135
- str << %Q| var gMap = new google.maps.Map(mapdiv, myOptions);\n|
120
+ str << %Q| var mapdiv = document.getElementById("#{hash[:id]}");\n|
121
+ str << %Q| if(mapdiv){\n|
122
+ str << %Q| var geocoder = new google.maps.Geocoder();\n|
123
+ str << %Q| if(geocoder) {\n|
124
+ str << %Q| geocoder.geocode( { 'address': '#{hash[:address]}'}, function(results, status) {\n|
125
+ str << %Q| if (status == google.maps.GeocoderStatus.OK) {\n|
126
+ str << %Q| var geoLat = results[0].geometry.location;\n|
127
+ str << %Q| var myOptions = {\n|
128
+ str << %Q| zoom: #{hash[:zoom]},\n|
129
+ str << %Q| overviewMapControl: #{hash[:overview]},\n|
130
+ str << %Q| overviewMapControlOptions: {\n|
131
+ str << %Q| opened: #{hash[:overview]}\n|
132
+ str << %Q| },\n|
133
+ str << %Q| center: geoLat,\n|
134
+ str << %Q| mapTypeId: google.maps.MapTypeId.#{hash[:type]},\n|
135
+ str << %Q| scaleControl: true\n|
136
+ str << %Q| };\n|
137
+ str << %Q| var gMap = new google.maps.Map(mapdiv, myOptions);\n|
136
138
  # set Marker
137
139
  if hash[:title]
138
- str << %Q| var marker = new google.maps.Marker({\n|
139
- str << %Q| position: geoLat,\n|
140
- str << %Q| map: gMap,\n|
141
- str << %Q| title: '#{hash[:title]}'\n|
142
- str << %Q| });\n|
140
+ str << %Q| var marker = new google.maps.Marker({\n|
141
+ str << %Q| position: geoLat,\n|
142
+ str << %Q| map: gMap,\n|
143
+ str << %Q| title: '#{hash[:title]}'\n|
144
+ str << %Q| });\n|
143
145
  # set InfoWindow
144
146
  if hash[:html]
145
- str << %Q| var infowindow = new google.maps.InfoWindow({\n|
146
- str << %Q| content: '<span style="color: #000000;">#{hash[:html]}</span>',\n|
147
- str << %Q| size: new google.maps.Size(350, 200)\n|
148
- str << %Q| });\n|
149
- str << %Q| infowindow.open(gMap, marker);\n|
147
+ str << %Q| var infowindow = new google.maps.InfoWindow({\n|
148
+ str << %Q| content: '<span style="color: #000000;">#{hash[:html]}</span>',\n|
149
+ str << %Q| size: new google.maps.Size(350, 200)\n|
150
+ str << %Q| });\n|
151
+ str << %Q| infowindow.open(gMap, marker);\n|
150
152
  end # :html
151
153
  end # :title
152
- str << %Q| }else{\n|
153
- str << %Q| alert("Geocode was not successful for the following reason: " + status)\n|
154
+ str << %Q| }else{\n|
155
+ str << %Q| alert("Geocode was not successful for the following reason: " + status)\n|
156
+ str << %Q| }\n|
157
+ str << %Q| });\n|
154
158
  str << %Q| }\n|
155
- str << %Q| });\n|
156
- str << %Q| }\n|
159
+ str << %Q| }\n|
157
160
  str << %Q|});\n|
158
161
 
159
162
  str
@@ -10,7 +10,7 @@
10
10
  }
11
11
 
12
12
  add_header_proc do
13
- hatena_star = %Q|\t<script type="text/javascript" src="http://s.hatena.ne.jp/js/HatenaStar.js"></script>\n|
13
+ hatena_star = %Q|\t<script type="text/javascript" src="//s.hatena.ne.jp/js/HatenaStar.js"></script>\n|
14
14
  hatena_star << %Q|\t<script type="text/javascript"><!--
15
15
  Hatena.Star.SiteConfig = {
16
16
  entryNodes: {
data/plugin/instagr.rb CHANGED
@@ -24,7 +24,7 @@ def instagr( short_url, size = :medium)
24
24
 
25
25
  # img size
26
26
  size = size.to_sym if size != :medium
27
- maxwidth_data = {:small => 150, :medium => 306, :large => 612}
27
+ maxwidth_data = {:medium => 320, :large => 612}
28
28
  maxwidth = maxwidth_data[ size ] ? maxwidth_data[ size ] : maxwidth_data[:medium]
29
29
 
30
30
  # proxy
@@ -44,7 +44,7 @@ def instagr( short_url, size = :medium)
44
44
  return <<-INSTAGR_DOM
45
45
  <div class="instagr">
46
46
  <a class="instagr" href="#{h short_url}" title="#{h @conf.to_native(json_data["title"])}">
47
- <img src="#{h json_data["url"]}" width="#{h width}" height="#{h height}" alt="#{h @conf.to_native(json_data["title"])}">
47
+ <img src="#{h json_data["thumbnail_url"]}" width="#{h width}" height="#{h height}" alt="#{h @conf.to_native(json_data["title"])}">
48
48
  </a>
49
49
  <p>#{h json_data["author_name"]}'s photo.</p>
50
50
  </div>
data/plugin/nicovideo.rb CHANGED
@@ -22,7 +22,6 @@
22
22
  #
23
23
  require 'net/http'
24
24
  require 'timeout'
25
- require 'rexml/document'
26
25
 
27
26
  enable_js( 'nicovideo.js' )
28
27
 
@@ -35,10 +34,14 @@ def nicovideo_call_api( video_id )
35
34
  px_port = 80 if px_host and !px_port
36
35
  Net::HTTP::Proxy( px_host, px_port ).get_response( URI::parse( uri ) ).body
37
36
  }
38
- doc = REXML::Document::new( xml ).root
39
- res = doc.elements.to_a( '/nicovideo_thumb_response' )[0]
40
- if res.attributes['status'] == 'ok' then
41
- res.elements.to_a( 'thumb' )[0]
37
+ status = xml.scan(%r|<nicovideo_thumb_response\s*status="(.*)">|).flatten.first
38
+ if status == 'ok' then
39
+ raw_api = xml.scan(%r|<thumb>(.*)</thumb>|m).flatten.first.scan(%r|<(.*?)>(.*)</.*?>|)
40
+ api = {}
41
+ raw_api.each do |key, value|
42
+ api[key] = @conf.to_native( value )
43
+ end
44
+ api
42
45
  else
43
46
  raise ::Errno::ENOENT::new
44
47
  end
@@ -47,16 +50,16 @@ end
47
50
  def nicovideo_inline( video_id, elem, label = nil, link = nil )
48
51
  i = {}
49
52
  i[:id] = video_id
50
- i[:url] = link || elem.to_a( 'watch_url' )[0].text
51
- i[:thumb] = elem.to_a( 'thumbnail_url' )[0].text
52
- i[:title] = label || elem.to_a( 'title' )[0].text
53
- i[:desc] = elem.to_a( 'description' )[0].text
54
- i[:comment] = @conf.mobile_agent? ? '' : elem.to_a( 'last_res_body' )[0].text
55
- i[:date] = elem.to_a( 'first_retrieve' )[0].text
56
- i[:length] = elem.to_a( 'length' )[0].text
57
- i[:view] = elem.to_a( 'view_counter' )[0].text
58
- i[:comment_num] = elem.to_a( 'comment_num' )[0].text
59
- i[:mylist] = elem.to_a( 'mylist_counter' )[0].text
53
+ i[:url] = link || elem['watch_url']
54
+ i[:thumb] = elem['thumbnail_url']
55
+ i[:title] = label || elem['title']
56
+ i[:desc] = elem['description']
57
+ i[:comment] = @conf.mobile_agent? ? '' : elem['last_res_body']
58
+ i[:date] = elem['first_retrieve']
59
+ i[:length] = elem['length']
60
+ i[:view] = elem['view_counter']
61
+ i[:comment_num] = elem['comment_num']
62
+ i[:mylist] = elem['mylist_counter']
60
63
 
61
64
  if feed? then
62
65
  result = nicovideo_feed( i )
@@ -86,7 +89,7 @@ def nicovideo( video_id, label = nil, link = nil )
86
89
  begin
87
90
  r = ''
88
91
  r << %Q|<div id="thumbnail-#{video_id}">|
89
- api = nicovideo_call_api( video_id ).elements
92
+ api = nicovideo_call_api( video_id )
90
93
  thumb = @conf.to_native( nicovideo_inline( video_id, api, label, link ), 'UTF-8' )
91
94
  thumb.gsub!( /"INLINE_PLAYER"/, %Q|"#" onclick="return nicovideoPlayer( '#{video_id}' );"| )
92
95
  r << thumb
@@ -101,7 +104,7 @@ def nicovideo( video_id, label = nil, link = nil )
101
104
  r << %Q|</a>|
102
105
  r << %Q|<div class="nicovideo-player-close" style="margin:4px;padding:8px;">|
103
106
  r << %Q|<a href="#" onclick="return nicovideoThumbnail( '#{video_id}' )" style="background-color:black; color:white; margin:2px; padding:8px; border-color:white; border-radius:6px; border-width:2px; border-style:solid; text-decoration:none;">▲CLOSE PLAYER</a>|
104
- r << %Q|&nbsp;<a href="#{api.to_a( 'watch_url' )[0].text}" style="background-color:black; color:white; margin:2px; padding:8px; border-color:white; border-radius:6px; border-width:2px; border-style:solid; text-decoration:none;">SHOW ORIGINAL&gt;</a>|
107
+ r << %Q|&nbsp;<a href="#{api['watch_url']}" style="background-color:black; color:white; margin:2px; padding:8px; border-color:white; border-radius:6px; border-width:2px; border-style:solid; text-decoration:none;">SHOW ORIGINAL&gt;</a>|
105
108
  r << %Q|</div>|
106
109
  r << %Q|</div>|
107
110
  end
@@ -109,6 +112,8 @@ def nicovideo( video_id, label = nil, link = nil )
109
112
  rescue ::Errno::ENOENT
110
113
  "<strong>Sorry, #{video_id} was deleted.</strong>"
111
114
  rescue Timeout::Error, NoMethodError, SecurityError, StandardError
115
+ puts $!
116
+ $@.each{|l| puts l}
112
117
  nicovideo_iframe( video_id )
113
118
  end
114
119
  end
data/plugin/picasa.rb CHANGED
@@ -54,3 +54,19 @@ add_edit_proc do |date|
54
54
  HTML
55
55
  end
56
56
  end
57
+
58
+ add_conf_proc( 'picasa', 'Picasa' ) do
59
+ if @mode == 'saveconf'
60
+ @conf['picasa.user'], = @cgi.params['picasa.user']
61
+ @conf['picasa.default_size'] = @cgi.params['picasa.default_size'][0].to_i
62
+ @conf['picasa.default_size'] = 400 if @conf['picasa.default_size'] == 0
63
+ end
64
+
65
+ <<-HTML
66
+ <h3 class="subtitle">Picasa user name</h3>
67
+ <p><input name="picasa.user" value="#{h @conf['picasa.user']}"></p>
68
+
69
+ <h3 class="subtitle">default size</h3>
70
+ <p><input name="picasa.default_size" value="#{h @conf['picasa.default_size']}"></p>
71
+ HTML
72
+ end
data/plugin/rubykaigi.rb CHANGED
@@ -9,6 +9,12 @@
9
9
  # Distributed under GPL.
10
10
  #
11
11
 
12
+ def rubykaigi2014( role = 'attendee', size = nil )
13
+ r = role.split(/[ _]+/).join('-')
14
+ s = "@#{h size}" unless size.nil?
15
+ %Q|<a href="http://rubykaigi.org/2014/" style="display:block;margin:8px auto;text-align:center;"><img src="http://rubykaigi.org/2014/images/badge-for-#{h r}#{s}.png" alt="RubyKaigi 2014 #{h r}"></a>|
16
+ end
17
+
12
18
  def rubykaigi2013( role = 'attendee', size = nil )
13
19
  r = role.split(/[ _]+/).map{|s| s.capitalize}.join
14
20
  s = "@#{h size}" unless size.nil?
@@ -83,7 +89,7 @@ def rubykaigi2008( role = 'attendee' )
83
89
  role = 'attendee'
84
90
  0
85
91
  end
86
- %Q|<div style="text-align: center; margin-top: 0.5em; margin-bottom: 0.5em;"><a href="http://jp.rubyist.net/RubyKaigi2008/"><img src="http://rubykaigi.tdiary.net/images/20080617_#{img}.png" width="160" height="79" alt="RubyKaigi2008#{h role.capitalize}" style="border-width: 0px;"></a></div>|
92
+ %Q|<div style="text-align: center; margin-top: 0.5em; margin-bottom: 0.5em;"><a href="http://jp.rubyist.net/RubyKaigi2008/"><img src="http://userimages.tdiary.net/rubykaigi/20080617_#{img}.png" width="160" height="79" alt="RubyKaigi2008#{h role.capitalize}" style="border-width: 0px;"></a></div>|
87
93
  end
88
94
 
89
95
  def sappororubykaigi02( role = 'attendee' )
@@ -20,7 +20,7 @@ def search_title
20
20
  end
21
21
 
22
22
  add_footer_proc do
23
- %Q|<script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box&lang=ja"></script>|
23
+ %Q|<script type="text/javascript" src="//www.google.com/cse/brand?form=cse-search-box&lang=ja"></script>|
24
24
  end
25
25
 
26
26
  def search_input_form(q='')
@@ -0,0 +1,56 @@
1
+ #
2
+ # select-style.rb: select a style from installed styles
3
+ #
4
+ # add a line below, after load_cgi_conf in tdiary.conf:
5
+ # @style = @options2['style'] if @options2 && @options2['style']
6
+ #
7
+
8
+ def saveconf_style
9
+ if @mode == 'saveconf' then
10
+ @conf['style'] = @cgi.params['style'][0]
11
+ end
12
+ end
13
+
14
+ def enum_styles
15
+ TDiary::Style.constants(false).grep(/Diary$/).delete_if{|s|
16
+ s =~ /Base|Categorizable|Uncategorizable/
17
+ }.map{|s|
18
+ s.to_s.sub(/Diary$/, '').downcase
19
+ }.each{|s|
20
+ yield s
21
+ }
22
+ end
23
+
24
+ add_conf_proc( 'style', 'スタイル', 'update' ) do
25
+ saveconf_style
26
+
27
+ labels = {
28
+ 'tdiary' => 'tDiary',
29
+ 'wiki' => 'Wiki',
30
+ 'gfm' => 'GFM',
31
+ 'etdiary' => 'etDiary',
32
+ 'emptdiary' => 'emptDiary',
33
+ 'rd' => 'RD',
34
+ }
35
+
36
+ r = <<-HTML
37
+ <h3 class="subtitle">スタイルの指定</h3>
38
+ #{"<p>スタイル (日記の文法) を指定します。</p>" unless @conf.mobile_agent?}
39
+ <p>
40
+ <select name="style">
41
+ HTML
42
+ enum_styles do |style|
43
+ label = labels[style] || style
44
+ select = if (label == @conf['style']) or (!@conf['style'] && style == 'tdiary')
45
+ ' selected'
46
+ else
47
+ ''
48
+ end
49
+ r << %Q|<option value="#{label}"#{select}>#{labels[style] || style}</option>|
50
+ end
51
+ r << <<-HTML
52
+ </select>
53
+ </p>
54
+ #{"<p>スタイルについての詳細は<a href=\"http://tdiary-users.sourceforge.jp/cgi-bin/wiki.cgi?%A5%B9%A5%BF%A5%A4%A5%EB\">スタイル - tDiary の記法</a>をごらんください。</p>" unless @conf.mobile_agent?}
55
+ HTML
56
+ end
@@ -24,7 +24,7 @@ require 'openssl'
24
24
  require 'json'
25
25
 
26
26
  def twitter_quote_option_keys
27
- %w( oauth_consumer_key oauth_consumer_secret oauth_token oauth_token_secret, render_method ).map{|k| "twitter_quote.#{k}" }
27
+ %w( oauth_consumer_key oauth_consumer_secret oauth_token oauth_token_secret render_method ).map{|k| "twitter_quote.#{k}" }
28
28
  end
29
29
 
30
30
  def twitter_statuses_show_api( tweet_id )
@@ -0,0 +1,22 @@
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <rsp stat="ok">
3
+ <photo id="5950109223" secret="040097db92" server="6006" farm="7" dateuploaded="1310997234" isfavorite="0" license="5" safety_level="0" rotation="0" originalsecret="45aaba502a" originalformat="jpg" views="111" media="photo">
4
+ <owner nsid="19594487@N00" username="machu." realname="" location="" iconserver="6" iconfarm="1" path_alias="machu" />
5
+ <title>RubyKaigi 2011</title>
6
+ <description />
7
+ <visibility ispublic="1" isfriend="0" isfamily="0" />
8
+ <dates posted="1310997234" taken="2011-07-18 18:44:49" takengranularity="0" takenunknown="0" lastupdate="1310997320" />
9
+ <editability cancomment="0" canaddmeta="0" />
10
+ <publiceditability cancomment="1" canaddmeta="1" />
11
+ <usage candownload="1" canblog="0" canprint="0" canshare="1" />
12
+ <comments>0</comments>
13
+ <notes />
14
+ <people haspeople="0" />
15
+ <tags>
16
+ <tag id="617957-5950109223-3919351" author="19594487@N00" authorname="machu." raw="rubykaigi" machine_tag="0">rubykaigi</tag>
17
+ </tags>
18
+ <urls>
19
+ <url type="photopage">https://www.flickr.com/photos/machu/5950109223/</url>
20
+ </urls>
21
+ </photo>
22
+ </rsp>