tdiary-contrib 5.0.11 → 5.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0343f9efacec380a06456385bb96de2919b3e530f31e04e1843183fe68c362be
4
- data.tar.gz: 1e45713addec8000837c6fe4dba4ea75d29ebd85126125704862f48e9b55afc5
3
+ metadata.gz: bc1190e78433e0a69387575f2bcc40e2f07b433022b8571e63b2ec77a51ebc81
4
+ data.tar.gz: b8419819c2bd0b65217db448caf90805ccf47d8ed8c92052e5082fac25770f36
5
5
  SHA512:
6
- metadata.gz: bd2567180fbc3b3ead53b48e3563a94f669d8ebf8b827fb228518177d82666251b5702f341f70ad7e8233b303cb7de257a0d783ab004b63254b88aa3413bd5c0
7
- data.tar.gz: b5f8e36eb937d67a2db82c9bdb1d60fa7e8a2e2e9d50027ef8f30fa34235812313f96764961820dedaa5c370dd8b0c7f1744735f1e69f0a9e099b1b439ec191b
6
+ metadata.gz: 3367e5faab5bc9b4c2af9dc4a4ad51f980b646a67d18363e8027926dc4956eac1ecce14ebb338d019f62180c9f2c6d52d9fe8c08a721af2549a4df6ea64f9ac6
7
+ data.tar.gz: 16d753593606e8522df46be581c85703c42856099a77052de3c7f4d1f63856455f62c4954c40dbeb1a71c5d1feb54fb33d58769385abc37747dc79cb3c65220c
@@ -1,5 +1,5 @@
1
1
  module TDiary
2
2
  class Contrib
3
- VERSION = "5.0.11"
3
+ VERSION = "5.0.12"
4
4
  end
5
5
  end
data/plugin/google_map.rb CHANGED
@@ -1,174 +1,186 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  # google_map.rb - embeded Google Map for tDiary, use Google Maps JavaScript API V3.
4
- # http://code.google.com/intl/ja/apis/maps/documentation/v3/services.html
4
+ # https://developers.google.com/maps/documentation/javascript/tutorial
5
5
  #
6
6
  # Copyright (C) 2010, tamoot <tamoot+tdiary@gmail.com>
7
7
  # You can redistribute it and/or modify it under GPL2.
8
8
  #
9
9
 
10
10
  def google_map(lat, lon, params = {})
11
- params.merge!(:lat => lat, :lon => lon)
12
- google_map_common(params)
11
+ params.merge!(:lat => lat, :lon => lon)
12
+ google_map_common(params)
13
13
  end
14
14
 
15
15
  def google_geomap(address, params = {})
16
- params.merge!(:address => address)
17
- google_map_common(params)
16
+ params.merge!(:address => address)
17
+ google_map_common(params)
18
18
  end
19
19
 
20
20
  def google_map_common(params)
21
- params[:id] ||= ''
22
- params[:lat] ||= 0.0
23
- params[:lon] ||= 0.0
24
- params[:address] ||= nil
25
- params[:zoom] ||= 10
26
- params[:html] ||= nil
27
- params[:title] ||= nil
28
- params[:width] ||= 320
29
- params[:height] ||= 240
30
- params[:type] ||= :ROADMAP
31
- params[:overview]||= false
32
-
33
- if feed?
34
- require 'cgi'
35
-
36
- url = nil
37
- if params[:lat].nonzero? && params[:lon].nonzero?
38
- query = "#{params[:lat]},#{params[:lon]}"
39
- url = %Q|http://maps.google.com/maps?q=#{CGI::escape(query)}|
40
-
41
- elsif params[:address] != nil
42
- query = params[:address]
43
- url = %Q|http://maps.google.com/maps?q=#{CGI::escape(query)}|
44
-
45
- end
46
-
47
- return %Q|<a href="#{url}">#{url}</a>| if url
48
-
49
- end
50
-
51
- dom_id = "#{@gmap_date.strftime("%Y%m%d")}_#{@gmap_count}"
52
- params.merge!(:id => dom_id)
53
- @gmap_data << params
54
- @gmap_count += 1
55
-
56
- %Q|<div class="gmap" id="#{dom_id}" style="width : #{params[:width]}px; height : #{params[:height]}px;"></div>|
21
+ params[:id] ||= ''
22
+ params[:lat] ||= 0.0
23
+ params[:lon] ||= 0.0
24
+ params[:address] ||= nil
25
+ params[:zoom] ||= 10
26
+ params[:html] ||= nil
27
+ params[:title] ||= nil
28
+ params[:width] ||= 320
29
+ params[:height] ||= 240
30
+ params[:type] ||= :ROADMAP
31
+ params[:overview]||= false
32
+
33
+ if feed?
34
+ require 'cgi'
35
+
36
+ url = nil
37
+ if params[:lat].nonzero? && params[:lon].nonzero?
38
+ query = "#{params[:lat]},#{params[:lon]}"
39
+ url = %Q|https://maps.google.com/maps?q=#{CGI::escape(query)}|
40
+
41
+ elsif params[:address] != nil
42
+ query = params[:address]
43
+ url = %Q|https://maps.google.com/maps?q=#{CGI::escape(query)}|
44
+
45
+ end
46
+
47
+ return %Q|<a href="#{url}">#{url}</a>| if url
48
+
49
+ end
50
+
51
+ dom_id = "#{@gmap_date.strftime("%Y%m%d")}_#{@gmap_count}"
52
+ params.merge!(:id => dom_id)
53
+ @gmap_data << params
54
+ @gmap_count += 1
55
+
56
+ %Q|<div class="gmap" id="#{dom_id}" style="width : #{params[:width]}px; height : #{params[:height]}px;"></div>|
57
57
  end
