jekyll-maps 1.1.2 → 1.1.3

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
  SHA1:
3
- metadata.gz: 2a74fcbcd8ef290f24136b57ed4c40426c8dcbbb
4
- data.tar.gz: 6efa49c7799005c02fd2c9871bf57bb8248fe20f
3
+ metadata.gz: e101ef0a8a4f48f829f8921b069f6e6c510db44a
4
+ data.tar.gz: 7f7651c7b40013fbf08572742c04141c43d596c8
5
5
  SHA512:
6
- metadata.gz: eb263df2652df18d22ab3c1e45bcdf2e4970f66c00f12bbb06278883b4cba1e6fffcf2b5a3225916448550fa21f8989fe9fef1ce0e2fc4a62894e40fdaf3d534
7
- data.tar.gz: f32958144f5e1b24ea21d63dba885dc6ab2e44eab3f2066295c95bbbf7f9e026f3f8471fed452e77a16c580683b4a9d5e513a6d6a2f8b556e656dbc65e480ac1
6
+ metadata.gz: 378f1cd5f0dde347cf711b4390bf796db37e48aaae8d37d2fae6da1f4b8eff147b85350c8c6e127998c9ab47972834900a0cc0eedb6ab1051a70e6324085229e
7
+ data.tar.gz: fbe266068425d1328478e7304db573e6b2f88027f05f5892b1aa64fbf9f7b6326512d56728e5d048a749eb9674683c761b56ddcdbacd4cf708fb1c26cc79cdd7
data/History.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.1.3 / 2016-07-28
2
+
3
+ * on-page map flag
4
+
1
5
  ## 1.1.2 / 2016-07-22
2
6
 
3
7
  * configurable marker cluster
data/README.md CHANGED
@@ -78,7 +78,7 @@ For instance, following tag will only display locations from documents which hav
78
78
  ### Marker Cluster
79
79
 
80
80
  By default [Marker Clusterer](https://github.com/googlemaps/js-marker-clusterer) is enabled.
81
- If you have many markers on the map, it will group them and show icon with the count of markers in each cluster - [See example](https://googlemaps.github.io/js-marker-clusterer/examples/advanced_example.html)
81
+ If you have many markers on the map, it will group them and show icon with the count of markers in each cluster - [see example](https://googlemaps.github.io/js-marker-clusterer/examples/advanced_example.html).
82
82
 
83
83
  If you don't want to use marker cluster, you can disable it globally in `_config.yml`:
84
84
 
@@ -108,3 +108,7 @@ Want to see it in action? Check out [Demo Page](https://ayastreb.github.io/jekyl
108
108
  3. Commit your changes (`git commit -am 'Add some feature'`)
109
109
  4. Push to the branch (`git push origin my-new-feature`)
110
110
  5. Create a new Pull Request
111
+
112
+ ## License
113
+
114
+ [MIT](https://github.com/ayastreb/jekyll-maps/blob/master/LICENSE). Feel free to use, copy or distribute it.
@@ -18,7 +18,7 @@ var jekyllMaps = (function () {
18
18
  this.options = {
19
19
  mapTypeId: google.maps.MapTypeId.ROADMAP,
20
20
  center: new google.maps.LatLng(0, 0),
21
- zoom: 3
21
+ zoom: 12
22
22
  }
23
23
  this.mapReady = true;
24
24
  this.render();
@@ -45,10 +45,12 @@ var jekyllMaps = (function () {
45
45
  while (this.data.length > 0) {
46
46
  var data = this.data.pop(),
47
47
  bounds = new google.maps.LatLngBounds(),
48
- map = new google.maps.Map(document.getElementById(data.id), this.options),
48
+ options = this.options,
49
+ map = new google.maps.Map(document.getElementById(data.id), options),
49
50
  markers = data.locations.map(createMarker);
50
51
 
51
52
  map.fitBounds(bounds);
53
+ google.maps.event.addListenerOnce(map, 'bounds_changed', onBoundsChanged);
52
54
  if (data.useCluster) {
53
55
  this.maps.push({map: map, markers: markers});
54
56
  this.processCluster();
@@ -71,6 +73,12 @@ var jekyllMaps = (function () {
71
73
 
72
74
  return marker;
73
75
  }
76
+
77
+ function onBoundsChanged() {
78
+ if (this.getZoom() > options.zoom) {
79
+ this.setZoom(options.zoom);
80
+ }
81
+ }
74
82
  }
75
83
 
76
84
  function initializeCluster(settings) {
@@ -12,8 +12,8 @@ module Jekyll
12
12
  end
13
13
 
14
14
  def render(context)
15
- locations = @finder.find(context.registers[:site])
16
- use_cluster = @args[:flags][:no_cluster] ? "false" : "true"
15
+ locations = @finder.find(context.registers[:site], context.registers[:page])
16
+ use_cluster = @args[:flags][:no_cluster] ? "false" : "true"
17
17
  @args[:attributes][:id] ||= SecureRandom.uuid
18
18
 
19
19
  <<HTML
@@ -6,9 +6,13 @@ module Jekyll
6
6
  @options = options
7
7
  end
8
8
 
9
- def find(site)
10
- site.collections.each { |_, collection| filter(collection.docs) }
11
- site.data.each { |_, docs| filter(docs) }
9
+ def find(site, page)
10
+ if @options[:flags][:on_page]
11
+ @documents << page if location?(page)
12
+ else
13
+ site.collections.each { |_, collection| filter(collection.docs) }
14
+ site.data.each { |_, docs| filter(docs) }
15
+ end
12
16
 
13
17
  @documents.map do |document|
14
18
  {
@@ -4,6 +4,7 @@ module Jekyll
4
4
  OPTIONS_SYNTAX = %r!([^\s]+)\s*:\s*([^\s]+)!
5
5
  ALLOWED_FLAGS = %w(
6
6
  no_cluster
7
+ on_page
7
8
  ).freeze
8
9
  ALLOWED_ATTRIBUTES = %w(
9
10
  id
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module Maps
3
- VERSION = "1.1.2".freeze
3
+ VERSION = "1.1.3".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-maps
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anatoliy Yastreb
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-22 00:00:00.000000000 Z
11
+ date: 2016-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll