tdiary-contrib 4.1.1 → 4.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +7 -2
- data/Gemfile.lock +29 -12
- data/js/picasa.js +3 -3
- data/lib/tdiary/contrib/version.rb +1 -1
- data/plugin/datepicker.rb +2 -2
- data/plugin/flickr.rb +3 -3
- data/plugin/google_map.rb +76 -73
- data/plugin/hatena_star.rb +1 -1
- data/plugin/instagr.rb +2 -2
- data/plugin/nicovideo.rb +22 -17
- data/plugin/picasa.rb +16 -0
- data/plugin/rubykaigi.rb +7 -1
- data/plugin/search-google-custom.rb +1 -1
- data/plugin/select-style.rb +56 -0
- data/plugin/tweet_quote.rb +1 -1
- data/spec/fixtures/flickr/5950109223.flickr.photos.getInfo.xml +22 -0
- data/spec/fixtures/flickr/5950109223.flickr.photos.getSizes.xml +14 -0
- data/spec/fixtures/my_hotentry/entrylist-empty.xml +24 -0
- data/spec/fixtures/my_hotentry/entrylist.xml +322 -0
- data/spec/flicker_spec.rb +21 -0
- data/spec/my_hotentry_spec.rb +5 -0
- data/spec/spec_helper.rb +22 -0
- metadata +13 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7410e628979a4cbc25c8a0aa882935065c5364f2
|
4
|
+
data.tar.gz: 6f9b381d1c3c7d7d108ee5b6b5e0ba604d2f4962
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d270a15ecf5b5409a0e706bc800dbd08ff8919f8f8032e4b38d96d3a92ea0009475b23fcc2c68f2ba529b2aae3cd9c94503247f72f07269e756d1511993a8244
|
7
|
+
data.tar.gz: 1c981dc013b58bdf3dd221541435c72caa2644f758bff3b83f8e82b2303a2f3625cab4ec14f12b90509e2abecb960266bbca0fd572e0a2e435c1a0156bb466e8
|
data/Gemfile
CHANGED
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.
|
9
|
-
rspec-core (~> 3.
|
10
|
-
rspec-expectations (~> 3.
|
11
|
-
rspec-mocks (~> 3.
|
12
|
-
rspec-core (3.
|
13
|
-
rspec-support (~> 3.
|
14
|
-
rspec-expectations (3.
|
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.
|
17
|
-
rspec-mocks (3.
|
18
|
-
|
19
|
-
|
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
|
-
|
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: '
|
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: '
|
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: '
|
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) {
|
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('
|
15
|
+
enable_js('//ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js')
|
16
16
|
if @conf.lang == 'ja'
|
17
|
-
enable_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.
|
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 @
|
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.
|
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
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
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
|
-
|
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
|
-
|
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|
|
84
|
-
str << %Q|
|
85
|
-
str << %Q|
|
86
|
-
str << %Q|
|
87
|
-
str << %Q|
|
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|
|
90
|
-
str << %Q|
|
91
|
-
str << %Q|
|
92
|
-
str << %Q|
|
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|
|
94
|
+
str << %Q| var gMap = new google.maps.Map(mapdiv, myOptions);\n|
|
95
95
|
# set Marker
|
96
96
|
if hash[:title]
|
97
|
-
str << %Q|
|
98
|
-
str << %Q|
|
99
|
-
str << %Q|
|
100
|
-
str << %Q|
|
101
|
-
str << %Q|
|
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|
|
105
|
-
str << %Q|
|
106
|
-
str << %Q|
|
107
|
-
str << %Q|
|
108
|
-
str << %Q|
|
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|
|
120
|
-
str << %Q|
|
121
|
-
str << %Q|
|
122
|
-
str << %Q| if
|
123
|
-
str << %Q|
|
124
|
-
str << %Q|
|
125
|
-
str << %Q|
|
126
|
-
str << %Q|
|
127
|
-
str << %Q|
|
128
|
-
str << %Q|
|
129
|
-
str << %Q|
|
130
|
-
str << %Q|
|
131
|
-
str << %Q|
|
132
|
-
str << %Q|
|
133
|
-
str << %Q|
|
134
|
-
str << %Q|
|
135
|
-
str << %Q|
|
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|
|
139
|
-
str << %Q|
|
140
|
-
str << %Q|
|
141
|
-
str << %Q|
|
142
|
-
str << %Q|
|
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|
|
146
|
-
str << %Q|
|
147
|
-
str << %Q|
|
148
|
-
str << %Q|
|
149
|
-
str << %Q|
|
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|
|
153
|
-
str << %Q|
|
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|
|
156
|
-
str << %Q| }\n|
|
159
|
+
str << %Q| }\n|
|
157
160
|
str << %Q|});\n|
|
158
161
|
|
159
162
|
str
|
data/plugin/hatena_star.rb
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
}
|
11
11
|
|
12
12
|
add_header_proc do
|
13
|
-
hatena_star = %Q|\t<script type="text/javascript" src="
|
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 = {:
|
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["
|
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
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
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
|
51
|
-
i[:thumb] = elem
|
52
|
-
i[:title] = label || elem
|
53
|
-
i[:desc] = elem
|
54
|
-
i[:comment] = @conf.mobile_agent? ? '' : elem
|
55
|
-
i[:date] = elem
|
56
|
-
i[:length] = elem
|
57
|
-
i[:view] = elem
|
58
|
-
i[:comment_num] = elem
|
59
|
-
i[:mylist] = elem
|
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 )
|
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| <a href="#{api
|
107
|
+
r << %Q| <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></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://
|
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="
|
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
|
data/plugin/tweet_quote.rb
CHANGED
@@ -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
|
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>
|