58
58
 
59
59
  add_header_proc do
60
- if /\A(?:latest|day|month|nyear|preview)\z/ =~ @mode
61
- %Q|<script type="text/javascript" src="//maps.google.com/maps/api/js?sensor=true"></script>\n|
62
- end
60
+ if /\A(?:latest|day|month|nyear|preview)\z/ =~ @mode
61
+ %Q|<script type="text/javascript" src="//maps.google.com/maps/api/js?key=#{@conf['google_map.key']}"></script>\n|
62
+ end
63
63
  end
64
64
 
65
65
  add_body_enter_proc do |date|
66
- @gmap_data = []
67
- @gmap_date = date
68
- @gmap_count = 0
69
- ''
66
+ @gmap_data = []
67
+ @gmap_date = date
68
+ @gmap_count = 0
69
+ ''
70
70
  end
71
71
 
72
72
  add_body_leave_proc do |date|
73
- gmap_scripts = ''
74
- if !feed? && @gmap_data.any?
75
- gmap_scripts = %Q|<script type="text/javascript">\n<!--\n|
76
- @gmap_data.each do |data|
77
- if data[:address]
78
- gmap_scripts << google_geomap_script(data)
79
- else
80
- gmap_scripts << google_map_script(data)
81
- end
82
- end
83
- gmap_scripts << %Q|//-->\n</script>\n|
84
- end
85
- gmap_scripts
73
+ gmap_scripts = ''
74
+ if !feed? && @gmap_data.any?
75
+ gmap_scripts = %Q|<script type="text/javascript">\n<!--\n|
76
+ @gmap_data.each do |data|
77
+ if data[:address]
78
+ gmap_scripts << google_geomap_script(data)
79
+ else
80
+ gmap_scripts << google_map_script(data)
81
+ end
82
+ end
83
+ gmap_scripts << %Q|//-->\n</script>\n|
84
+ end
85
+ gmap_scripts
86
+ end
87
+
88
+ add_conf_proc('google_map', 'Google Maps', 'etc') do
89
+ if @mode == 'saveconf' then
90
+ @conf['google_map.key'], = @cgi.params['google_map.key']
91
+ end
92
+
93
+ <<-HTML
94
+ <h3 class="subtitle">Google Maps API Key</h3>
95
+ <p>API Key (see <a href="https://developers.google.com/maps/documentation/javascript/get-api-key">developers.google.com/maps</a>)</p>
96
+ <p><input name="google_map.key" value="#{h @conf['google_map.key']}" size="50"></p>
97
+ HTML
86
98
  end
87
99
 
88
100
  def google_map_script(hash)
