gmapz 2.0.9

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.
@@ -0,0 +1,40 @@
1
+ // Pins must be defined BEFORE map initialization
2
+
3
+ var base_path = 'img/gmapz/';
4
+ GMapz.pins = {
5
+ 'default': { // IE8 Reserved word, allways mus be QUOTED!
6
+ pin: {
7
+ img: base_path + 'pin.png',
8
+ size: [48.0, 48.0],
9
+ anchor: [24.0, 48.0]
10
+ }
11
+ },
12
+ user_location: { // Used for geolocation
13
+ pin: {
14
+ img: base_path + 'pin-user-location.png',
15
+ size: [48.0, 48.0],
16
+ anchor: [24.0, 48.0]
17
+ }
18
+ },
19
+ orange: {
20
+ pin: {
21
+ img: base_path + 'pin-orange.png',
22
+ size: [48.0, 48.0],
23
+ anchor: [24.0, 48.0]
24
+ }
25
+ },
26
+ blue: {
27
+ pin: {
28
+ img: base_path + 'pin-blue.png',
29
+ size: [48.0, 48.0],
30
+ anchor: [24.0, 48.0]
31
+ }
32
+ },
33
+ green: {
34
+ pin: {
35
+ img: base_path + 'pin-green.png',
36
+ size: [48.0, 48.0],
37
+ anchor: [24.0, 48.0]
38
+ }
39
+ }
40
+ };
@@ -0,0 +1,389 @@
1
+ var
2
+ map_sample_1A,
3
+ map_sample_1B,
4
+ map_sample_1C,
5
+ map_sample_1D,
6
+ map_sample_1E,
7
+ map_sample_2A,
8
+ map_sample_4A,
9
+ map_sample_4B,
10
+ map_sample_4C,
11
+ map_sample_4D,
12
+ map_sample_4E,
13
+ map_sample_5A,
14
+ map_sample_5B,
15
+ map_sample_6A,
16
+ map_sample_6B,
17
+ map_sample_7A;
18
+
19
+ $(document).ready(function() {
20
+ // La magia aquí
21
+
22
+ // Activate console log messages
23
+ GMapz.debug = true;
24
+ // This key is valid only for the samples in this page!
25
+ GMapz.APIKEY ='AIzaSyCyL4U5ihhLdpTxsfR6A7FMtj1j5bOui9o';
26
+
27
+ // Map sample 1A *************************************************************
28
+
29
+ map_sample_1A = new GMapz.map(
30
+ $('#map-sample-1A'),
31
+ { // Google Maps options
32
+ scrollwheel: true, // Default
33
+ scaleControl: true, // Default
34
+ center: [48.860, 2.340],
35
+ bounds: [49.7198, 4.1335, 47.9851, 0.5464],
36
+ // zoom: 9 You can set `zoom` instead of bounds
37
+ // 'ROADMAP' / 'SATELLITE' / 'HYBRID' / 'TERRAIN'
38
+ mapTypeId: 'ROADMAP' // Default
39
+ }
40
+ );
41
+
42
+ // Map sample 1B *************************************************************
43
+
44
+ map_sample_1B = new GMapz.map(
45
+ $('#map-sample-1B'),
46
+ { // Google Maps options
47
+ center: [43.2486, -5.7767],
48
+ zoom: 9,
49
+ styles: [{"featureType":"landscape.natural","elementType":"geometry.fill","stylers":[{"visibility":"on"},{"color":"#e0efef"}]},{"featureType":"poi","elementType":"geometry.fill","stylers":[{"visibility":"on"},{"hue":"#1900ff"},{"color":"#c0e8e8"}]},{"featureType":"road","elementType":"geometry","stylers":[{"lightness":100},{"visibility":"simplified"}]},{"featureType":"road","elementType":"labels","stylers":[{"visibility":"off"}]},{"featureType":"transit.line","elementType":"geometry","stylers":[{"visibility":"on"},{"lightness":700}]},{"featureType":"water","elementType":"all","stylers":[{"color":"#7dcdcd"}]}]
50
+ }
51
+ );
52
+
53
+ // Map sample 1C *************************************************************
54
+
55
+ map_sample_1C = new GMapz.map(
56
+ $('#map-sample-1C'),
57
+ {
58
+ // Empty Google Maps options
59
+ },
60
+ // One single marker / location
61
+ {
62
+ bolera_de_mieres: {
63
+ lat: 43.239175,
64
+ lng: -5.779116,
65
+ iw: 'Puede que los mejores callos del mundo ;)'
66
+ }
67
+ }
68
+ );
69
+
70
+ map_sample_1C.onReady = function(){
71
+ // this = google.maps instance
72
+ // this.setSingleMarkerZoom(false); // Disable singleMarkerZoom
73
+ this.setSingleMarkerZoom(16); // Set custom value
74
+ this.fitBounds();
75
+ };
76
+
77
+ // Map sample 1E *************************************************************
78
+
79
+ var map_sample_1E_options = {
80
+ center: [43.2486, -5.7767]
81
+ };
82
+
83
+ map_sample_1E = new GMapz.map(
84
+ $('#map-sample-1E'),
85
+ map_sample_1E_options,
86
+ france_cities // gmapz.locations.js
87
+ );
88
+
89
+ map_sample_1E.onReady = function(){
90
+ // this = google.maps instance
91
+ this.fitBounds();
92
+ };
93
+
94
+ // Map sample 1F *************************************************************
95
+
96
+ var map_sample_1F_options = {
97
+ // Options here
98
+ mapTypeId: 'ROADMAP', // 'ROADMAP' / 'SATELLITE' / 'HYBRID' / 'TERRAIN'... caps
99
+ center: [48, 2],
100
+ zoom: 5
101
+ };
102
+
103
+ map_sample_1F = new GMapz.map(
104
+ $('#map-sample-1F'),
105
+ map_sample_1F_options,
106
+ france_cities
107
+ );
108
+
109
+ var marker_cluster_style = [{
110
+ textColor: 'white',
111
+ url: 'img/gmapz/pin-cluster.png',
112
+ height: 48,
113
+ width: 48,
114
+ textSize: '17',
115
+ backgroundPosition: '0 0'
116
+ // anchorIcon: [-24.0, -48.0] // This propoerty its not supported actually
117
+ }];
118
+
119
+ map_sample_1F.onReady = function() {
120
+ // Convert markers object, into array
121
+ markers_array = $.map(this.markers, function(val, idx){
122
+ return [val];
123
+ });
124
+ this.marker_cluster = new MarkerClusterer(
125
+ this.map,
126
+ markers_array, {
127
+ gridSize: 100,
128
+ maxZoom: 15,
129
+ styles: marker_cluster_style
130
+ }
131
+ );
132
+ };
133
+
134
+ // Map sample 2A *************************************************************
135
+
136
+ var map_sample_2A = new GMapz.map(
137
+ $('[data-gmapz="gz-sample-2A"]')
138
+ );
139
+
140
+ map_sample_2A.onReady = function() {
141
+ this.addLocations(spain_locs).fitBounds();
142
+ };
143
+
144
+ $('#js-add-markers-2A').on('click', function(e) {
145
+ e.preventDefault();
146
+ map_sample_2A.addLocations(morocco);
147
+ });
148
+ $('#js-delete-markers-2A').on('click', function(e) {
149
+ e.preventDefault();
150
+ map_sample_2A.deleteMarkers(['FEZ','ORAN',12]);
151
+ });
152
+ $('#js-update-marker-2A').on('click', function(e) {
153
+ e.preventDefault();
154
+ map_sample_2A.addLocations(update);
155
+ });
156
+
157
+ // Map sample 4A *************************************************************
158
+
159
+ map_sample_4A = new GMapz.map($('#map-sample-4A'));
160
+
161
+ map_sample_4A.onReady = function() {
162
+ this.addLocations(italy_cities).fitBounds();
163
+ };
164
+
165
+ autocomplete_4A = new GMapz.autocomplete($('#my-autocomplete-4A'));
166
+
167
+ autocomplete_4A.onChange = function () {
168
+ // this = autocomplete obj
169
+ var place = this.instance.getPlace();
170
+ if(typeof place.geometry === 'undefined') {
171
+ // Place not found
172
+ alert('Dirección no encontrada');
173
+ return;
174
+ }
175
+ // We show place and closest marker
176
+ map_sample_4A.geoShowPosition(place);
177
+ };
178
+
179
+ // Map sample 4B *************************************************************
180
+
181
+ map_sample_4B = new GMapz.map(
182
+ $('#map-sample-4B'), {
183
+ center: [41.8919, 12.5113],
184
+ zoom: 12
185
+ }
186
+ );
187
+
188
+ autocomplete_4B = new GMapz.autocomplete($('#my-autocomplete-4B'));
189
+
190
+ autocomplete_4B.onChange = function () {
191
+ // this = autocomplete
192
+ var
193
+ place = this.instance.getPlace(),
194
+ pos = {};
195
+
196
+ if(typeof place.geometry === 'undefined') {
197
+ // No se ha encontrado el lugar
198
+ alert('No encontrado');
199
+ return;
200
+ }
201
+ // Creamos un nuevo marcador
202
+ pos['autocomplete'] = {
203
+ pin: 'autocomplete',
204
+ lat: place.geometry.location.lat(),
205
+ lng: place.geometry.location.lng(),
206
+ draggable: true,
207
+ iw : 'My infowindow 1'
208
+ };
209
+ // Chainning methods
210
+ map_sample_4B.setAllMarkersVisibility(false).addLocations(pos).fitToPlace(place,18).openInfoWindow('autocomplete');
211
+ };
212
+
213
+ // Map sample 4C *************************************************************
214
+
215
+ // Start gmapz with default options
216
+ var map_sample_4C = new GMapz.map(
217
+ $('[data-gmapz="gz-sample-4C"]')
218
+ );
219
+
220
+ // onReady add locations and fit bounds
221
+ map_sample_4C.onReady = function() {
222
+ this.addLocations(spain_locs).fitBounds();
223
+ };
224
+
225
+ // attachActionButtons is at the end of this file
226
+ // GMapz.attachActionButtons();
227
+
228
+ // Map sample 4D *************************************************************
229
+
230
+ map_sample_4D = new GMapz.map(
231
+ $('[data-gmapz="gz-sample-4D"]')
232
+ );
233
+
234
+ map_sample_4D.onReady = function() {
235
+ this.addLocations(spain_locs).fitBounds();
236
+ };
237
+
238
+ map_sample_4D.errorAddressNotFound = function(addr) {
239
+ alert('Was unable to find: '+addr);
240
+ console.log('Was unable to find: '+addr);
241
+ };
242
+
243
+ // Map sample 5A, responsive *************************************************
244
+
245
+ map_sample_5A = new GMapz.map($('#map-sample-5A'));
246
+
247
+ map_sample_5A.onReady = function() {
248
+ // Enables responsive control
249
+ this.addScrollControl();
250
+ // Load Italy cities
251
+ this.addLocations(italy_cities).fitBounds();
252
+ // Responsive events take a look at:
253
+ // https://github.com/carloscabo/MQBE
254
+ $(document)
255
+ .on('enter.mobile.mqbe', function() {
256
+ map_sample_5A.lockScroll();
257
+ }).on('leave.mobile.mqbe', function() {
258
+ map_sample_5A.resumeScroll();
259
+ });
260
+ };
261
+
262
+ map_sample_5A.onDraw = function() {
263
+ console.log(this.convertLatLngToPixels(
264
+ new google.maps.LatLng(41.890, 12.500)
265
+ ));
266
+ };
267
+
268
+ $(document)
269
+ .on('click touchstart', '#js-btn-scroll-lock-5A', function(e) {
270
+ e.preventDefault();
271
+ map_sample_5A.lockScroll();
272
+ })
273
+ .on('click touchstart', '#js-btn-scroll-resume-5A', function(e) {
274
+ e.preventDefault();
275
+ map_sample_5A.resumeScroll();
276
+ });
277
+
278
+ // Map sample 5B, responsive *************************************************
279
+
280
+ map_sample_5B = new GMapz.map($('#map-sample-5B'));
281
+
282
+ map_sample_5B.onReady = function() {
283
+ // Load Italy cities
284
+ this.addLocations(italy_cities).fitBounds();
285
+ // Enables responsive control, then locks map
286
+ this.addScrollControl().lockScroll();
287
+ };
288
+
289
+ // Map sample 6A *************************************************************
290
+
291
+ map_sample_6A = new GMapz.map(
292
+ $('#map-sample-6A'), {
293
+ center: [36.08, -6.82],
294
+ zoom: 5,
295
+ pixelOffset: [158, 100] // Offset of infowindow
296
+ }
297
+ );
298
+
299
+ map_sample_6A.onReady = function() {
300
+ this.addLocations(spain_locs).fitBounds();
301
+ };
302
+
303
+ // Map sample 6B *************************************************************
304
+
305
+ GMapz.onGoogleMapsReady = function () {
306
+ // Enable infobox library
307
+ infoBoxLoader(true);
308
+ };
309
+
310
+ // Start map with default options
311
+ map_sample_6B = new GMapz.map($('#map-sample-6B'));
312
+
313
+ map_sample_6B.onReady = function() {
314
+
315
+ // Define custom infobox style
316
+ var
317
+ ib_options = {
318
+ content: '<div class="gmapz-ibx"><div class="gmapz-ibx-close"></div><div class="gmapz-ibx-content">{{__REPLACE__}}</div></div>',
319
+ pixelOffset: new google.maps.Size(-130, -96), // x, y
320
+ closeBoxURL: '',
321
+ enableEventPropagation: true
322
+ /* disableAutoPan: false,
323
+ maxWidth: 0,
324
+ zIndex: null,
325
+ boxStyle: {
326
+ background: "url('tipbox.gif') no-repeat",
327
+ opacity: 0.75,
328
+ width: "280px"
329
+ },
330
+ closeBoxMargin: "10px 2px 2px 2px",
331
+ closeBoxURL: "http://www.google.com/intl/en_us/mapfiles/close.gif",
332
+ infoBoxClearance: new google.maps.Size(1, 1),
333
+ isHidden: false,
334
+ pane: "floatPane",
335
+ enableEventPropagation: false*/
336
+ };
337
+
338
+ // Add custom infobox to the map
339
+ this.defineInfoBox( ib_options );
340
+
341
+ // Load Italy cities AFTER define infobox
342
+ this.addLocations(italy_cities).fitBounds();
343
+ };
344
+
345
+ map_sample_6B.onDraw = function() {
346
+ // Open Rome marker / infobox
347
+ this.markers['roma'].click();
348
+ };
349
+
350
+ // Map sample 7A *************************************************************
351
+
352
+ $('.js-open-lightbox-7A.fancybox').on('click', function(e) {
353
+ e.preventDefault();
354
+ $.fancybox.open('<div id="fancy-map" style="width:100%;height:100%;"></div>', {
355
+ autoSize: false,
356
+ width: 800,
357
+ height: 600,
358
+ afterShow: function() {
359
+ // WARNING!
360
+ // For some reason the afterShow event of fancybox seems
361
+ // to be executed BEFORE the container is drawn.
362
+ // This causes issues with Google Maps, to be sure that the
363
+ // fancybox is drawn we call GMpaz inside a setTimeout, 0ms
364
+ // http://stackoverflow.com/a/779785/748321
365
+ setTimeout(function(){
366
+ map_sample_7A = new GMapz.map(
367
+ $('#fancy-map'),
368
+ {
369
+ center: [48.860, 2.340],
370
+ zoom: 12
371
+ },
372
+ {
373
+ map_point: {
374
+ lat: 48.860,
375
+ lng: 2.340
376
+ }
377
+ }
378
+ );
379
+ } ,0);
380
+ }
381
+ });
382
+ });
383
+
384
+
385
+ // Attach button with data-gmapz attribute ********************************************************
386
+
387
+ GMapz.attachActionButtons();
388
+
389
+ }); // Domready
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gmapz
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.9
5
+ platform: ruby
6
+ authors:
7
+ - carloscabo
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-07-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: It eases the creation of Google Maps, it's responsive, supports the creation
42
+ of multiple instances in the same page (each one with its own settings), the creation
43
+ of custom styled infowindows, and other useful helpers.
44
+ email:
45
+ - carlos.cabo@gmail.com
46
+ executables: []
47
+ extensions: []
48
+ extra_rdoc_files: []
49
+ files:
50
+ - ".gitignore"
51
+ - Gemfile
52
+ - LICENSE.md
53
+ - LICENSE.txt
54
+ - README.md
55
+ - Rakefile
56
+ - gmapz.gemspec
57
+ - lib/gmapz.rb
58
+ - lib/gmapz/engine.rb
59
+ - lib/gmapz/version.rb
60
+ - src/css/gmapz-responsive.css
61
+ - src/css/gmapz-sample-infobox.scss
62
+ - src/img/gmapz/ic_clear_black_18px.svg
63
+ - src/img/gmapz/pin-blue.png
64
+ - src/img/gmapz/pin-cluster.png
65
+ - src/img/gmapz/pin-green.png
66
+ - src/img/gmapz/pin-orange.png
67
+ - src/img/gmapz/pin-user-location.png
68
+ - src/img/gmapz/pin.png
69
+ - src/img/gmapz/scroll_disabled.svg
70
+ - src/img/gmapz/scroll_enabled.svg
71
+ - src/js/gmapz-dependencies/markerclusterer.js
72
+ - src/js/gmapz/gmapz.autocomplete.js
73
+ - src/js/gmapz/gmapz.js
74
+ - src/js/gmapz/gmapz.locations.js
75
+ - src/js/gmapz/gmapz.map.js
76
+ - src/js/gmapz/gmapz.pins.js
77
+ - src/js/ready.js
78
+ homepage: https://github.com/carloscabo/gmapz
79
+ licenses:
80
+ - MIT
81
+ metadata: {}
82
+ post_install_message:
83
+ rdoc_options: []
84
+ require_paths:
85
+ - lib
86
+ required_ruby_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ required_rubygems_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ requirements: []
97
+ rubyforge_project:
98
+ rubygems_version: 2.4.5
99
+ signing_key:
100
+ specification_version: 4
101
+ summary: GMapz is yet another Google Maps JS library.
102
+ test_files: []