89
- str = ''
90
- str << %Q|google.maps.event.addDomListener(window, 'load', function() {\n|
91
- str << %Q| var mapdiv = document.getElementById("#{hash[:id]}");\n|
92
- str << %Q| if(mapdiv){\n|
93
- str << %Q| var myOptions = {\n|
94
- str << %Q| zoom: #{hash[:zoom]},\n|
95
- str << %Q| overviewMapControl: #{hash[:overview]},\n|
96
- str << %Q| overviewMapControlOptions: {\n|
97
- str << %Q| opened: #{hash[:overview]}\n|
98
- str << %Q| },\n|
99
- str << %Q| center: new google.maps.LatLng(#{hash[:lat]}, #{hash[:lon]}),\n|
100
- str << %Q| mapTypeId: google.maps.MapTypeId.#{hash[:type]},\n|
101
- str << %Q| scaleControl: true\n|
102
- str << %Q| };\n|
103
- str << %Q| var gMap = new google.maps.Map(mapdiv, myOptions);\n|
104
- # set Marker
105
- if hash[:title]
106
- str << %Q| var marker = new google.maps.Marker({\n|
107
- str << %Q| position: new google.maps.LatLng(#{hash[:lat]}, #{hash[:lon]}),\n|
108
- str << %Q| map: gMap,\n|
109
- str << %Q| title: '#{hash[:title]}'\n|
110
- str << %Q| });\n|
111
- # set InfoWindow
112
- if hash[:html]
113
- str << %Q| var infowindow = new google.maps.InfoWindow({\n|
114
- str << %Q| content: '<span style="color: #000000;">#{hash[:html]}</span>',\n|
115
- str << %Q| size: new google.maps.Size(350, 200)\n|
116
- str << %Q| });\n|
117
- str << %Q| infowindow.open(gMap, marker);\n|
118
- end # :html
119
- end # :title
120
- str << %Q| };\n|
121
- str << %Q|});\n|
122
-
123
- str
101
+ str = ''
102
+ str << %Q|google.maps.event.addDomListener(window, 'load', function() {\n|
103
+ str << %Q| var mapdiv = document.getElementById("#{hash[:id]}");\n|
104
+ str << %Q| if(mapdiv){\n|
105
+ str << %Q| var myOptions = {\n|
106
+ str << %Q| zoom: #{hash[:zoom]},\n|
107
+ str << %Q| overviewMapControl: #{hash[:overview]},\n|
108
+ str << %Q| overviewMapControlOptions: {\n|
109
+ str << %Q| opened: #{hash[:overview]}\n|
110
+ str << %Q| },\n|
111
+ str << %Q| center: new google.maps.LatLng(#{hash[:lat]}, #{hash[:lon]}),\n|
112
+ str << %Q| mapTypeId: google.maps.MapTypeId.#{hash[:type]},\n|
113
+ str << %Q| scaleControl: true\n|
114
+ str << %Q| };\n|
115
+ str << %Q| var gMap = new google.maps.Map(mapdiv, myOptions);\n|
116
+ # set Marker
117
+ if hash[:title]
118
+ str << %Q| var marker = new google.maps.Marker({\n|
119
+ str << %Q| position: new google.maps.LatLng(#{hash[:lat]}, #{hash[:lon]}),\n|
120
+ str << %Q| map: gMap,\n|
121
+ str << %Q| title: '#{hash[:title]}'\n|
122
+ str << %Q| });\n|
123
+ # set InfoWindow
124
+ if hash[:html]
125
+ str << %Q| var infowindow = new google.maps.InfoWindow({\n|
126
+ str << %Q| content: '<span style="color: #000000;">#{hash[:html]}</span>',\n|
127
+ str << %Q| size: new google.maps.Size(350, 200)\n|
128
+ str << %Q| });\n|
129
+ str << %Q| infowindow.open(gMap, marker);\n|
130
+ end # :html
131
+ end # :title
132
+ str << %Q| };\n|
133
+ str << %Q|});\n|
134
+
135
+ str
124
136
  end
125
137
 
126
138
  def google_geomap_script(hash)
127
- str = ''
128
- str << %Q|google.maps.event.addDomListener(window, 'load', function() {\n|
129
- str << %Q| var mapdiv = document.getElementById("#{hash[:id]}");\n|
130
- str << %Q| if(mapdiv){\n|
131
- str << %Q| var geocoder = new google.maps.Geocoder();\n|
132
- str << %Q| if(geocoder) {\n|
133
- str << %Q| geocoder.geocode( { 'address': '#{hash[:address]}'}, function(results, status) {\n|
134
- str << %Q| if (status == google.maps.GeocoderStatus.OK) {\n|
135
- str << %Q| var geoLat = results[0].geometry.location;\n|
136
- str << %Q| var myOptions = {\n|
137
- str << %Q| zoom: #{hash[:zoom]},\n|
138
- str << %Q| overviewMapControl: #{hash[:overview]},\n|
139
- str << %Q| overviewMapControlOptions: {\n|
140
- str << %Q| opened: #{hash[:overview]}\n|
141
- str << %Q| },\n|
142
- str << %Q| center: geoLat,\n|
143
- str << %Q| mapTypeId: google.maps.MapTypeId.#{hash[:type]},\n|
144
- str << %Q| scaleControl: true\n|
145
- str << %Q| };\n|
146
- str << %Q| var gMap = new google.maps.Map(mapdiv, myOptions);\n|
147
- # set Marker
148
- if hash[:title]
149
- str << %Q| var marker = new google.maps.Marker({\n|
150
- str << %Q| position: geoLat,\n|
151
- str << %Q| map: gMap,\n|
152
- str << %Q| title: '#{hash[:title]}'\n|
153
- str << %Q| });\n|
154
- # set InfoWindow
155
- if hash[:html]
156
- str << %Q| var infowindow = new google.maps.InfoWindow({\n|
157
- str << %Q| content: '<span style="color: #000000;">#{hash[:html]}</span>',\n|
158
- str << %Q| size: new google.maps.Size(350, 200)\n|
159
- str << %Q| });\n|
160
- str << %Q| infowindow.open(gMap, marker);\n|
161
- end # :html
162
- end # :title
163
- str << %Q| }else{\n|
164
- str << %Q| alert("Geocode was not successful for the following reason: " + status)\n|
165
- str << %Q| }\n|
166
- str << %Q| });\n|
167
- str << %Q| }\n|
168
- str << %Q| }\n|
169
- str << %Q|});\n|
170
-
171
- str
139
+ str = ''
140
+ str << %Q|google.maps.event.addDomListener(window, 'load', function() {\n|
141
+ str << %Q| var mapdiv = document.getElementById("#{hash[:id]}");\n|
142
+ str << %Q| if(mapdiv){\n|
143
+ str << %Q| var geocoder = new google.maps.Geocoder();\n|
144
+ str << %Q| if(geocoder) {\n|
145
+ str << %Q| geocoder.geocode( { 'address': '#{hash[:address]}'}, function(results, status) {\n|
146
+ str << %Q| if (status == google.maps.GeocoderStatus.OK) {\n|
147
+ str << %Q| var geoLat = results[0].geometry.location;\n|
148
+ str << %Q| var myOptions = {\n|
149
+ str << %Q| zoom: #{hash[:zoom]},\n|
150
+ str << %Q| overviewMapControl: #{hash[:overview]},\n|
151
+ str << %Q| overviewMapControlOptions: {\n|
152
+ str << %Q| opened: #{hash[:overview]}\n|
153
+ str << %Q| },\n|
154
+ str << %Q| center: geoLat,\n|
155
+ str << %Q| mapTypeId: google.maps.MapTypeId.#{hash[:type]},\n|
156
+ str << %Q| scaleControl: true\n|
157
+ str << %Q| };\n|
158
+ str << %Q| var gMap = new google.maps.Map(mapdiv, myOptions);\n|
159
+ # set Marker
160
+ if hash[:title]
161
+ str << %Q| var marker = new google.maps.Marker({\n|
162
+ str << %Q| position: geoLat,\n|
163
+ str << %Q| map: gMap,\n|
164
+ str << %Q| title: '#{hash[:title]}'\n|
165
+ str << %Q| });\n|
166
+ # set InfoWindow
167
+ if hash[:html]
168
+ str << %Q| var infowindow = new google.maps.InfoWindow({\n|
169
+ str << %Q| content: '<span style="color: #000000;">#{hash[:html]}</span>',\n|
170
+ str << %Q| size: new google.maps.Size(350, 200)\n|
171
+ str << %Q| });\n|
172
+ str << %Q| infowindow.open(gMap, marker);\n|
173
+ end # :html
174
+ end # :title
175
+ str << %Q| }else{\n|
176
+ str << %Q| alert("Geocode was not successful for the following reason: " + status)\n|
177
+ str << %Q| }\n|
178
+ str << %Q| });\n|
179
+ str << %Q| }\n|
180
+ str << %Q| }\n|
181
+ str << %Q|});\n|
182
+
183
+ str
172
184
  end
173
185
 
174
186
  # Local Variables:
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tdiary-contrib
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.11
4
+ version: 5.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - tDiary contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-29 00:00:00.000000000 Z
11
+ date: 2019-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tdiary
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '5.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '5.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pushbullet_ruby
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -42,16 +42,22 @@ dependencies:
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.3'
48
+ - - "<"
49
+ - !ruby/object:Gem::Version
50
+ version: '3.0'
48
51
  type: :development
49
52
  prerelease: false
50
53
  version_requirements: !ruby/object:Gem::Requirement
51
54
  requirements:
52
- - - "~>"
55
+ - - ">="
53
56
  - !ruby/object:Gem::Version
54
57
  version: '1.3'
58
+ - - "<"
59
+ - !ruby/object:Gem::Version
60
+ version: '3.0'
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: rake
57
63
  requirement: !ruby/object:Gem::Requirement
@@ -507,7 +513,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
507
513
  - !ruby/object:Gem::Version
508
514
  version: '0'
509
515
  requirements: []
510
- rubygems_version: 3.0.1
516
+ rubygems_version: 3.0.3
511
517
  signing_key:
512
518
  specification_version: 4
513
519
  summary: tDiary contributions package