Version Description
:- 2018-09-25 :- Medium Priority = * Fixed change in 7.10.35 causing problems with OLMarker click event, preventing infowindow opening * Dropped .gitignore which was causing deployment issues, now using .gitattributes to ignore minified files
Download this release
Release Info
Developer | perryrylance |
Plugin | WP Google Maps |
Version | 7.10.36 |
Comparing to | |
See all releases |
Code changes from version 7.10.35 to 7.10.36
- .gitattributes +2 -0
- .gitignore +0 -2
- includes/build.log +136 -136
- js/v8/core.js +0 -2
- js/v8/open-layers/ol-marker.js +3 -3
- js/v8/wp-google-maps.combined.js +6262 -0
- js/v8/wp-google-maps.min.js +1 -0
- readme.txt +13 -0
- wpGoogleMaps.php +5 -1
.gitattributes
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
js/v8/wp-google-maps.combined.js -diff
|
2 |
+
js/v8/wp-google-maps.min.js -diff
|
.gitignore
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
js/v8/wp-google-maps.combined.js
|
2 |
-
js/v8/wp-google-maps.min.js
|
|
|
|
includes/build.log
CHANGED
@@ -1,136 +1,136 @@
|
|
1 |
-
2018-09-
|
2 |
-
2018-09-
|
3 |
-
2018-09-
|
4 |
-
2018-09-
|
5 |
-
2018-09-
|
6 |
-
2018-09-
|
7 |
-
2018-09-
|
8 |
-
2018-09-
|
9 |
-
2018-09-
|
10 |
-
2018-09-
|
11 |
-
2018-09-
|
12 |
-
2018-09-
|
13 |
-
2018-09-
|
14 |
-
2018-09-
|
15 |
-
2018-09-
|
16 |
-
2018-09-
|
17 |
-
2018-09-
|
18 |
-
2018-09-
|
19 |
-
2018-09-
|
20 |
-
2018-09-
|
21 |
-
2018-09-
|
22 |
-
2018-09-
|
23 |
-
2018-09-
|
24 |
-
2018-09-
|
25 |
-
2018-09-
|
26 |
-
2018-09-
|
27 |
-
2018-09-
|
28 |
-
2018-09-
|
29 |
-
2018-09-
|
30 |
-
2018-09-
|
31 |
-
2018-09-
|
32 |
-
2018-09-
|
33 |
-
2018-09-
|
34 |
-
2018-09-
|
35 |
-
2018-09-
|
36 |
-
2018-09-
|
37 |
-
2018-09-
|
38 |
-
2018-09-
|
39 |
-
2018-09-
|
40 |
-
2018-09-
|
41 |
-
2018-09-
|
42 |
-
2018-09-
|
43 |
-
2018-09-
|
44 |
-
2018-09-
|
45 |
-
2018-09-
|
46 |
-
2018-09-
|
47 |
-
2018-09-
|
48 |
-
2018-09-
|
49 |
-
2018-09-
|
50 |
-
2018-09-
|
51 |
-
2018-09-
|
52 |
-
2018-09-
|
53 |
-
2018-09-
|
54 |
-
2018-09-
|
55 |
-
2018-09-
|
56 |
-
2018-09-
|
57 |
-
2018-09-
|
58 |
-
2018-09-
|
59 |
-
2018-09-
|
60 |
-
2018-09-
|
61 |
-
2018-09-
|
62 |
-
2018-09-
|
63 |
-
2018-09-
|
64 |
-
2018-09-
|
65 |
-
2018-09-
|
66 |
-
2018-09-
|
67 |
-
2018-09-
|
68 |
-
2018-09-
|
69 |
-
2018-09-
|
70 |
-
2018-09-
|
71 |
-
2018-09-
|
72 |
-
2018-09-
|
73 |
-
2018-09-
|
74 |
-
2018-09-
|
75 |
-
2018-09-
|
76 |
-
2018-09-
|
77 |
-
2018-09-
|
78 |
-
2018-09-
|
79 |
-
2018-09-
|
80 |
-
2018-09-
|
81 |
-
2018-09-
|
82 |
-
2018-09-
|
83 |
-
2018-09-
|
84 |
-
2018-09-
|
85 |
-
2018-09-
|
86 |
-
2018-09-
|
87 |
-
2018-09-
|
88 |
-
2018-09-
|
89 |
-
2018-09-
|
90 |
-
2018-09-
|
91 |
-
2018-09-
|
92 |
-
2018-09-
|
93 |
-
2018-09-
|
94 |
-
2018-09-
|
95 |
-
2018-09-
|
96 |
-
2018-09-
|
97 |
-
2018-09-
|
98 |
-
2018-09-
|
99 |
-
2018-09-
|
100 |
-
2018-09-
|
101 |
-
2018-09-
|
102 |
-
2018-09-
|
103 |
-
2018-09-
|
104 |
-
2018-09-
|
105 |
-
2018-09-
|
106 |
-
2018-09-
|
107 |
-
2018-09-
|
108 |
-
2018-09-
|
109 |
-
2018-09-
|
110 |
-
2018-09-
|
111 |
-
2018-09-
|
112 |
-
2018-09-
|
113 |
-
2018-09-
|
114 |
-
2018-09-
|
115 |
-
2018-09-
|
116 |
-
2018-09-
|
117 |
-
2018-09-
|
118 |
-
2018-09-
|
119 |
-
2018-09-
|
120 |
-
2018-09-
|
121 |
-
2018-09-
|
122 |
-
2018-09-
|
123 |
-
2018-09-
|
124 |
-
2018-09-
|
125 |
-
2018-09-
|
126 |
-
2018-09-
|
127 |
-
2018-09-
|
128 |
-
2018-09-
|
129 |
-
2018-09-
|
130 |
-
2018-09-
|
131 |
-
2018-09-
|
132 |
-
2018-09-
|
133 |
-
2018-09-
|
134 |
-
2018-09-
|
135 |
-
2018-09-
|
136 |
-
2018-09-
|
1 |
+
2018-09-25 07:28:50 :- Scanning dependencies
|
2 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/circle.js
|
3 |
+
2018-09-25 07:28:50 :- Found wpgmza-circle
|
4 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza-map-object
|
5 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/compatibility.js
|
6 |
+
2018-09-25 07:28:50 :- Found wpgmza-compatibility
|
7 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza
|
8 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/core.js
|
9 |
+
2018-09-25 07:28:50 :- Found wpgmza
|
10 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/css-escape.js
|
11 |
+
2018-09-25 07:28:50 :- Found wpgmza-wpgmza-css
|
12 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza
|
13 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/distance.js
|
14 |
+
2018-09-25 07:28:50 :- Found wpgmza-distance
|
15 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza
|
16 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/event-dispatcher.js
|
17 |
+
2018-09-25 07:28:50 :- Found wpgmza-event-dispatcher
|
18 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza
|
19 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/event.js
|
20 |
+
2018-09-25 07:28:50 :- Found wpgmza-event
|
21 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza
|
22 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/friendly-error.js
|
23 |
+
2018-09-25 07:28:50 :- Found wpgmza-friendly-error
|
24 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza
|
25 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/geocoder.js
|
26 |
+
2018-09-25 07:28:50 :- Found wpgmza-geocoder
|
27 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza
|
28 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/google-api-error-handler.js
|
29 |
+
2018-09-25 07:28:50 :- Found wpgmza-google-api-error-handler
|
30 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza
|
31 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/info-window.js
|
32 |
+
2018-09-25 07:28:50 :- Found wpgmza-info-window
|
33 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza-event-dispatcher
|
34 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/latlng.js
|
35 |
+
2018-09-25 07:28:50 :- Found wpgmza-lat-lng
|
36 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza
|
37 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/latlngbounds.js
|
38 |
+
2018-09-25 07:28:50 :- Found wpgmza-lat-lng-bounds
|
39 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza
|
40 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/map-object.js
|
41 |
+
2018-09-25 07:28:50 :- Found wpgmza-map-object
|
42 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza-event-dispatcher
|
43 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/map-settings-page.js
|
44 |
+
2018-09-25 07:28:50 :- Found wpgmza-map-settings-page
|
45 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza
|
46 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/map-settings.js
|
47 |
+
2018-09-25 07:28:50 :- Found wpgmza-map-settings
|
48 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza
|
49 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/map.js
|
50 |
+
2018-09-25 07:28:50 :- Found wpgmza-map
|
51 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza-event-dispatcher
|
52 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/maps-engine-dialog.js
|
53 |
+
2018-09-25 07:28:50 :- Found wpgmza-maps-engine-dialog
|
54 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza
|
55 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/marker.js
|
56 |
+
2018-09-25 07:28:50 :- Found wpgmza-marker
|
57 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza
|
58 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/modern-store-locator-circle.js
|
59 |
+
2018-09-25 07:28:50 :- Found wpgmza-modern-store-locator-circle
|
60 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza
|
61 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/modern-store-locator.js
|
62 |
+
2018-09-25 07:28:50 :- Found wpgmza-modern-store-locator
|
63 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza
|
64 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/polygon.js
|
65 |
+
2018-09-25 07:28:50 :- Found wpgmza-polygon
|
66 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza-map-object
|
67 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/polyline.js
|
68 |
+
2018-09-25 07:28:50 :- Found wpgmza-polyline
|
69 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza-map-object
|
70 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/rest-api.js
|
71 |
+
2018-09-25 07:28:50 :- Found wpgmza-wpgmza-rest-api
|
72 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza
|
73 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/v7-custom-script.js
|
74 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/version.js
|
75 |
+
2018-09-25 07:28:50 :- Found wpgmza-version
|
76 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza
|
77 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/compatibility/google-ui-compatibility.js
|
78 |
+
2018-09-25 07:28:50 :- Found wpgmza-google-ui-compatibility
|
79 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza
|
80 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/google-maps/google-circle.js
|
81 |
+
2018-09-25 07:28:50 :- Found wpgmza-google-circle
|
82 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza-circle
|
83 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/google-maps/google-geocoder.js
|
84 |
+
2018-09-25 07:28:50 :- Found wpgmza-google-geocoder
|
85 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza-geocoder
|
86 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/google-maps/google-info-window.js
|
87 |
+
2018-09-25 07:28:50 :- Found wpgmza-google-info-window
|
88 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza-info-window
|
89 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/google-maps/google-map.js
|
90 |
+
2018-09-25 07:28:50 :- Found wpgmza-google-map
|
91 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza-map
|
92 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/google-maps/google-marker.js
|
93 |
+
2018-09-25 07:28:50 :- Found wpgmza-google-marker
|
94 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza-marker
|
95 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/google-maps/google-modern-store-locator-circle.js
|
96 |
+
2018-09-25 07:28:50 :- Found wpgmza-google-modern-store-locator-circle
|
97 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza-modern-store-locator-circle
|
98 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/google-maps/google-modern-store-locator.js
|
99 |
+
2018-09-25 07:28:50 :- Found wpgmza-google-modern-store-locator
|
100 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza-modern-store-locator
|
101 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/google-maps/google-polygon.js
|
102 |
+
2018-09-25 07:28:50 :- Found wpgmza-google-polygon
|
103 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza-polygon
|
104 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/google-maps/google-polyline.js
|
105 |
+
2018-09-25 07:28:50 :- Found wpgmza-google-polyline
|
106 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza-polyline
|
107 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/google-maps/google-vertex-context-menu.js
|
108 |
+
2018-09-25 07:28:50 :- Found wpgmza-google-vertex-context-menu
|
109 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza_api_call
|
110 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/open-layers/ol-circle.js
|
111 |
+
2018-09-25 07:28:50 :- Found wpgmza-ol-circle
|
112 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza-circle
|
113 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/open-layers/ol-geocoder.js
|
114 |
+
2018-09-25 07:28:50 :- Found wpgmza-ol-geocoder
|
115 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza-geocoder
|
116 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/open-layers/ol-info-window.js
|
117 |
+
2018-09-25 07:28:50 :- Found wpgmza-ol-info-window
|
118 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza-info-window
|
119 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/open-layers/ol-map.js
|
120 |
+
2018-09-25 07:28:50 :- Found wpgmza-ol-map
|
121 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza-map
|
122 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/open-layers/ol-marker.js
|
123 |
+
2018-09-25 07:28:50 :- Found wpgmza-ol-marker
|
124 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza-marker
|
125 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/open-layers/ol-modern-store-locator-circle.js
|
126 |
+
2018-09-25 07:28:50 :- Found wpgmza-ol-modern-store-locator-circle
|
127 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza-modern-store-locator-circle
|
128 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/open-layers/ol-modern-store-locator.js
|
129 |
+
2018-09-25 07:28:50 :- Found wpgmza-ol-modern-store-locator
|
130 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza-modern-store-locator
|
131 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/open-layers/ol-polygon.js
|
132 |
+
2018-09-25 07:28:50 :- Found wpgmza-ol-polygon
|
133 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza-polygon
|
134 |
+
2018-09-25 07:28:50 :- Reading E:\Programming\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/open-layers/ol-polyline.js
|
135 |
+
2018-09-25 07:28:50 :- Found wpgmza-ol-polyline
|
136 |
+
2018-09-25 07:28:50 :- Adding dependency wpgmza-polyline
|
js/v8/core.js
CHANGED
@@ -375,8 +375,6 @@ jQuery(function($) {
|
|
375 |
|
376 |
isDeviceiOS: function() {
|
377 |
|
378 |
-
return true;
|
379 |
-
|
380 |
return (
|
381 |
|
382 |
(/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream)
|
375 |
|
376 |
isDeviceiOS: function() {
|
377 |
|
|
|
|
|
378 |
return (
|
379 |
|
380 |
(/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream)
|
js/v8/open-layers/ol-marker.js
CHANGED
@@ -185,7 +185,7 @@ jQuery(function($) {
|
|
185 |
this.trigger({type: "dragend", latLng: latLngAfterDrag});
|
186 |
}
|
187 |
|
188 |
-
WPGMZA.OLMarker.prototype.
|
189 |
{
|
190 |
var self = event.currentTarget.wpgmzaMarker;
|
191 |
|
@@ -202,8 +202,8 @@ jQuery(function($) {
|
|
202 |
*/
|
203 |
WPGMZA.OLMarker.prototype.rebindClickListener = function()
|
204 |
{
|
205 |
-
$(this.element).off("click", this.
|
206 |
-
$(this.element).on("click", this.
|
207 |
}
|
208 |
|
209 |
});
|
185 |
this.trigger({type: "dragend", latLng: latLngAfterDrag});
|
186 |
}
|
187 |
|
188 |
+
WPGMZA.OLMarker.prototype.onElementClick = function(event)
|
189 |
{
|
190 |
var self = event.currentTarget.wpgmzaMarker;
|
191 |
|
202 |
*/
|
203 |
WPGMZA.OLMarker.prototype.rebindClickListener = function()
|
204 |
{
|
205 |
+
$(this.element).off("click", this.onElementClick);
|
206 |
+
$(this.element).on("click", this.onElementClick);
|
207 |
}
|
208 |
|
209 |
});
|
js/v8/wp-google-maps.combined.js
ADDED
@@ -0,0 +1,6262 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
// js/v8/core.js
|
3 |
+
/**
|
4 |
+
* @module WPGMZA
|
5 |
+
* @summary This is the core Javascript module. Some code exists in ../core.js, the functionality there will slowly be handed over to this module.
|
6 |
+
*/
|
7 |
+
jQuery(function($) {
|
8 |
+
var core = {
|
9 |
+
maps: [],
|
10 |
+
events: null,
|
11 |
+
settings: null,
|
12 |
+
|
13 |
+
loadingHTML: '<div class="wpgmza-preloader"><div class="wpgmza-loader">...</div></div>',
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Override this method to add a scroll offset when using animated scroll
|
17 |
+
* @return number
|
18 |
+
*/
|
19 |
+
getScrollAnimationOffset: function() {
|
20 |
+
return (WPGMZA.settings.scroll_animation_offset || 0);
|
21 |
+
},
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Animated scroll, accounts for animation settings and fixed header height
|
25 |
+
* @return void
|
26 |
+
*/
|
27 |
+
animateScroll: function(element, milliseconds) {
|
28 |
+
|
29 |
+
var offset = WPGMZA.getScrollAnimationOffset();
|
30 |
+
|
31 |
+
if(!milliseconds)
|
32 |
+
{
|
33 |
+
if(WPGMZA.settings.scroll_animation_milliseconds)
|
34 |
+
milliseconds = WPGMZA.settings.scroll_animation_milliseconds;
|
35 |
+
else
|
36 |
+
milliseconds = 500;
|
37 |
+
}
|
38 |
+
|
39 |
+
$("html, body").animate({
|
40 |
+
scrollTop: $(element).offset().top - offset
|
41 |
+
}, milliseconds);
|
42 |
+
|
43 |
+
},
|
44 |
+
|
45 |
+
/**
|
46 |
+
* @function guid
|
47 |
+
* @summary Utility function returns a GUID
|
48 |
+
* @static
|
49 |
+
* @return {string} The GUID
|
50 |
+
*/
|
51 |
+
guid: function() { // Public Domain/MIT
|
52 |
+
var d = new Date().getTime();
|
53 |
+
if (typeof performance !== 'undefined' && typeof performance.now === 'function'){
|
54 |
+
d += performance.now(); //use high-precision timer if available
|
55 |
+
}
|
56 |
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
57 |
+
var r = (d + Math.random() * 16) % 16 | 0;
|
58 |
+
d = Math.floor(d / 16);
|
59 |
+
return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);
|
60 |
+
});
|
61 |
+
},
|
62 |
+
|
63 |
+
/**
|
64 |
+
* @function hexOpacityToRGBA
|
65 |
+
* @summary Takes a hex string and opacity value and converts it to Openlayers RGBA format
|
66 |
+
* @param {string} colour The hex color string
|
67 |
+
* @param {number} opacity The opacity from 0.0 - 1.0
|
68 |
+
* @static
|
69 |
+
* @return {array} RGBA where color components are 0 - 255 and opacity is 0.0 - 1.0
|
70 |
+
*/
|
71 |
+
hexOpacityToRGBA: function(colour, opacity)
|
72 |
+
{
|
73 |
+
hex = parseInt(colour.replace(/^#/, ""), 16);
|
74 |
+
return [
|
75 |
+
(hex & 0xFF0000) >> 16,
|
76 |
+
(hex & 0xFF00) >> 8,
|
77 |
+
hex & 0xFF,
|
78 |
+
parseFloat(opacity)
|
79 |
+
];
|
80 |
+
},
|
81 |
+
|
82 |
+
latLngRegexp: /^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$/,
|
83 |
+
|
84 |
+
/**
|
85 |
+
* @function isLatLngString
|
86 |
+
* @summary Utility function returns true is string is a latitude and longitude
|
87 |
+
* @param str {string} The string to attempt to parse as coordinates
|
88 |
+
* @static
|
89 |
+
* @return {array} the matched latitude and longitude or null if no match
|
90 |
+
*/
|
91 |
+
isLatLngString: function(str)
|
92 |
+
{
|
93 |
+
if(typeof str != "string")
|
94 |
+
return null;
|
95 |
+
|
96 |
+
// Remove outer brackets
|
97 |
+
if(str.match(/^\(.+\)$/))
|
98 |
+
str = str.replace(/^\(|\)$/, "");
|
99 |
+
|
100 |
+
var m = str.match(WPGMZA.latLngRegexp);
|
101 |
+
|
102 |
+
if(!m)
|
103 |
+
return null;
|
104 |
+
|
105 |
+
return {
|
106 |
+
lat: parseFloat(m[1]),
|
107 |
+
lng: parseFloat(m[3])
|
108 |
+
};
|
109 |
+
},
|
110 |
+
|
111 |
+
/**
|
112 |
+
* @function stringToLatLng
|
113 |
+
* @summary Utility function returns a latLng literal given a valid latLng string
|
114 |
+
* @param str {string} The string to attempt to parse as coordinates
|
115 |
+
* @static
|
116 |
+
* @return {object} LatLng literal
|
117 |
+
*/
|
118 |
+
stringToLatLng: function(str)
|
119 |
+
{
|
120 |
+
var result = WPGMZA.isLatLngString(str);
|
121 |
+
|
122 |
+
if(!result)
|
123 |
+
throw new Error("Not a valid latLng");
|
124 |
+
|
125 |
+
return result;
|
126 |
+
},
|
127 |
+
|
128 |
+
/**
|
129 |
+
* @function stringToLatLng
|
130 |
+
* @summary Utility function returns a latLng literal given a valid latLng string
|
131 |
+
* @param str {string} The string to attempt to parse as coordinates
|
132 |
+
* @static
|
133 |
+
* @return {object} LatLng literal
|
134 |
+
*/
|
135 |
+
isHexColorString: function(str)
|
136 |
+
{
|
137 |
+
if(typeof str != "string")
|
138 |
+
return false;
|
139 |
+
|
140 |
+
return (str.match(/#[0-9A-F]{6}/i) ? true : false);
|
141 |
+
},
|
142 |
+
|
143 |
+
/**
|
144 |
+
* @function getImageDimensions
|
145 |
+
* @summary Utility function to get the dimensions of an image, caches results for best performance
|
146 |
+
* @param src {string} Image source URL
|
147 |
+
* @param callback {function} Callback to recieve image dimensions
|
148 |
+
* @static
|
149 |
+
* @return {void}
|
150 |
+
*/
|
151 |
+
imageDimensionsCache: {},
|
152 |
+
getImageDimensions: function(src, callback)
|
153 |
+
{
|
154 |
+
if(WPGMZA.imageDimensionsCache[src])
|
155 |
+
{
|
156 |
+
callback(WPGMZA.imageDimensionsCache[src]);
|
157 |
+
return;
|
158 |
+
}
|
159 |
+
|
160 |
+
var img = document.createElement("img");
|
161 |
+
img.onload = function(event) {
|
162 |
+
var result = {
|
163 |
+
width: image.width,
|
164 |
+
height: image.height
|
165 |
+
};
|
166 |
+
WPGMZA.imageDimensionsCache[src] = result;
|
167 |
+
callback(result);
|
168 |
+
};
|
169 |
+
img.src = src;
|
170 |
+
},
|
171 |
+
|
172 |
+
/**
|
173 |
+
* @function isDeveloperMode
|
174 |
+
* @summary Returns true if developer mode is set
|
175 |
+
* @static
|
176 |
+
* @return {boolean} True if developer mode is on
|
177 |
+
*/
|
178 |
+
isDeveloperMode: function()
|
179 |
+
{
|
180 |
+
return this.developer_mode || (window.Cookies && window.Cookies.get("wpgmza-developer-mode"));
|
181 |
+
},
|
182 |
+
|
183 |
+
/**
|
184 |
+
* @function isProVersion
|
185 |
+
* @summary Returns true if the Pro add-on is active
|
186 |
+
* @static
|
187 |
+
* @return {boolean} True if the Pro add-on is active
|
188 |
+
*/
|
189 |
+
isProVersion: function()
|
190 |
+
{
|
191 |
+
return (this._isProVersion == "1");
|
192 |
+
},
|
193 |
+
|
194 |
+
/**
|
195 |
+
* @function openMediaDialog
|
196 |
+
* @summary Opens the WP media dialog and returns the result to a callback
|
197 |
+
* @param {function} callback Callback to recieve the attachment ID as the first parameter and URL as the second
|
198 |
+
* @static
|
199 |
+
* @return {void}
|
200 |
+
*/
|
201 |
+
openMediaDialog: function(callback) {
|
202 |
+
// Media upload
|
203 |
+
var file_frame;
|
204 |
+
|
205 |
+
// If the media frame already exists, reopen it.
|
206 |
+
if ( file_frame ) {
|
207 |
+
// Set the post ID to what we want
|
208 |
+
file_frame.uploader.uploader.param( 'post_id', set_to_post_id );
|
209 |
+
// Open frame
|
210 |
+
file_frame.open();
|
211 |
+
return;
|
212 |
+
}
|
213 |
+
|
214 |
+
// Create the media frame.
|
215 |
+
file_frame = wp.media.frames.file_frame = wp.media({
|
216 |
+
title: 'Select a image to upload',
|
217 |
+
button: {
|
218 |
+
text: 'Use this image',
|
219 |
+
},
|
220 |
+
multiple: false // Set to true to allow multiple files to be selected
|
221 |
+
});
|
222 |
+
|
223 |
+
// When an image is selected, run a callback.
|
224 |
+
file_frame.on( 'select', function() {
|
225 |
+
// We set multiple to false so only get one image from the uploader
|
226 |
+
attachment = file_frame.state().get('selection').first().toJSON();
|
227 |
+
|
228 |
+
callback(attachment.id, attachment.url);
|
229 |
+
});
|
230 |
+
|
231 |
+
// Finally, open the modal
|
232 |
+
file_frame.open();
|
233 |
+
},
|
234 |
+
|
235 |
+
/**
|
236 |
+
* @function getCurrentPosition
|
237 |
+
* @summary This function will get the users position, it first attempts to get
|
238 |
+
* high accuracy position (mobile with GPS sensors etc.), if that fails
|
239 |
+
* (desktops will time out) then it tries again without high accuracy
|
240 |
+
* enabled
|
241 |
+
* @static
|
242 |
+
* @return {object} The users position as a LatLng literal
|
243 |
+
*/
|
244 |
+
getCurrentPosition: function(callback)
|
245 |
+
{
|
246 |
+
if(!navigator.geolocation)
|
247 |
+
{
|
248 |
+
console.warn("No geolocation available on this device");
|
249 |
+
return;
|
250 |
+
}
|
251 |
+
|
252 |
+
var options = {
|
253 |
+
enableHighAccuracy: true
|
254 |
+
};
|
255 |
+
|
256 |
+
navigator.geolocation.getCurrentPosition(function(position) {
|
257 |
+
if(callback)
|
258 |
+
callback(position);
|
259 |
+
|
260 |
+
WPGMZA.events.trigger("userlocationfound");
|
261 |
+
},
|
262 |
+
function(error) {
|
263 |
+
|
264 |
+
options.enableHighAccuracy = false;
|
265 |
+
|
266 |
+
navigator.geolocation.getCurrentPosition(function(position) {
|
267 |
+
if(callback)
|
268 |
+
callback(position);
|
269 |
+
|
270 |
+
WPGMZA.events.trigger("userlocationfound");
|
271 |
+
},
|
272 |
+
function(error) {
|
273 |
+
console.warn(error.code, error.message);
|
274 |
+
},
|
275 |
+
options);
|
276 |
+
|
277 |
+
},
|
278 |
+
options);
|
279 |
+
},
|
280 |
+
|
281 |
+
/**
|
282 |
+
* @function runCatchableTask
|
283 |
+
* @summary Runs a catchable task and displays a friendly error if the function throws an error
|
284 |
+
* @param {function} callback The function to run
|
285 |
+
* @param {HTMLElement} friendlyErrorContainer The container element to hold the error
|
286 |
+
* @static
|
287 |
+
* @return {void}
|
288 |
+
*/
|
289 |
+
runCatchableTask: function(callback, friendlyErrorContainer) {
|
290 |
+
|
291 |
+
if(WPGMZA.isDeveloperMode())
|
292 |
+
callback();
|
293 |
+
else
|
294 |
+
try{
|
295 |
+
callback();
|
296 |
+
}catch(e) {
|
297 |
+
var friendlyError = new WPGMZA.FriendlyError(e);
|
298 |
+
$(friendlyErrorContainer).html("");
|
299 |
+
$(friendlyErrorContainer).append(friendlyError.element);
|
300 |
+
$(friendlyErrorContainer).show();
|
301 |
+
}
|
302 |
+
},
|
303 |
+
|
304 |
+
/**
|
305 |
+
* @function assertInstanceOf
|
306 |
+
* @summary
|
307 |
+
* This function is for checking inheritence has been setup correctly.
|
308 |
+
* For objects that have engine and Pro specific classes, it will automatically
|
309 |
+
* add the engine and pro prefix to the supplied string and if such an object
|
310 |
+
* exists it will test against that name rather than the un-prefix argument
|
311 |
+
* supplied.
|
312 |
+
*
|
313 |
+
* For example, if we are running the Pro addon with Google maps as the engine,
|
314 |
+
* if you supply Marker as the instance name the function will check to see
|
315 |
+
* if instance is an instance of GoogleProMarker
|
316 |
+
* @param {object} instance The object to check
|
317 |
+
* @param {string} instanceName The class name as a string which this object should be an instance of
|
318 |
+
* @static
|
319 |
+
* @return {void}
|
320 |
+
*/
|
321 |
+
assertInstanceOf: function(instance, instanceName) {
|
322 |
+
var engine, fullInstanceName, assert;
|
323 |
+
var pro = WPGMZA.isProVersion() ? "Pro" : "";
|
324 |
+
|
325 |
+
switch(WPGMZA.settings.engine)
|
326 |
+
{
|
327 |
+
case "open-layers":
|
328 |
+
engine = "OL";
|
329 |
+
break;
|
330 |
+
|
331 |
+
default:
|
332 |
+
engine = "Google";
|
333 |
+
break;
|
334 |
+
}
|
335 |
+
|
336 |
+
if(WPGMZA[engine + pro + instanceName])
|
337 |
+
fullInstanceName = engine + pro + instanceName;
|
338 |
+
else if(WPGMZA[pro + instanceName])
|
339 |
+
fullInstanceName = pro + instanceName;
|
340 |
+
else if(WPGMZA[engine + instanceName])
|
341 |
+
fullInstanceName = engine + instanceName;
|
342 |
+
else
|
343 |
+
fullInstanceName = instanceName;
|
344 |
+
|
345 |
+
assert = instance instanceof WPGMZA[fullInstanceName];
|
346 |
+
|
347 |
+
if(!assert)
|
348 |
+
throw new Error("Object must be an instance of " + fullInstanceName + " (did you call a constructor directly, rather than createInstance?)");
|
349 |
+
},
|
350 |
+
|
351 |
+
/**
|
352 |
+
* @function getMapByID
|
353 |
+
* @param {mixed} id The ID of the map to retrieve
|
354 |
+
* @static
|
355 |
+
* @return {object} The map object, or null if no such map exists
|
356 |
+
*/
|
357 |
+
getMapByID: function(id) {
|
358 |
+
for(var i = 0; i < WPGMZA.maps.length; i++) {
|
359 |
+
if(WPGMZA.maps[i].id == id)
|
360 |
+
return WPGMZA.maps[i];
|
361 |
+
}
|
362 |
+
|
363 |
+
return null;
|
364 |
+
},
|
365 |
+
|
366 |
+
/**
|
367 |
+
* @function isGoogleAutocompleteSupported
|
368 |
+
* @summary Shorthand function to determine if the Places Autocomplete is available
|
369 |
+
* @static
|
370 |
+
* @return {boolean}
|
371 |
+
*/
|
372 |
+
isGoogleAutocompleteSupported: function() {
|
373 |
+
return typeof google === 'object' && typeof google.maps === 'object' && typeof google.maps.places === 'object' && typeof google.maps.places.Autocomplete === 'function';
|
374 |
+
},
|
375 |
+
|
376 |
+
googleAPIStatus: window.wpgmza_google_api_status,
|
377 |
+
|
378 |
+
isDeviceiOS: function() {
|
379 |
+
|
380 |
+
return (
|
381 |
+
|
382 |
+
(/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream)
|
383 |
+
|
384 |
+
||
|
385 |
+
|
386 |
+
(!!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform))
|
387 |
+
|
388 |
+
);
|
389 |
+
|
390 |
+
}
|
391 |
+
};
|
392 |
+
|
393 |
+
if(window.WPGMZA)
|
394 |
+
window.WPGMZA = $.extend(window.WPGMZA, core);
|
395 |
+
else
|
396 |
+
window.WPGMZA = core;
|
397 |
+
|
398 |
+
for(var key in WPGMZA_localized_data)
|
399 |
+
{
|
400 |
+
var value = WPGMZA_localized_data[key];
|
401 |
+
WPGMZA[key] = value;
|
402 |
+
}
|
403 |
+
|
404 |
+
jQuery(function($) {
|
405 |
+
|
406 |
+
// Combined script warning
|
407 |
+
if($("script[src*='wp-google-maps.combined.js'], script[src*='wp-google-maps-pro.combined.js']").length)
|
408 |
+
console.warn("Minified script is out of date, using combined script instead.");
|
409 |
+
|
410 |
+
// Check for multiple jQuery versions
|
411 |
+
var elements = $("script").filter(function() {
|
412 |
+
return this.src.match(/(^|\/)jquery\.(min\.)?js(\?|$)/i);
|
413 |
+
});
|
414 |
+
|
415 |
+
if(elements.length > 1)
|
416 |
+
console.warn("Multiple jQuery versions detected: ", elements);
|
417 |
+
|
418 |
+
// Rest API
|
419 |
+
WPGMZA.restAPI = WPGMZA.RestAPI.createInstance();
|
420 |
+
|
421 |
+
// TODO: Move to map edit page JS
|
422 |
+
$(document).on("click", ".wpgmza_edit_btn", function() {
|
423 |
+
|
424 |
+
WPGMZA.animateScroll("#wpgmaps_tabs_markers");
|
425 |
+
|
426 |
+
});
|
427 |
+
|
428 |
+
});
|
429 |
+
|
430 |
+
$(window).on("load", function(event) {
|
431 |
+
|
432 |
+
// Geolocation warnings
|
433 |
+
if(window.location.protocol != 'https:')
|
434 |
+
{
|
435 |
+
var warning = '<div class="notice notice-warning"><p>' + WPGMZA.localized_strings.unsecure_geolocation + "</p></div>";
|
436 |
+
|
437 |
+
$(".wpgmza-geolocation-setting").each(function(index, el) {
|
438 |
+
$(el).after( $(warning) );
|
439 |
+
});
|
440 |
+
}
|
441 |
+
|
442 |
+
});
|
443 |
+
|
444 |
+
|
445 |
+
|
446 |
+
});
|
447 |
+
|
448 |
+
// js/v8/compatibility.js
|
449 |
+
/**
|
450 |
+
* @namespace WPGMZA
|
451 |
+
* @module Compatibility
|
452 |
+
* @requires WPGMZA
|
453 |
+
*/
|
454 |
+
jQuery(function($) {
|
455 |
+
|
456 |
+
WPGMZA.Compatibility = function()
|
457 |
+
{
|
458 |
+
this.preventDocumentWriteGoogleMapsAPI();
|
459 |
+
}
|
460 |
+
|
461 |
+
WPGMZA.Compatibility.prototype.preventDocumentWriteGoogleMapsAPI = function()
|
462 |
+
{
|
463 |
+
var old = document.write;
|
464 |
+
|
465 |
+
document.write = function(content)
|
466 |
+
{
|
467 |
+
if(content.match && content.match(/maps\.google/))
|
468 |
+
return;
|
469 |
+
|
470 |
+
old.call(document, content);
|
471 |
+
}
|
472 |
+
}
|
473 |
+
|
474 |
+
WPGMZA.compatiblityModule = new WPGMZA.Compatibility();
|
475 |
+
|
476 |
+
});
|
477 |
+
|
478 |
+
// js/v8/css-escape.js
|
479 |
+
/**
|
480 |
+
* @module WPGMZA.CSS
|
481 |
+
* @namespace WPGMZA
|
482 |
+
* @requires WPGMZA
|
483 |
+
* @summary Polyfill for CSS.escape, with thanks to @mathias
|
484 |
+
*/
|
485 |
+
|
486 |
+
/*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */
|
487 |
+
;(function(root, factory) {
|
488 |
+
// https://github.com/umdjs/umd/blob/master/returnExports.js
|
489 |
+
if (typeof exports == 'object') {
|
490 |
+
// For Node.js.
|
491 |
+
module.exports = factory(root);
|
492 |
+
} else if (typeof define == 'function' && define.amd) {
|
493 |
+
// For AMD. Register as an anonymous module.
|
494 |
+
define([], factory.bind(root, root));
|
495 |
+
} else {
|
496 |
+
// For browser globals (not exposing the function separately).
|
497 |
+
factory(root);
|
498 |
+
}
|
499 |
+
}(typeof global != 'undefined' ? global : this, function(root) {
|
500 |
+
|
501 |
+
if (root.CSS && root.CSS.escape) {
|
502 |
+
return root.CSS.escape;
|
503 |
+
}
|
504 |
+
|
505 |
+
// https://drafts.csswg.org/cssom/#serialize-an-identifier
|
506 |
+
var cssEscape = function(value) {
|
507 |
+
if (arguments.length == 0) {
|
508 |
+
throw new TypeError('`CSS.escape` requires an argument.');
|
509 |
+
}
|
510 |
+
var string = String(value);
|
511 |
+
var length = string.length;
|
512 |
+
var index = -1;
|
513 |
+
var codeUnit;
|
514 |
+
var result = '';
|
515 |
+
var firstCodeUnit = string.charCodeAt(0);
|
516 |
+
while (++index < length) {
|
517 |
+
codeUnit = string.charCodeAt(index);
|
518 |
+
// Note: there’s no need to special-case astral symbols, surrogate
|
519 |
+
// pairs, or lone surrogates.
|
520 |
+
|
521 |
+
// If the character is NULL (U+0000), then the REPLACEMENT CHARACTER
|
522 |
+
// (U+FFFD).
|
523 |
+
if (codeUnit == 0x0000) {
|
524 |
+
result += '\uFFFD';
|
525 |
+
continue;
|
526 |
+
}
|
527 |
+
|
528 |
+
if (
|
529 |
+
// If the character is in the range [\1-\1F] (U+0001 to U+001F) or is
|
530 |
+
// U+007F, […]
|
531 |
+
(codeUnit >= 0x0001 && codeUnit <= 0x001F) || codeUnit == 0x007F ||
|
532 |
+
// If the character is the first character and is in the range [0-9]
|
533 |
+
// (U+0030 to U+0039), […]
|
534 |
+
(index == 0 && codeUnit >= 0x0030 && codeUnit <= 0x0039) ||
|
535 |
+
// If the character is the second character and is in the range [0-9]
|
536 |
+
// (U+0030 to U+0039) and the first character is a `-` (U+002D), […]
|
537 |
+
(
|
538 |
+
index == 1 &&
|
539 |
+
codeUnit >= 0x0030 && codeUnit <= 0x0039 &&
|
540 |
+
firstCodeUnit == 0x002D
|
541 |
+
)
|
542 |
+
) {
|
543 |
+
// https://drafts.csswg.org/cssom/#escape-a-character-as-code-point
|
544 |
+
result += '\\' + codeUnit.toString(16) + ' ';
|
545 |
+
continue;
|
546 |
+
}
|
547 |
+
|
548 |
+
if (
|
549 |
+
// If the character is the first character and is a `-` (U+002D), and
|
550 |
+
// there is no second character, […]
|
551 |
+
index == 0 &&
|
552 |
+
length == 1 &&
|
553 |
+
codeUnit == 0x002D
|
554 |
+
) {
|
555 |
+
result += '\\' + string.charAt(index);
|
556 |
+
continue;
|
557 |
+
}
|
558 |
+
|
559 |
+
// If the character is not handled by one of the above rules and is
|
560 |
+
// greater than or equal to U+0080, is `-` (U+002D) or `_` (U+005F), or
|
561 |
+
// is in one of the ranges [0-9] (U+0030 to U+0039), [A-Z] (U+0041 to
|
562 |
+
// U+005A), or [a-z] (U+0061 to U+007A), […]
|
563 |
+
if (
|
564 |
+
codeUnit >= 0x0080 ||
|
565 |
+
codeUnit == 0x002D ||
|
566 |
+
codeUnit == 0x005F ||
|
567 |
+
codeUnit >= 0x0030 && codeUnit <= 0x0039 ||
|
568 |
+
codeUnit >= 0x0041 && codeUnit <= 0x005A ||
|
569 |
+
codeUnit >= 0x0061 && codeUnit <= 0x007A
|
570 |
+
) {
|
571 |
+
// the character itself
|
572 |
+
result += string.charAt(index);
|
573 |
+
continue;
|
574 |
+
}
|
575 |
+
|
576 |
+
// Otherwise, the escaped character.
|
577 |
+
// https://drafts.csswg.org/cssom/#escape-a-character
|
578 |
+
result += '\\' + string.charAt(index);
|
579 |
+
|
580 |
+
}
|
581 |
+
return result;
|
582 |
+
};
|
583 |
+
|
584 |
+
if (!root.CSS) {
|
585 |
+
root.CSS = {};
|
586 |
+
}
|
587 |
+
|
588 |
+
root.CSS.escape = cssEscape;
|
589 |
+
return cssEscape;
|
590 |
+
|
591 |
+
}));
|
592 |
+
|
593 |
+
// js/v8/distance.js
|
594 |
+
/**
|
595 |
+
* @namespace WPGMZA
|
596 |
+
* @module Distance
|
597 |
+
* @requires WPGMZA
|
598 |
+
*/
|
599 |
+
jQuery(function($) {
|
600 |
+
|
601 |
+
WPGMZA.Distance = {
|
602 |
+
|
603 |
+
MILES: true,
|
604 |
+
KILOMETERS: false,
|
605 |
+
|
606 |
+
MILES_PER_KILOMETER: 0.621371,
|
607 |
+
KILOMETERS_PER_MILE: 1.60934,
|
608 |
+
|
609 |
+
// TODO: Implement WPGMZA.settings.distance_units
|
610 |
+
|
611 |
+
/**
|
612 |
+
* Converts a UI distance (eg from a form control) to meters,
|
613 |
+
* accounting for the global units setting
|
614 |
+
*/
|
615 |
+
uiToMeters: function(uiDistance)
|
616 |
+
{
|
617 |
+
return parseFloat(uiDistance) / (WPGMZA.settings.distance_units == WPGMZA.Distance.MILES ? WPGMZA.Distance.MILES_PER_KILOMETER : 1) * 1000;
|
618 |
+
},
|
619 |
+
|
620 |
+
/**
|
621 |
+
* Converts a UI distance (eg from a form control) to kilometers,
|
622 |
+
* accounting for the global units setting
|
623 |
+
*/
|
624 |
+
uiToKilometers: function(uiDistance)
|
625 |
+
{
|
626 |
+
return WPGMZA.Distance.uiToMeters(uiDistance) * 0.001;
|
627 |
+
},
|
628 |
+
|
629 |
+
/**
|
630 |
+
* Converts a UI distance (eg from a form control) to miles,
|
631 |
+
* accounting for the global units setting
|
632 |
+
*/
|
633 |
+
uiToMiles: function(uiDistance)
|
634 |
+
{
|
635 |
+
return WPGMZA.Distance.uiToKilometers(uiDistance) * WPGMZA.Distance.MILES_PER_KILOMETER;
|
636 |
+
},
|
637 |
+
|
638 |
+
kilometersToUI: function(km)
|
639 |
+
{
|
640 |
+
if(WPGMZA.settings.distance_units == WPGMZA.Distance.MILES)
|
641 |
+
return km * WPGMZA.Distance.MILES_PER_KILOMETER;
|
642 |
+
return km;
|
643 |
+
}
|
644 |
+
|
645 |
+
};
|
646 |
+
|
647 |
+
});
|
648 |
+
|
649 |
+
// js/v8/event-dispatcher.js
|
650 |
+
/**
|
651 |
+
* @namespace WPGMZA
|
652 |
+
* @module EventDispatcher
|
653 |
+
* @requires WPGMZA
|
654 |
+
*/
|
655 |
+
jQuery(function($) {
|
656 |
+
|
657 |
+
WPGMZA.EventDispatcher = function()
|
658 |
+
{
|
659 |
+
WPGMZA.assertInstanceOf(this, "EventDispatcher");
|
660 |
+
|
661 |
+
this._listenersByType = [];
|
662 |
+
}
|
663 |
+
|
664 |
+
WPGMZA.EventDispatcher.prototype.addEventListener = function(type, listener, thisObject, useCapture)
|
665 |
+
{
|
666 |
+
var arr;
|
667 |
+
|
668 |
+
var types = type.split(/\s+/);
|
669 |
+
if(types.length > 1)
|
670 |
+
{
|
671 |
+
for(var i = 0; i < types.length; i++)
|
672 |
+
this.addEventListener(types[i], listener, thisObject, useCapture);
|
673 |
+
|
674 |
+
return;
|
675 |
+
}
|
676 |
+
|
677 |
+
if(!(listener instanceof Function))
|
678 |
+
throw new Error("Listener must be a function");
|
679 |
+
|
680 |
+
if(!(arr = this._listenersByType[type]))
|
681 |
+
arr = this._listenersByType[type] = [];
|
682 |
+
|
683 |
+
var obj = {
|
684 |
+
listener: listener,
|
685 |
+
thisObject: (thisObject ? thisObject : this),
|
686 |
+
useCapture: (useCapture ? true : false)
|
687 |
+
};
|
688 |
+
|
689 |
+
arr.push(obj);
|
690 |
+
}
|
691 |
+
|
692 |
+
WPGMZA.EventDispatcher.prototype.on = WPGMZA.EventDispatcher.prototype.addEventListener;
|
693 |
+
|
694 |
+
WPGMZA.EventDispatcher.prototype.removeEventListener = function(type, listener, thisObject, useCapture)
|
695 |
+
{
|
696 |
+
var arr, index, obj;
|
697 |
+
|
698 |
+
if(!(arr = this._listenersByType[type]))
|
699 |
+
return;
|
700 |
+
|
701 |
+
if(!thisObject)
|
702 |
+
thisObject = this;
|
703 |
+
|
704 |
+
useCapture = (useCapture ? true : false);
|
705 |
+
|
706 |
+
for(var i = 0; i < arr.length; i++)
|
707 |
+
{
|
708 |
+
obj = arr[i];
|
709 |
+
|
710 |
+
if(obj.listener == listener && obj.thisObject == thisObject && obj.useCapture == useCapture)
|
711 |
+
{
|
712 |
+
arr.splice(i, 1);
|
713 |
+
return;
|
714 |
+
}
|
715 |
+
}
|
716 |
+
}
|
717 |
+
|
718 |
+
WPGMZA.EventDispatcher.prototype.off = WPGMZA.EventDispatcher.prototype.removeEventListener;
|
719 |
+
|
720 |
+
WPGMZA.EventDispatcher.prototype.hasEventListener = function(type)
|
721 |
+
{
|
722 |
+
return (_listenersByType[type] ? true : false);
|
723 |
+
}
|
724 |
+
|
725 |
+
WPGMZA.EventDispatcher.prototype.dispatchEvent = function(event)
|
726 |
+
{
|
727 |
+
if(!(event instanceof WPGMZA.Event))
|
728 |
+
{
|
729 |
+
if(typeof event == "string")
|
730 |
+
event = new WPGMZA.Event(event);
|
731 |
+
else
|
732 |
+
{
|
733 |
+
var src = event;
|
734 |
+
event = new WPGMZA.Event();
|
735 |
+
for(var name in src)
|
736 |
+
event[name] = src[name];
|
737 |
+
}
|
738 |
+
}
|
739 |
+
|
740 |
+
event.target = this;
|
741 |
+
|
742 |
+
var path = [];
|
743 |
+
for(var obj = this.parent; obj != null; obj = obj.parent)
|
744 |
+
path.unshift(obj);
|
745 |
+
|
746 |
+
event.phase = WPGMZA.Event.CAPTURING_PHASE;
|
747 |
+
for(var i = 0; i < path.length && !event._cancelled; i++)
|
748 |
+
path[i]._triggerListeners(event);
|
749 |
+
|
750 |
+
if(event._cancelled)
|
751 |
+
return;
|
752 |
+
|
753 |
+
event.phase = WPGMZA.Event.AT_TARGET;
|
754 |
+
this._triggerListeners(event);
|
755 |
+
|
756 |
+
event.phase = WPGMZA.Event.BUBBLING_PHASE;
|
757 |
+
for(i = path.length - 1; i >= 0 && !event._cancelled; i--)
|
758 |
+
path[i]._triggerListeners(event);
|
759 |
+
|
760 |
+
if(this.element)
|
761 |
+
{
|
762 |
+
var customEvent = {};
|
763 |
+
|
764 |
+
for(var key in event)
|
765 |
+
{
|
766 |
+
var value = event[key];
|
767 |
+
|
768 |
+
if(key == "type")
|
769 |
+
value += ".wpgmza";
|
770 |
+
|
771 |
+
customEvent[key] = value;
|
772 |
+
}
|
773 |
+
|
774 |
+
$(this.element).trigger(customEvent);
|
775 |
+
}
|
776 |
+
}
|
777 |
+
|
778 |
+
WPGMZA.EventDispatcher.prototype.trigger = WPGMZA.EventDispatcher.prototype.dispatchEvent;
|
779 |
+
|
780 |
+
WPGMZA.EventDispatcher.prototype._triggerListeners = function(event)
|
781 |
+
{
|
782 |
+
var arr, obj;
|
783 |
+
|
784 |
+
if(!(arr = this._listenersByType[event.type]))
|
785 |
+
return;
|
786 |
+
|
787 |
+
for(var i = 0; i < arr.length; i++)
|
788 |
+
{
|
789 |
+
obj = arr[i];
|
790 |
+
|
791 |
+
if(event.phase == WPGMZA.Event.CAPTURING_PHASE && !obj.useCapture)
|
792 |
+
continue;
|
793 |
+
|
794 |
+
obj.listener.call(arr[i].thisObject, event);
|
795 |
+
}
|
796 |
+
}
|
797 |
+
|
798 |
+
WPGMZA.events = new WPGMZA.EventDispatcher();
|
799 |
+
|
800 |
+
});
|
801 |
+
|
802 |
+
// js/v8/event.js
|
803 |
+
/**
|
804 |
+
* @namespace WPGMZA
|
805 |
+
* @module Event
|
806 |
+
* @requires WPGMZA
|
807 |
+
*/
|
808 |
+
jQuery(function($) {
|
809 |
+
|
810 |
+
WPGMZA.Event = function(options)
|
811 |
+
{
|
812 |
+
if(typeof options == "string")
|
813 |
+
this.type = options;
|
814 |
+
|
815 |
+
this.bubbles = true;
|
816 |
+
this.cancelable = true;
|
817 |
+
this.phase = WPGMZA.Event.PHASE_CAPTURE;
|
818 |
+
this.target = null;
|
819 |
+
|
820 |
+
this._cancelled = false;
|
821 |
+
|
822 |
+
if(typeof options == "object")
|
823 |
+
for(var name in options)
|
824 |
+
this[name] = options[name];
|
825 |
+
}
|
826 |
+
|
827 |
+
WPGMZA.Event.CAPTURING_PHASE = 0;
|
828 |
+
WPGMZA.Event.AT_TARGET = 1;
|
829 |
+
WPGMZA.Event.BUBBLING_PHASE = 2;
|
830 |
+
|
831 |
+
WPGMZA.Event.prototype.stopPropagation = function()
|
832 |
+
{
|
833 |
+
this._cancelled = true;
|
834 |
+
}
|
835 |
+
|
836 |
+
});
|
837 |
+
|
838 |
+
// js/v8/friendly-error.js
|
839 |
+
/**
|
840 |
+
* @namespace WPGMZA
|
841 |
+
* @module FriendlyError
|
842 |
+
* @requires WPGMZA
|
843 |
+
*/
|
844 |
+
jQuery(function($) {
|
845 |
+
|
846 |
+
/*var template = '\
|
847 |
+
<div class="notice notice-error"> \
|
848 |
+
<p> \
|
849 |
+
' + WPGMZA.localized_strings.friendly_error + ' \
|
850 |
+
</p> \
|
851 |
+
<pre style="white-space: pre-line;"></pre> \
|
852 |
+
<div> \
|
853 |
+
';
|
854 |
+
|
855 |
+
WPGMZA.FriendlyError = function(nativeError)
|
856 |
+
{
|
857 |
+
if(!WPGMZA.is_admin)
|
858 |
+
{
|
859 |
+
this.element = $(WPGMZA.preloaderHTML);
|
860 |
+
$(this.element).removeClass("animated");
|
861 |
+
return;
|
862 |
+
}
|
863 |
+
|
864 |
+
$("#wpgmza-map-edit-page>.wpgmza-preloader").remove();
|
865 |
+
|
866 |
+
this.element = $(template);
|
867 |
+
this.element.find("pre").html(nativeError.message + "\r\n" + nativeError.stack + "\r\n\r\n on " + window.location.href);
|
868 |
+
}*/
|
869 |
+
|
870 |
+
});
|
871 |
+
|
872 |
+
// js/v8/geocoder.js
|
873 |
+
/**
|
874 |
+
* @namespace WPGMZA
|
875 |
+
* @module Geocoder
|
876 |
+
* @requires WPGMZA
|
877 |
+
*/
|
878 |
+
jQuery(function($) {
|
879 |
+
|
880 |
+
WPGMZA.Geocoder = function()
|
881 |
+
{
|
882 |
+
WPGMZA.assertInstanceOf(this, "Geocoder");
|
883 |
+
}
|
884 |
+
|
885 |
+
WPGMZA.Geocoder.SUCCESS = "success";
|
886 |
+
WPGMZA.Geocoder.ZERO_RESULTS = "zero-results";
|
887 |
+
WPGMZA.Geocoder.FAIL = "fail";
|
888 |
+
|
889 |
+
WPGMZA.Geocoder.getConstructor = function()
|
890 |
+
{
|
891 |
+
switch(WPGMZA.settings.engine)
|
892 |
+
{
|
893 |
+
case "open-layers":
|
894 |
+
return WPGMZA.OLGeocoder;
|
895 |
+
break;
|
896 |
+
|
897 |
+
default:
|
898 |
+
return WPGMZA.GoogleGeocoder;
|
899 |
+
break;
|
900 |
+
}
|
901 |
+
}
|
902 |
+
|
903 |
+
WPGMZA.Geocoder.createInstance = function()
|
904 |
+
{
|
905 |
+
var constructor = WPGMZA.Geocoder.getConstructor();
|
906 |
+
return new constructor();
|
907 |
+
}
|
908 |
+
|
909 |
+
WPGMZA.Geocoder.prototype.getLatLngFromAddress = function(options, callback)
|
910 |
+
{
|
911 |
+
if(WPGMZA.isLatLngString(options.address))
|
912 |
+
{
|
913 |
+
var parts = options.address.split(/,\s*/);
|
914 |
+
var latLng = new WPGMZA.LatLng({
|
915 |
+
lat: parseFloat(parts[0]),
|
916 |
+
lng: parseFloat(parts[1])
|
917 |
+
});
|
918 |
+
callback([latLng], WPGMZA.Geocoder.SUCCESS);
|
919 |
+
}
|
920 |
+
}
|
921 |
+
|
922 |
+
WPGMZA.Geocoder.prototype.getAddressFromLatLng = function(options, callback)
|
923 |
+
{
|
924 |
+
var latLng = new WPGMZA.LatLng(options.latLng);
|
925 |
+
callback([latLng.toString()], WPGMZA.Geocoder.SUCCESS);
|
926 |
+
}
|
927 |
+
|
928 |
+
WPGMZA.Geocoder.prototype.geocode = function(options, callback)
|
929 |
+
{
|
930 |
+
if("address" in options)
|
931 |
+
return this.getLatLngFromAddress(options, callback);
|
932 |
+
else if("latLng" in options)
|
933 |
+
return this.getAddressFromLatLng(options, callback);
|
934 |
+
|
935 |
+
throw new Error("You must supply either a latLng or address");
|
936 |
+
}
|
937 |
+
|
938 |
+
});
|
939 |
+
|
940 |
+
// js/v8/google-api-error-handler.js
|
941 |
+
/**
|
942 |
+
* @namespace WPGMZA
|
943 |
+
* @module GoogleAPIErrorHandler
|
944 |
+
* @requires WPGMZA
|
945 |
+
*/
|
946 |
+
jQuery(function($) {
|
947 |
+
|
948 |
+
WPGMZA.GoogleAPIErrorHandler = function() {
|
949 |
+
|
950 |
+
var self = this;
|
951 |
+
|
952 |
+
// Don't do anything if Google isn't the selected API
|
953 |
+
if(WPGMZA.settings.engine != "google-maps")
|
954 |
+
return;
|
955 |
+
|
956 |
+
// Only allow on the map edit page, or front end if user has administrator role
|
957 |
+
if(!(WPGMZA.currentPage == "map-edit" || (WPGMZA.is_admin == 0 && WPGMZA.userCanAdministrator == 1)))
|
958 |
+
return;
|
959 |
+
|
960 |
+
this.element = $(WPGMZA.html.googleMapsAPIErrorDialog);
|
961 |
+
|
962 |
+
if(WPGMZA.is_admin == 1)
|
963 |
+
this.element.find(".wpgmza-front-end-only").remove();
|
964 |
+
|
965 |
+
this.errorMessageList = this.element.find("#wpgmza-google-api-error-list");
|
966 |
+
this.templateListItem = this.element.find("li.template").remove();
|
967 |
+
|
968 |
+
this.messagesAlreadyDisplayed = {};
|
969 |
+
|
970 |
+
if(WPGMZA.settings.developer_mode)
|
971 |
+
return;
|
972 |
+
|
973 |
+
// Override error function
|
974 |
+
var _error = console.error;
|
975 |
+
|
976 |
+
console.error = function(message)
|
977 |
+
{
|
978 |
+
self.onErrorMessage(message);
|
979 |
+
|
980 |
+
_error.apply(this, arguments);
|
981 |
+
}
|
982 |
+
}
|
983 |
+
|
984 |
+
WPGMZA.GoogleAPIErrorHandler.prototype.onErrorMessage = function(message)
|
985 |
+
{
|
986 |
+
var m;
|
987 |
+
var regexURL = /http(s)?:\/\/[^\s]+/gm;
|
988 |
+
|
989 |
+
if((m = message.match(/You have exceeded your (daily )?request quota for this API/)) || (m = message.match(/This API project is not authorized to use this API/)))
|
990 |
+
{
|
991 |
+
var urls = message.match(regexURL);
|
992 |
+
this.addErrorMessage(m[0], urls);
|
993 |
+
}
|
994 |
+
else if(m = message.match(/^Google Maps.+error: (.+)\s+(http(s?):\/\/.+)/m))
|
995 |
+
{
|
996 |
+
this.addErrorMessage(m[1].replace(/([A-Z])/g, " $1"), [m[2]]);
|
997 |
+
}
|
998 |
+
}
|
999 |
+
|
1000 |
+
WPGMZA.GoogleAPIErrorHandler.prototype.addErrorMessage = function(message, urls)
|
1001 |
+
{
|
1002 |
+
if(this.messagesAlreadyDisplayed[message])
|
1003 |
+
return;
|
1004 |
+
|
1005 |
+
var li = this.templateListItem.clone();
|
1006 |
+
$(li).find(".wpgmza-message").html(message);
|
1007 |
+
|
1008 |
+
var buttonContainer = $(li).find(".wpgmza-documentation-buttons");
|
1009 |
+
|
1010 |
+
var buttonTemplate = $(li).find(".wpgmza-documentation-buttons>a");
|
1011 |
+
buttonTemplate.remove();
|
1012 |
+
|
1013 |
+
if(urls && urls.length)
|
1014 |
+
{
|
1015 |
+
for(var i = 0; i < urls.length; i++)
|
1016 |
+
{
|
1017 |
+
var url = urls[i];
|
1018 |
+
var button = buttonTemplate.clone();
|
1019 |
+
var icon = "fa-external-link";
|
1020 |
+
var text = WPGMZA.localized_strings.documentation;
|
1021 |
+
|
1022 |
+
button.attr("href", urls[i]);
|
1023 |
+
|
1024 |
+
if(url.match(/google.+documentation/))
|
1025 |
+
{
|
1026 |
+
icon = "fa-google";
|
1027 |
+
}
|
1028 |
+
else if(url.match(/maps-no-account/))
|
1029 |
+
{
|
1030 |
+
icon = "fa-wrench"
|
1031 |
+
text = WPGMZA.localized_strings.verify_project;
|
1032 |
+
}
|
1033 |
+
else if(url.match(/console\.developers\.google/))
|
1034 |
+
{
|
1035 |
+
icon = "fa-wrench";
|
1036 |
+
text = WPGMZA.localized_strings.api_dashboard;
|
1037 |
+
}
|
1038 |
+
|
1039 |
+
$(button).find("i").addClass(icon);
|
1040 |
+
$(button).append(text);
|
1041 |
+
}
|
1042 |
+
|
1043 |
+
buttonContainer.append(button);
|
1044 |
+
}
|
1045 |
+
|
1046 |
+
$(this.errorMessageList).append(li);
|
1047 |
+
|
1048 |
+
if(!this.dialog)
|
1049 |
+
this.dialog = $(this.element).remodal();
|
1050 |
+
|
1051 |
+
switch(this.dialog.getState())
|
1052 |
+
{
|
1053 |
+
case "open":
|
1054 |
+
case "opened":
|
1055 |
+
case "opening":
|
1056 |
+
break;
|
1057 |
+
|
1058 |
+
default:
|
1059 |
+
this.dialog.open();
|
1060 |
+
break;
|
1061 |
+
}
|
1062 |
+
|
1063 |
+
this.messagesAlreadyDisplayed[message] = true;
|
1064 |
+
}
|
1065 |
+
|
1066 |
+
WPGMZA.googleAPIErrorHandler = new WPGMZA.GoogleAPIErrorHandler();
|
1067 |
+
|
1068 |
+
});
|
1069 |
+
|
1070 |
+
// js/v8/info-window.js
|
1071 |
+
/**
|
1072 |
+
* @namespace WPGMZA
|
1073 |
+
* @module InfoWindow
|
1074 |
+
* @requires WPGMZA.EventDispatcher
|
1075 |
+
*/
|
1076 |
+
jQuery(function($) {
|
1077 |
+
|
1078 |
+
WPGMZA.InfoWindow = function(mapObject)
|
1079 |
+
{
|
1080 |
+
var self = this;
|
1081 |
+
|
1082 |
+
WPGMZA.EventDispatcher.call(this);
|
1083 |
+
|
1084 |
+
WPGMZA.assertInstanceOf(this, "InfoWindow");
|
1085 |
+
|
1086 |
+
if(!mapObject)
|
1087 |
+
return;
|
1088 |
+
|
1089 |
+
this.mapObject = mapObject;
|
1090 |
+
|
1091 |
+
if(mapObject.map)
|
1092 |
+
{
|
1093 |
+
// This has to be slightly delayed so the map initialization won't overwrite the infowindow element
|
1094 |
+
setTimeout(function() {
|
1095 |
+
self.onMapObjectAdded(event);
|
1096 |
+
}, 100);
|
1097 |
+
}
|
1098 |
+
else
|
1099 |
+
mapObject.addEventListener("added", function(event) {
|
1100 |
+
self.onMapObjectAdded(event);
|
1101 |
+
});
|
1102 |
+
}
|
1103 |
+
|
1104 |
+
WPGMZA.InfoWindow.prototype = Object.create(WPGMZA.EventDispatcher.prototype);
|
1105 |
+
WPGMZA.InfoWindow.prototype.constructor = WPGMZA.InfoWindow;
|
1106 |
+
|
1107 |
+
WPGMZA.InfoWindow.OPEN_BY_CLICK = 1;
|
1108 |
+
WPGMZA.InfoWindow.OPEN_BY_HOVER = 2;
|
1109 |
+
|
1110 |
+
WPGMZA.InfoWindow.getConstructor = function()
|
1111 |
+
{
|
1112 |
+
switch(WPGMZA.settings.engine)
|
1113 |
+
{
|
1114 |
+
case "open-layers":
|
1115 |
+
if(WPGMZA.isProVersion())
|
1116 |
+
return WPGMZA.OLProInfoWindow;
|
1117 |
+
return WPGMZA.OLInfoWindow;
|
1118 |
+
break;
|
1119 |
+
|
1120 |
+
default:
|
1121 |
+
if(WPGMZA.isProVersion())
|
1122 |
+
return WPGMZA.GoogleProInfoWindow;
|
1123 |
+
return WPGMZA.GoogleInfoWindow;
|
1124 |
+
break;
|
1125 |
+
}
|
1126 |
+
}
|
1127 |
+
|
1128 |
+
WPGMZA.InfoWindow.createInstance = function(mapObject)
|
1129 |
+
{
|
1130 |
+
var constructor = this.getConstructor();
|
1131 |
+
return new constructor(mapObject);
|
1132 |
+
}
|
1133 |
+
|
1134 |
+
/**
|
1135 |
+
* Gets the content for the info window and passes it to the specified callback - this allows for delayed loading (eg AJAX) as well as instant content
|
1136 |
+
* @return void
|
1137 |
+
*/
|
1138 |
+
WPGMZA.InfoWindow.prototype.getContent = function(callback)
|
1139 |
+
{
|
1140 |
+
var html = "";
|
1141 |
+
|
1142 |
+
if(this.mapObject instanceof WPGMZA.Marker)
|
1143 |
+
html = this.mapObject.address;
|
1144 |
+
|
1145 |
+
callback(html);
|
1146 |
+
}
|
1147 |
+
|
1148 |
+
/**
|
1149 |
+
* Opens the info window
|
1150 |
+
* @return boolean FALSE if the info window should not & will not open, TRUE if it will
|
1151 |
+
*/
|
1152 |
+
WPGMZA.InfoWindow.prototype.open = function(map, mapObject)
|
1153 |
+
{
|
1154 |
+
var self = this;
|
1155 |
+
|
1156 |
+
this.mapObject = mapObject;
|
1157 |
+
|
1158 |
+
if(WPGMZA.settings.disable_infowindows)
|
1159 |
+
return false;
|
1160 |
+
|
1161 |
+
return true;
|
1162 |
+
}
|
1163 |
+
|
1164 |
+
WPGMZA.InfoWindow.prototype.close = function()
|
1165 |
+
{
|
1166 |
+
|
1167 |
+
}
|
1168 |
+
|
1169 |
+
WPGMZA.InfoWindow.prototype.setContent = function(options)
|
1170 |
+
{
|
1171 |
+
|
1172 |
+
}
|
1173 |
+
|
1174 |
+
WPGMZA.InfoWindow.prototype.setOptions = function(options)
|
1175 |
+
{
|
1176 |
+
|
1177 |
+
}
|
1178 |
+
|
1179 |
+
/**
|
1180 |
+
* Event listener for when the map object is added. This will cause the info window to open if the map object has infoopen set
|
1181 |
+
* @return void
|
1182 |
+
*/
|
1183 |
+
WPGMZA.InfoWindow.prototype.onMapObjectAdded = function()
|
1184 |
+
{
|
1185 |
+
if(this.mapObject.settings.infoopen == 1)
|
1186 |
+
this.open();
|
1187 |
+
}
|
1188 |
+
|
1189 |
+
});
|
1190 |
+
|
1191 |
+
// js/v8/latlng.js
|
1192 |
+
/**
|
1193 |
+
* @namespace WPGMZA
|
1194 |
+
* @module LatLng
|
1195 |
+
* @requires WPGMZA
|
1196 |
+
*/
|
1197 |
+
jQuery(function($) {
|
1198 |
+
|
1199 |
+
/**
|
1200 |
+
* Constructor
|
1201 |
+
* @param mixed A latLng literal, or latitude
|
1202 |
+
* @param mixed The latitude, where arg is a longitude
|
1203 |
+
*/
|
1204 |
+
WPGMZA.LatLng = function(arg, lng)
|
1205 |
+
{
|
1206 |
+
this._lat = 0;
|
1207 |
+
this._lng = 0;
|
1208 |
+
|
1209 |
+
if(arguments.length == 0)
|
1210 |
+
return;
|
1211 |
+
|
1212 |
+
if(arguments.length == 1)
|
1213 |
+
{
|
1214 |
+
// TODO: Support latlng string
|
1215 |
+
|
1216 |
+
if(typeof arg == "string")
|
1217 |
+
{
|
1218 |
+
var m;
|
1219 |
+
|
1220 |
+
if(!(m = arg.match(WPGMZA.LatLng.REGEXP)))
|
1221 |
+
throw new Error("Invalid LatLng string");
|
1222 |
+
|
1223 |
+
arg = {
|
1224 |
+
lat: m[1],
|
1225 |
+
lng: m[3]
|
1226 |
+
};
|
1227 |
+
}
|
1228 |
+
|
1229 |
+
if(typeof arg != "object" || !("lat" in arg && "lng" in arg))
|
1230 |
+
throw new Error("Argument must be a LatLng literal");
|
1231 |
+
|
1232 |
+
this.lat = arg.lat;
|
1233 |
+
this.lng = arg.lng;
|
1234 |
+
}
|
1235 |
+
else
|
1236 |
+
{
|
1237 |
+
this.lat = arg;
|
1238 |
+
this.lng = lng;
|
1239 |
+
}
|
1240 |
+
}
|
1241 |
+
|
1242 |
+
WPGMZA.LatLng.REGEXP = /^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$/;
|
1243 |
+
|
1244 |
+
WPGMZA.LatLng.isValid = function(obj)
|
1245 |
+
{
|
1246 |
+
if(typeof obj != "object")
|
1247 |
+
return false;
|
1248 |
+
|
1249 |
+
if(!("lat" in obj && "lng" in obj))
|
1250 |
+
return false;
|
1251 |
+
|
1252 |
+
return true;
|
1253 |
+
}
|
1254 |
+
|
1255 |
+
Object.defineProperty(WPGMZA.LatLng.prototype, "lat", {
|
1256 |
+
get: function() {
|
1257 |
+
return this._lat;
|
1258 |
+
},
|
1259 |
+
set: function(val) {
|
1260 |
+
if(!$.isNumeric(val))
|
1261 |
+
throw new Error("Latitude must be numeric");
|
1262 |
+
this._lat = parseFloat( val );
|
1263 |
+
}
|
1264 |
+
});
|
1265 |
+
|
1266 |
+
Object.defineProperty(WPGMZA.LatLng.prototype, "lng", {
|
1267 |
+
get: function() {
|
1268 |
+
return this._lng;
|
1269 |
+
},
|
1270 |
+
set: function(val) {
|
1271 |
+
if(!$.isNumeric(val))
|
1272 |
+
throw new Error("Longitude must be numeric");
|
1273 |
+
this._lng = parseFloat( val );
|
1274 |
+
}
|
1275 |
+
});
|
1276 |
+
|
1277 |
+
WPGMZA.LatLng.prototype.toString = function()
|
1278 |
+
{
|
1279 |
+
return this._lat + ", " + this._lng;
|
1280 |
+
}
|
1281 |
+
|
1282 |
+
WPGMZA.LatLng.fromGoogleLatLng = function(googleLatLng)
|
1283 |
+
{
|
1284 |
+
return new WPGMZA.LatLng(
|
1285 |
+
googleLatLng.lat(),
|
1286 |
+
googleLatLng.lng()
|
1287 |
+
);
|
1288 |
+
}
|
1289 |
+
|
1290 |
+
WPGMZA.LatLng.prototype.toGoogleLatLng = function()
|
1291 |
+
{
|
1292 |
+
return new google.maps.LatLng({
|
1293 |
+
lat: this.lat,
|
1294 |
+
lng: this.lng
|
1295 |
+
});
|
1296 |
+
}
|
1297 |
+
|
1298 |
+
/**
|
1299 |
+
* @function moveByDistance
|
1300 |
+
* @summary Moves this latLng by the specified kilometers along the given heading
|
1301 |
+
* @return void
|
1302 |
+
* With many thanks to Hu Kenneth - https://gis.stackexchange.com/questions/234473/get-a-lonlat-point-by-distance-or-between-2-lonlat-points
|
1303 |
+
*/
|
1304 |
+
WPGMZA.LatLng.prototype.moveByDistance = function(kilometers, heading)
|
1305 |
+
{
|
1306 |
+
var radius = 6371;
|
1307 |
+
|
1308 |
+
var delta = parseFloat(kilometers) / radius;
|
1309 |
+
var theta = parseFloat(heading) / 180 * Math.PI;
|
1310 |
+
|
1311 |
+
var phi1 = this.lat / 180 * Math.PI;
|
1312 |
+
var lambda1 = this.lng / 180 * Math.PI;
|
1313 |
+
|
1314 |
+
var sinPhi1 = Math.sin(phi1), cosPhi1 = Math.cos(phi1);
|
1315 |
+
var sinDelta = Math.sin(delta), cosDelta = Math.cos(delta);
|
1316 |
+
var sinTheta = Math.sin(theta), cosTheta = Math.cos(theta);
|
1317 |
+
|
1318 |
+
var sinPhi2 = sinPhi1 * cosDelta + cosPhi1 * sinDelta * cosTheta;
|
1319 |
+
var phi2 = Math.asin(sinPhi2);
|
1320 |
+
var y = sinTheta * sinDelta * cosPhi1;
|
1321 |
+
var x = cosDelta - sinPhi1 * sinPhi2;
|
1322 |
+
var lambda2 = lambda1 + Math.atan2(y, x);
|
1323 |
+
|
1324 |
+
this.lat = phi2 * 180 / Math.PI;
|
1325 |
+
this.lng = lambda2 * 180 / Math.PI;
|
1326 |
+
}
|
1327 |
+
|
1328 |
+
});
|
1329 |
+
|
1330 |
+
// js/v8/latlngbounds.js
|
1331 |
+
/**
|
1332 |
+
* @namespace WPGMZA
|
1333 |
+
* @module LatLngBounds
|
1334 |
+
* @requires WPGMZA
|
1335 |
+
*/
|
1336 |
+
jQuery(function($) {
|
1337 |
+
|
1338 |
+
WPGMZA.LatLngBounds = function(southWest, northEast)
|
1339 |
+
{
|
1340 |
+
|
1341 |
+
}
|
1342 |
+
|
1343 |
+
WPGMZA.LatLngBounds.prototype.isInInitialState = function()
|
1344 |
+
{
|
1345 |
+
return (this.north == undefined && this.south == undefined && this.west == undefined && this.east == undefined);
|
1346 |
+
}
|
1347 |
+
|
1348 |
+
WPGMZA.LatLngBounds.prototype.extend = function(latLng)
|
1349 |
+
{
|
1350 |
+
if(this.isInInitialState())
|
1351 |
+
{
|
1352 |
+
this.north = this.south = this.west = this.east = new WPGMZA.LatLng(latLng);
|
1353 |
+
return;
|
1354 |
+
}
|
1355 |
+
|
1356 |
+
if(!(latLng instanceof WPGMZA.LatLng))
|
1357 |
+
latLng = new WPGMZA.LatLng(latLng);
|
1358 |
+
|
1359 |
+
if(latLng.lat < this.north)
|
1360 |
+
this.north = latLng.lat;
|
1361 |
+
|
1362 |
+
if(latLng.lat > this.south)
|
1363 |
+
this.south = latLng.lat;
|
1364 |
+
|
1365 |
+
if(latLng.lng < this.west)
|
1366 |
+
this.west = latLng.lng;
|
1367 |
+
|
1368 |
+
if(latLng.lng > this.east)
|
1369 |
+
this.east = latLng.lng;
|
1370 |
+
}
|
1371 |
+
|
1372 |
+
});
|
1373 |
+
|
1374 |
+
|
1375 |
+
// js/v8/map-object.js
|
1376 |
+
/**
|
1377 |
+
* @namespace WPGMZA
|
1378 |
+
* @module MapObject
|
1379 |
+
* @requires WPGMZA.EventDispatcher
|
1380 |
+
*/
|
1381 |
+
jQuery(function($) {
|
1382 |
+
|
1383 |
+
WPGMZA.MapObject = function(row)
|
1384 |
+
{
|
1385 |
+
var self = this;
|
1386 |
+
|
1387 |
+
WPGMZA.assertInstanceOf(this, "MapObject");
|
1388 |
+
|
1389 |
+
WPGMZA.EventDispatcher.call(this);
|
1390 |
+
|
1391 |
+
this.id = -1;
|
1392 |
+
this.guid = WPGMZA.guid();
|
1393 |
+
this.modified = true;
|
1394 |
+
this.settings = {};
|
1395 |
+
|
1396 |
+
if(row)
|
1397 |
+
{
|
1398 |
+
for(var name in row)
|
1399 |
+
{
|
1400 |
+
if(name == "settings")
|
1401 |
+
{
|
1402 |
+
if(row["settings"] == null)
|
1403 |
+
this["settings"] = {};
|
1404 |
+
else switch(typeof row["settings"]) {
|
1405 |
+
case "string":
|
1406 |
+
this["settings"] = JSON.parse(row[name]);
|
1407 |
+
break;
|
1408 |
+
case "object":
|
1409 |
+
this["settings"] = row[name];
|
1410 |
+
break;
|
1411 |
+
default:
|
1412 |
+
throw new Error("Don't know how to interpret settings")
|
1413 |
+
break;
|
1414 |
+
}
|
1415 |
+
|
1416 |
+
for(var name in this.settings)
|
1417 |
+
{
|
1418 |
+
var value = this.settings[name];
|
1419 |
+
if(String(value).match(/^-?\d+$/))
|
1420 |
+
this.settings[name] = parseInt(value);
|
1421 |
+
}
|
1422 |
+
}
|
1423 |
+
else
|
1424 |
+
this[name] = row[name];
|
1425 |
+
}
|
1426 |
+
}
|
1427 |
+
}
|
1428 |
+
|
1429 |
+
WPGMZA.MapObject.prototype = Object.create(WPGMZA.EventDispatcher.prototype);
|
1430 |
+
WPGMZA.MapObject.prototype.constructor = WPGMZA.MapObject;
|
1431 |
+
|
1432 |
+
WPGMZA.MapObject.prototype.parseGeometry = function(string)
|
1433 |
+
{
|
1434 |
+
var stripped, pairs, coords, results = [];
|
1435 |
+
stripped = string.replace(/[^ ,\d\.\-+e]/g, "");
|
1436 |
+
pairs = stripped.split(",");
|
1437 |
+
|
1438 |
+
for(var i = 0; i < pairs.length; i++)
|
1439 |
+
{
|
1440 |
+
coords = pairs[i].split(" ");
|
1441 |
+
results.push({
|
1442 |
+
lat: parseFloat(coords[1]),
|
1443 |
+
lng: parseFloat(coords[0])
|
1444 |
+
});
|
1445 |
+
}
|
1446 |
+
|
1447 |
+
return results;
|
1448 |
+
}
|
1449 |
+
|
1450 |
+
WPGMZA.MapObject.prototype.toJSON = function()
|
1451 |
+
{
|
1452 |
+
return {
|
1453 |
+
id: this.id,
|
1454 |
+
guid: this.guid,
|
1455 |
+
settings: this.settings
|
1456 |
+
};
|
1457 |
+
}
|
1458 |
+
|
1459 |
+
});
|
1460 |
+
|
1461 |
+
// js/v8/circle.js
|
1462 |
+
/**
|
1463 |
+
* @namespace WPGMZA
|
1464 |
+
* @module Circle
|
1465 |
+
* @requires WPGMZA.MapObject
|
1466 |
+
*/
|
1467 |
+
jQuery(function($) {
|
1468 |
+
|
1469 |
+
var Parent = WPGMZA.MapObject;
|
1470 |
+
|
1471 |
+
/**
|
1472 |
+
* @class Circle
|
1473 |
+
* @summary Represents a generic circle. <b>Please do not instantiate this object directly, use createInstance</b>
|
1474 |
+
* @return {WPGMZA.Circle}
|
1475 |
+
*/
|
1476 |
+
WPGMZA.Circle = function(options, engineCircle)
|
1477 |
+
{
|
1478 |
+
var self = this;
|
1479 |
+
|
1480 |
+
WPGMZA.assertInstanceOf(this, "Circle");
|
1481 |
+
|
1482 |
+
this.center = new WPGMZA.LatLng();
|
1483 |
+
this.radius = 100;
|
1484 |
+
|
1485 |
+
Parent.apply(this, arguments);
|
1486 |
+
}
|
1487 |
+
|
1488 |
+
WPGMZA.Circle.prototype = Object.create(Parent.prototype);
|
1489 |
+
WPGMZA.Circle.prototype.constructor = WPGMZA.Circle;
|
1490 |
+
|
1491 |
+
/**
|
1492 |
+
* @function createInstance
|
1493 |
+
* @summary Creates an instance of a circle, <b>please always use this function rather than calling the constructor directly</b>
|
1494 |
+
* @param {object} options Options for the object (optional)
|
1495 |
+
*/
|
1496 |
+
WPGMZA.Circle.createInstance = function(options)
|
1497 |
+
{
|
1498 |
+
var constructor;
|
1499 |
+
|
1500 |
+
if(WPGMZA.settings.engine == "google-maps")
|
1501 |
+
constructor = WPGMZA.GoogleCircle;
|
1502 |
+
else
|
1503 |
+
constructor = WPGMZA.OLCircle;
|
1504 |
+
|
1505 |
+
return new constructor(options);
|
1506 |
+
}
|
1507 |
+
|
1508 |
+
/**
|
1509 |
+
* @function getCenter
|
1510 |
+
* @returns {WPGMZA.LatLng}
|
1511 |
+
*/
|
1512 |
+
WPGMZA.Circle.prototype.getCenter = function()
|
1513 |
+
{
|
1514 |
+
return this.center.clone();
|
1515 |
+
}
|
1516 |
+
|
1517 |
+
/**
|
1518 |
+
* @function setCenter
|
1519 |
+
* @param {object|WPGMZA.LatLng} latLng either a literal or as a WPGMZA.LatLng
|
1520 |
+
* @returns {void}
|
1521 |
+
*/
|
1522 |
+
WPGMZA.Circle.prototype.setCenter = function(latLng)
|
1523 |
+
{
|
1524 |
+
this.center.lat = latLng.lat;
|
1525 |
+
this.center.lng = latLng.lng;
|
1526 |
+
}
|
1527 |
+
|
1528 |
+
/**
|
1529 |
+
* @function getRadius
|
1530 |
+
* @summary Returns the circles radius in kilometers
|
1531 |
+
* @returns {WPGMZA.LatLng}
|
1532 |
+
*/
|
1533 |
+
WPGMZA.Circle.prototype.getRadius = function()
|
1534 |
+
{
|
1535 |
+
return this.radius;
|
1536 |
+
}
|
1537 |
+
|
1538 |
+
/**
|
1539 |
+
* @function setRadius
|
1540 |
+
* @param {number} The radius
|
1541 |
+
* @returns {void}
|
1542 |
+
*/
|
1543 |
+
WPGMZA.Circle.prototype.setRadius = function(radius)
|
1544 |
+
{
|
1545 |
+
this.radius = radius;
|
1546 |
+
}
|
1547 |
+
|
1548 |
+
/**
|
1549 |
+
* @function getMap
|
1550 |
+
* @summary Returns the map that this circle is being displayed on
|
1551 |
+
* @return {WPGMZA.Map}
|
1552 |
+
*/
|
1553 |
+
WPGMZA.Circle.prototype.getMap = function()
|
1554 |
+
{
|
1555 |
+
return this.map;
|
1556 |
+
}
|
1557 |
+
|
1558 |
+
/**
|
1559 |
+
* @function setMap
|
1560 |
+
* @param {WPGMZA.Map} The target map
|
1561 |
+
* @summary Puts this circle on a map
|
1562 |
+
* @return {void}
|
1563 |
+
*/
|
1564 |
+
WPGMZA.Circle.prototype.setMap = function(map)
|
1565 |
+
{
|
1566 |
+
if(this.map)
|
1567 |
+
this.map.removeCircle(this);
|
1568 |
+
|
1569 |
+
if(map)
|
1570 |
+
map.addCircle(this);
|
1571 |
+
|
1572 |
+
}
|
1573 |
+
|
1574 |
+
});
|
1575 |
+
|
1576 |
+
// js/v8/map-settings-page.js
|
1577 |
+
/**
|
1578 |
+
* @namespace WPGMZA
|
1579 |
+
* @module MapSettingsPage
|
1580 |
+
* @requires WPGMZA
|
1581 |
+
*/
|
1582 |
+
jQuery(function($) {
|
1583 |
+
|
1584 |
+
WPGMZA.MapSettingsPage = function()
|
1585 |
+
{
|
1586 |
+
var self = this;
|
1587 |
+
|
1588 |
+
this.updateEngineSpecificControls();
|
1589 |
+
this.updateGDPRControls();
|
1590 |
+
|
1591 |
+
$("select[name='wpgmza_maps_engine']").on("change", function(event) {
|
1592 |
+
self.updateEngineSpecificControls();
|
1593 |
+
});
|
1594 |
+
|
1595 |
+
$("input[name='wpgmza_gdpr_require_consent_before_load'], input[name='wpgmza_gdpr_require_consent_before_vgm_submit'], input[name='wpgmza_gdpr_override_notice']").on("change", function(event) {
|
1596 |
+
self.updateGDPRControls();
|
1597 |
+
});
|
1598 |
+
}
|
1599 |
+
|
1600 |
+
WPGMZA.MapSettingsPage.prototype.updateEngineSpecificControls = function()
|
1601 |
+
{
|
1602 |
+
var engine = $("select[name='wpgmza_maps_engine']").val();
|
1603 |
+
|
1604 |
+
$("[data-required-maps-engine][data-required-maps-engine!='" + engine + "']").hide();
|
1605 |
+
$("[data-required-maps-engine='" + engine + "']").show();
|
1606 |
+
}
|
1607 |
+
|
1608 |
+
WPGMZA.MapSettingsPage.prototype.updateGDPRControls = function()
|
1609 |
+
{
|
1610 |
+
var showNoticeControls = $("input[name='wpgmza_gdpr_require_consent_before_load']").prop("checked");
|
1611 |
+
|
1612 |
+
var vgmCheckbox = $("input[name='wpgmza_gdpr_require_consent_before_vgm_submit']");
|
1613 |
+
|
1614 |
+
if(vgmCheckbox.length)
|
1615 |
+
showNoticeControls = showNoticeControls || vgmCheckbox.prop("checked");
|
1616 |
+
|
1617 |
+
var showOverrideTextarea = showNoticeControls && $("input[name='wpgmza_gdpr_override_notice']").prop("checked");
|
1618 |
+
|
1619 |
+
if(showNoticeControls)
|
1620 |
+
{
|
1621 |
+
$("#wpgmza-gdpr-compliance-notice").show("slow");
|
1622 |
+
}
|
1623 |
+
else
|
1624 |
+
{
|
1625 |
+
$("#wpgmza-gdpr-compliance-notice").hide("slow");
|
1626 |
+
}
|
1627 |
+
|
1628 |
+
if(showOverrideTextarea)
|
1629 |
+
{
|
1630 |
+
$("#wpgmza_gdpr_override_notice_text").show("slow");
|
1631 |
+
}
|
1632 |
+
else
|
1633 |
+
{
|
1634 |
+
$("#wpgmza_gdpr_override_notice_text").hide("slow");
|
1635 |
+
}
|
1636 |
+
}
|
1637 |
+
|
1638 |
+
jQuery(function($) {
|
1639 |
+
|
1640 |
+
if(!window.location.href.match(/wp-google-maps-menu-settings/))
|
1641 |
+
return;
|
1642 |
+
|
1643 |
+
WPGMZA.mapSettingsPage = new WPGMZA.MapSettingsPage();
|
1644 |
+
|
1645 |
+
});
|
1646 |
+
|
1647 |
+
});
|
1648 |
+
|
1649 |
+
// js/v8/map-settings.js
|
1650 |
+
/**
|
1651 |
+
* @namespace WPGMZA
|
1652 |
+
* @module MapSettings
|
1653 |
+
* @requires WPGMZA
|
1654 |
+
*/
|
1655 |
+
jQuery(function($) {
|
1656 |
+
|
1657 |
+
WPGMZA.MapSettings = function(element)
|
1658 |
+
{
|
1659 |
+
var str = element.getAttribute("data-settings");
|
1660 |
+
var json = JSON.parse(str);
|
1661 |
+
|
1662 |
+
//var id = $(element).attr("data-map-id");
|
1663 |
+
//var json = JSON.parse(window["wpgmza_map_settings_" + id]);
|
1664 |
+
|
1665 |
+
WPGMZA.assertInstanceOf(this, "MapSettings");
|
1666 |
+
|
1667 |
+
for(var key in WPGMZA.settings)
|
1668 |
+
{
|
1669 |
+
var value = WPGMZA.settings[key];
|
1670 |
+
|
1671 |
+
this[key] = value;
|
1672 |
+
}
|
1673 |
+
|
1674 |
+
for(var key in json)
|
1675 |
+
{
|
1676 |
+
var value = json[key];
|
1677 |
+
|
1678 |
+
if(String(value).match(/^-?\d+$/))
|
1679 |
+
value = parseInt(value);
|
1680 |
+
|
1681 |
+
this[key] = value;
|
1682 |
+
}
|
1683 |
+
}
|
1684 |
+
|
1685 |
+
WPGMZA.MapSettings.prototype.toOLViewOptions = function()
|
1686 |
+
{
|
1687 |
+
var options = {
|
1688 |
+
center: ol.proj.fromLonLat([-119.4179, 36.7783]),
|
1689 |
+
zoom: 4
|
1690 |
+
};
|
1691 |
+
|
1692 |
+
function empty(name)
|
1693 |
+
{
|
1694 |
+
if(typeof self[name] == "object")
|
1695 |
+
return false;
|
1696 |
+
|
1697 |
+
return !self[name] || !self[name].length;
|
1698 |
+
}
|
1699 |
+
|
1700 |
+
// Start location
|
1701 |
+
if(typeof this.start_location == "string")
|
1702 |
+
{
|
1703 |
+
var coords = this.start_location.replace(/^\(|\)$/g, "").split(",");
|
1704 |
+
if(WPGMZA.isLatLngString(this.start_location))
|
1705 |
+
options.center = ol.proj.fromLonLat([
|
1706 |
+
parseFloat(coords[1]),
|
1707 |
+
parseFloat(coords[0])
|
1708 |
+
]);
|
1709 |
+
else
|
1710 |
+
console.warn("Invalid start location");
|
1711 |
+
}
|
1712 |
+
|
1713 |
+
if(this.center)
|
1714 |
+
{
|
1715 |
+
options.center = ol.proj.fromLonLat([
|
1716 |
+
parseFloat(this.center.lng),
|
1717 |
+
parseFloat(this.center.lat)
|
1718 |
+
]);
|
1719 |
+
}
|
1720 |
+
|
1721 |
+
// Start zoom
|
1722 |
+
if(this.zoom)
|
1723 |
+
options.zoom = parseInt(this.zoom);
|
1724 |
+
|
1725 |
+
if(this.start_zoom)
|
1726 |
+
options.zoom = parseInt(this.start_zoom);
|
1727 |
+
|
1728 |
+
// Zoom limits
|
1729 |
+
// TODO: This matches the Google code, so some of these could be potentially put on a parent class
|
1730 |
+
if(!empty("min_zoom"))
|
1731 |
+
options.minZoom = parseInt(this.min_zoom);
|
1732 |
+
if(!empty("max_zoom"))
|
1733 |
+
options.maxZoom = parseInt(this.max_zoom);
|
1734 |
+
|
1735 |
+
return options;
|
1736 |
+
}
|
1737 |
+
|
1738 |
+
WPGMZA.MapSettings.prototype.toGoogleMapsOptions = function()
|
1739 |
+
{
|
1740 |
+
var self = this;
|
1741 |
+
var latLngCoords = (this.start_location && this.start_location.length ? this.start_location.split(",") : [36.7783, -119.4179]);
|
1742 |
+
|
1743 |
+
function empty(name)
|
1744 |
+
{
|
1745 |
+
if(typeof self[name] == "object")
|
1746 |
+
return false;
|
1747 |
+
|
1748 |
+
return !self[name] || !self[name].length;
|
1749 |
+
}
|
1750 |
+
|
1751 |
+
function formatCoord(coord)
|
1752 |
+
{
|
1753 |
+
if($.isNumeric(coord))
|
1754 |
+
return coord;
|
1755 |
+
return parseFloat( String(coord).replace(/[\(\)\s]/, "") );
|
1756 |
+
}
|
1757 |
+
|
1758 |
+
var latLng = new google.maps.LatLng(
|
1759 |
+
formatCoord(latLngCoords[0]),
|
1760 |
+
formatCoord(latLngCoords[1])
|
1761 |
+
);
|
1762 |
+
|
1763 |
+
var zoom = (this.start_zoom ? parseInt(this.start_zoom) : 4);
|
1764 |
+
|
1765 |
+
if(!this.start_zoom && this.zoom)
|
1766 |
+
zoom = parseInt( this.zoom );
|
1767 |
+
|
1768 |
+
var options = {
|
1769 |
+
zoom: zoom,
|
1770 |
+
center: latLng
|
1771 |
+
};
|
1772 |
+
|
1773 |
+
if(!empty("center"))
|
1774 |
+
options.center = new google.maps.LatLng({
|
1775 |
+
lat: parseFloat(this.center.lat),
|
1776 |
+
lng: parseFloat(this.center.lng)
|
1777 |
+
});
|
1778 |
+
|
1779 |
+
if(!empty("min_zoom"))
|
1780 |
+
options.minZoom = parseInt(this.min_zoom);
|
1781 |
+
if(!empty("max_zoom"))
|
1782 |
+
options.maxZoom = parseInt(this.max_zoom);
|
1783 |
+
|
1784 |
+
// These settings are all inverted because the checkbox being set means "disabled"
|
1785 |
+
options.zoomControl = !(this.wpgmza_settings_map_zoom == 'yes');
|
1786 |
+
options.panControl = !(this.wpgmza_settings_map_pan == 'yes');
|
1787 |
+
options.mapTypeControl = !(this.wpgmza_settings_map_type == 'yes');
|
1788 |
+
options.streetViewControl = !(this.wpgmza_settings_map_streetview == 'yes');
|
1789 |
+
options.fullscreenControl = !(this.wpgmza_settings_map_full_screen_control == 'yes');
|
1790 |
+
|
1791 |
+
options.draggable = !(this.wpgmza_settings_map_draggable == 'yes');
|
1792 |
+
options.disableDoubleClickZoom = !(this.wpgmza_settings_map_clickzoom == 'yes');
|
1793 |
+
options.scrollwheel = !(this.wpgmza_settings_map_scroll == 'yes');
|
1794 |
+
|
1795 |
+
if(this.wpgmza_force_greedy_gestures == "greedy" || this.wpgmza_force_greedy_gestures == "yes")
|
1796 |
+
options.gestureHandling = "greedy";
|
1797 |
+
else
|
1798 |
+
options.gestureHandling = "cooperative";
|
1799 |
+
|
1800 |
+
switch(parseInt(this.map_type))
|
1801 |
+
{
|
1802 |
+
case 2:
|
1803 |
+
options.mapTypeId = google.maps.MapTypeId.SATELLITE;
|
1804 |
+
break;
|
1805 |
+
|
1806 |
+
case 3:
|
1807 |
+
options.mapTypeId = google.maps.MapTypeId.HYBRID;
|
1808 |
+
break;
|
1809 |
+
|
1810 |
+
case 4:
|
1811 |
+
options.mapTypeId = google.maps.MapTypeId.TERRAIN;
|
1812 |
+
break;
|
1813 |
+
|
1814 |
+
default:
|
1815 |
+
options.mapTypeId = google.maps.MapTypeId.ROADMAP;
|
1816 |
+
break;
|
1817 |
+
}
|
1818 |
+
|
1819 |
+
if(this.theme_data && this.theme_data.length > 0)
|
1820 |
+
{
|
1821 |
+
try{
|
1822 |
+
options.styles = JSON.parse(this.theme_data);
|
1823 |
+
}catch(e) {
|
1824 |
+
alert("Your theme data is not valid JSON and has been ignored");
|
1825 |
+
}
|
1826 |
+
}
|
1827 |
+
|
1828 |
+
return options;
|
1829 |
+
}
|
1830 |
+
});
|
1831 |
+
|
1832 |
+
// js/v8/map.js
|
1833 |
+
/**
|
1834 |
+
* @namespace WPGMZA
|
1835 |
+
* @module Map
|
1836 |
+
* @requires WPGMZA.EventDispatcher
|
1837 |
+
*/
|
1838 |
+
jQuery(function($) {
|
1839 |
+
|
1840 |
+
/**
|
1841 |
+
* Constructor
|
1842 |
+
* @param element to contain map
|
1843 |
+
*/
|
1844 |
+
WPGMZA.Map = function(element, options)
|
1845 |
+
{
|
1846 |
+
var self = this;
|
1847 |
+
|
1848 |
+
WPGMZA.assertInstanceOf(this, "Map");
|
1849 |
+
|
1850 |
+
WPGMZA.EventDispatcher.call(this);
|
1851 |
+
|
1852 |
+
if(!(element instanceof HTMLElement))
|
1853 |
+
throw new Error("Argument must be a HTMLElement");
|
1854 |
+
|
1855 |
+
this.id = element.getAttribute("data-map-id");
|
1856 |
+
if(!/\d+/.test(this.id))
|
1857 |
+
throw new Error("Map ID must be an integer");
|
1858 |
+
|
1859 |
+
WPGMZA.maps.push(this);
|
1860 |
+
this.element = element;
|
1861 |
+
this.element.wpgmzaMap = this;
|
1862 |
+
|
1863 |
+
this.engineElement = element;
|
1864 |
+
|
1865 |
+
this.markers = [];
|
1866 |
+
this.polygons = [];
|
1867 |
+
this.polylines = [];
|
1868 |
+
this.circles = [];
|
1869 |
+
|
1870 |
+
this.loadSettings(options);
|
1871 |
+
}
|
1872 |
+
|
1873 |
+
WPGMZA.Map.prototype = Object.create(WPGMZA.EventDispatcher.prototype);
|
1874 |
+
WPGMZA.Map.prototype.constructor = WPGMZA.Map;
|
1875 |
+
|
1876 |
+
WPGMZA.Map.getConstructor = function()
|
1877 |
+
{
|
1878 |
+
switch(WPGMZA.settings.engine)
|
1879 |
+
{
|
1880 |
+
case "open-layers":
|
1881 |
+
if(WPGMZA.isProVersion())
|
1882 |
+
return WPGMZA.OLProMap;
|
1883 |
+
|
1884 |
+
return WPGMZA.OLMap;
|
1885 |
+
break;
|
1886 |
+
|
1887 |
+
default:
|
1888 |
+
if(WPGMZA.isProVersion())
|
1889 |
+
return WPGMZA.GoogleProMap;
|
1890 |
+
|
1891 |
+
return WPGMZA.GoogleMap;
|
1892 |
+
break;
|
1893 |
+
}
|
1894 |
+
}
|
1895 |
+
|
1896 |
+
WPGMZA.Map.createInstance = function(element, options)
|
1897 |
+
{
|
1898 |
+
var constructor = WPGMZA.Map.getConstructor();
|
1899 |
+
return new constructor(element, options);
|
1900 |
+
}
|
1901 |
+
|
1902 |
+
/**
|
1903 |
+
* Loads the maps settings and sets some defaults
|
1904 |
+
* @return void
|
1905 |
+
*/
|
1906 |
+
WPGMZA.Map.prototype.loadSettings = function(options)
|
1907 |
+
{
|
1908 |
+
var settings = new WPGMZA.MapSettings(this.element);
|
1909 |
+
var other_settings = settings.other_settings;
|
1910 |
+
|
1911 |
+
delete settings.other_settings;
|
1912 |
+
|
1913 |
+
if(other_settings)
|
1914 |
+
for(var key in other_settings)
|
1915 |
+
settings[key] = other_settings[key];
|
1916 |
+
|
1917 |
+
if(options)
|
1918 |
+
for(var key in options)
|
1919 |
+
settings[key] = options[key];
|
1920 |
+
|
1921 |
+
this.settings = settings;
|
1922 |
+
}
|
1923 |
+
|
1924 |
+
/**
|
1925 |
+
* This override should automatically dispatch a .wpgmza scoped event on the element
|
1926 |
+
* TODO: Implement
|
1927 |
+
*/
|
1928 |
+
/*WPGMZA.Map.prototype.trigger = function(event)
|
1929 |
+
{
|
1930 |
+
|
1931 |
+
}*/
|
1932 |
+
|
1933 |
+
/**
|
1934 |
+
* Sets options in bulk on map
|
1935 |
+
* @return void
|
1936 |
+
*/
|
1937 |
+
WPGMZA.Map.prototype.setOptions = function(options)
|
1938 |
+
{
|
1939 |
+
for(var name in options)
|
1940 |
+
this.settings[name] = options[name];
|
1941 |
+
}
|
1942 |
+
|
1943 |
+
/**
|
1944 |
+
* Gets the distance between two latLngs in kilometers
|
1945 |
+
* NB: Static function
|
1946 |
+
* @return number
|
1947 |
+
*/
|
1948 |
+
var earthRadiusMeters = 6371;
|
1949 |
+
var piTimes360 = Math.PI / 360;
|
1950 |
+
|
1951 |
+
function deg2rad(deg) {
|
1952 |
+
return deg * (Math.PI/180)
|
1953 |
+
};
|
1954 |
+
|
1955 |
+
/**
|
1956 |
+
* This gets the distance in kilometers between two latitude / longitude points
|
1957 |
+
* TODO: Move this to the distance class, or the LatLng class
|
1958 |
+
* @return void
|
1959 |
+
*/
|
1960 |
+
WPGMZA.Map.getGeographicDistance = function(lat1, lon1, lat2, lon2)
|
1961 |
+
{
|
1962 |
+
var dLat = deg2rad(lat2-lat1);
|
1963 |
+
var dLon = deg2rad(lon2-lon1);
|
1964 |
+
|
1965 |
+
var a =
|
1966 |
+
Math.sin(dLat/2) * Math.sin(dLat/2) +
|
1967 |
+
Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) *
|
1968 |
+
Math.sin(dLon/2) * Math.sin(dLon/2);
|
1969 |
+
|
1970 |
+
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
|
1971 |
+
var d = earthRadiusMeters * c; // Distance in km
|
1972 |
+
|
1973 |
+
return d;
|
1974 |
+
}
|
1975 |
+
|
1976 |
+
WPGMZA.Map.prototype.setCenter = function(latLng)
|
1977 |
+
{
|
1978 |
+
if(!("lat" in latLng && "lng" in latLng))
|
1979 |
+
throw new Error("Argument is not an object with lat and lng");
|
1980 |
+
}
|
1981 |
+
|
1982 |
+
/**
|
1983 |
+
* Sets the dimensions of the map
|
1984 |
+
* @return void
|
1985 |
+
*/
|
1986 |
+
WPGMZA.Map.prototype.setDimensions = function(width, height)
|
1987 |
+
{
|
1988 |
+
$(this.element).css({
|
1989 |
+
width: width
|
1990 |
+
});
|
1991 |
+
|
1992 |
+
$(this.engineElement).css({
|
1993 |
+
width: "100%",
|
1994 |
+
height: height
|
1995 |
+
});
|
1996 |
+
}
|
1997 |
+
|
1998 |
+
/**
|
1999 |
+
* Adds the specified marker to this map
|
2000 |
+
* @return void
|
2001 |
+
*/
|
2002 |
+
WPGMZA.Map.prototype.addMarker = function(marker)
|
2003 |
+
{
|
2004 |
+
if(!(marker instanceof WPGMZA.Marker))
|
2005 |
+
throw new Error("Argument must be an instance of WPGMZA.Marker");
|
2006 |
+
|
2007 |
+
marker.map = this;
|
2008 |
+
marker.parent = this;
|
2009 |
+
|
2010 |
+
this.markers.push(marker);
|
2011 |
+
this.dispatchEvent({type: "markeradded", marker: marker});
|
2012 |
+
marker.dispatchEvent({type: "added"});
|
2013 |
+
}
|
2014 |
+
|
2015 |
+
/**
|
2016 |
+
* Removes the specified marker from this map
|
2017 |
+
* @return void
|
2018 |
+
*/
|
2019 |
+
WPGMZA.Map.prototype.removeMarker = function(marker)
|
2020 |
+
{
|
2021 |
+
if(!(marker instanceof WPGMZA.Marker))
|
2022 |
+
throw new Error("Argument must be an instance of WPGMZA.Marker");
|
2023 |
+
|
2024 |
+
if(marker.map !== this)
|
2025 |
+
throw new Error("Wrong map error");
|
2026 |
+
|
2027 |
+
marker.map = null;
|
2028 |
+
marker.parent = null;
|
2029 |
+
|
2030 |
+
this.markers.splice(this.markers.indexOf(marker), 1);
|
2031 |
+
this.dispatchEvent({type: "markerremoved", marker: marker});
|
2032 |
+
marker.dispatchEvent({type: "removed"});
|
2033 |
+
}
|
2034 |
+
|
2035 |
+
WPGMZA.Map.prototype.getMarkerByID = function(id)
|
2036 |
+
{
|
2037 |
+
for(var i = 0; i < this.markers.length; i++)
|
2038 |
+
{
|
2039 |
+
if(this.markers[i].id == id)
|
2040 |
+
return this.markers[i];
|
2041 |
+
}
|
2042 |
+
|
2043 |
+
return null;
|
2044 |
+
}
|
2045 |
+
|
2046 |
+
WPGMZA.Map.prototype.removeMarkerByID = function(id)
|
2047 |
+
{
|
2048 |
+
var marker = this.getMarkerByID(id);
|
2049 |
+
|
2050 |
+
if(!marker)
|
2051 |
+
return;
|
2052 |
+
|
2053 |
+
this.removeMarker(marker);
|
2054 |
+
}
|
2055 |
+
|
2056 |
+
/**
|
2057 |
+
* Adds the specified polygon to this map
|
2058 |
+
* @return void
|
2059 |
+
*/
|
2060 |
+
WPGMZA.Map.prototype.addPolygon = function(polygon)
|
2061 |
+
{
|
2062 |
+
if(!(polygon instanceof WPGMZA.Polygon))
|
2063 |
+
throw new Error("Argument must be an instance of WPGMZA.Polygon");
|
2064 |
+
|
2065 |
+
polygon.map = this;
|
2066 |
+
|
2067 |
+
this.polygons.push(polygon);
|
2068 |
+
this.dispatchEvent({type: "polygonadded", polygon: polygon});
|
2069 |
+
}
|
2070 |
+
|
2071 |
+
/**
|
2072 |
+
* Removes the specified polygon from this map
|
2073 |
+
* @return void
|
2074 |
+
*/
|
2075 |
+
WPGMZA.Map.prototype.deletePolygon = function(polygon)
|
2076 |
+
{
|
2077 |
+
if(!(polygon instanceof WPGMZA.Polygon))
|
2078 |
+
throw new Error("Argument must be an instance of WPGMZA.Polygon");
|
2079 |
+
|
2080 |
+
if(polygon.map !== this)
|
2081 |
+
throw new Error("Wrong map error");
|
2082 |
+
|
2083 |
+
polygon.map = null;
|
2084 |
+
|
2085 |
+
this.polygons.splice(this.polygons.indexOf(polygon), 1);
|
2086 |
+
this.dispatchEvent({type: "polygonremoved", polygon: polygon});
|
2087 |
+
}
|
2088 |
+
|
2089 |
+
WPGMZA.Map.prototype.getPolygonByID = function(id)
|
2090 |
+
{
|
2091 |
+
for(var i = 0; i < this.polygons.length; i++)
|
2092 |
+
{
|
2093 |
+
if(this.polygons[i].id == id)
|
2094 |
+
return this.polygons[i];
|
2095 |
+
}
|
2096 |
+
|
2097 |
+
return null;
|
2098 |
+
}
|
2099 |
+
|
2100 |
+
WPGMZA.Map.prototype.deletePolygonByID = function(id)
|
2101 |
+
{
|
2102 |
+
var polygon = this.getPolygonByID(id);
|
2103 |
+
|
2104 |
+
if(!polygon)
|
2105 |
+
return;
|
2106 |
+
|
2107 |
+
this.deletePolygon(polygon);
|
2108 |
+
}
|
2109 |
+
|
2110 |
+
/**
|
2111 |
+
* Gets a polyline by ID
|
2112 |
+
* @return void
|
2113 |
+
*/
|
2114 |
+
WPGMZA.Map.prototype.getPolylineByID = function(id)
|
2115 |
+
{
|
2116 |
+
for(var i = 0; i < this.polylines.length; i++)
|
2117 |
+
{
|
2118 |
+
if(this.polylines[i].id == id)
|
2119 |
+
return this.polylines[i];
|
2120 |
+
}
|
2121 |
+
|
2122 |
+
return null;
|
2123 |
+
}
|
2124 |
+
|
2125 |
+
/**
|
2126 |
+
* Adds the specified polyline to this map
|
2127 |
+
* @return void
|
2128 |
+
*/
|
2129 |
+
WPGMZA.Map.prototype.addPolyline = function(polyline)
|
2130 |
+
{
|
2131 |
+
if(!(polyline instanceof WPGMZA.Polyline))
|
2132 |
+
throw new Error("Argument must be an instance of WPGMZA.Polyline");
|
2133 |
+
|
2134 |
+
polyline.map = this;
|
2135 |
+
|
2136 |
+
this.polylines.push(polyline);
|
2137 |
+
this.dispatchEvent({type: "polylineadded", polyline: polyline});
|
2138 |
+
}
|
2139 |
+
|
2140 |
+
/**
|
2141 |
+
* Removes the specified polyline from this map
|
2142 |
+
* @return void
|
2143 |
+
*/
|
2144 |
+
WPGMZA.Map.prototype.deletePolyline = function(polyline)
|
2145 |
+
{
|
2146 |
+
if(!(polyline instanceof WPGMZA.Polyline))
|
2147 |
+
throw new Error("Argument must be an instance of WPGMZA.Polyline");
|
2148 |
+
|
2149 |
+
if(polyline.map !== this)
|
2150 |
+
throw new Error("Wrong map error");
|
2151 |
+
|
2152 |
+
polyline.map = null;
|
2153 |
+
|
2154 |
+
this.polylines.splice(this.polylines.indexOf(polyline), 1);
|
2155 |
+
this.dispatchEvent({type: "polylineremoved", polyline: polyline});
|
2156 |
+
}
|
2157 |
+
|
2158 |
+
WPGMZA.Map.prototype.getPolylineByID = function(id)
|
2159 |
+
{
|
2160 |
+
for(var i = 0; i < this.polylines.length; i++)
|
2161 |
+
{
|
2162 |
+
if(this.polylines[i].id == id)
|
2163 |
+
return this.polylines[i];
|
2164 |
+
}
|
2165 |
+
|
2166 |
+
return null;
|
2167 |
+
}
|
2168 |
+
|
2169 |
+
WPGMZA.Map.prototype.deletePolylineByID = function(id)
|
2170 |
+
{
|
2171 |
+
var polyline = this.getPolylineByID(id);
|
2172 |
+
|
2173 |
+
if(!polyline)
|
2174 |
+
return;
|
2175 |
+
|
2176 |
+
this.deletePolyline(polyline);
|
2177 |
+
}
|
2178 |
+
|
2179 |
+
/**
|
2180 |
+
* Adds the specified circle to this map
|
2181 |
+
* @return void
|
2182 |
+
*/
|
2183 |
+
WPGMZA.Map.prototype.addCircle = function(circle)
|
2184 |
+
{
|
2185 |
+
if(!(circle instanceof WPGMZA.Circle))
|
2186 |
+
throw new Error("Argument must be an instance of WPGMZA.Circle");
|
2187 |
+
|
2188 |
+
circle.map = this;
|
2189 |
+
|
2190 |
+
this.circles.push(circle);
|
2191 |
+
this.dispatchEvent({type: "circleadded", circle: circle});
|
2192 |
+
}
|
2193 |
+
|
2194 |
+
/**
|
2195 |
+
* Removes the specified circle from this map
|
2196 |
+
* @return void
|
2197 |
+
*/
|
2198 |
+
WPGMZA.Map.prototype.removeCircle = function(circle)
|
2199 |
+
{
|
2200 |
+
if(!(circle instanceof WPGMZA.Circle))
|
2201 |
+
throw new Error("Argument must be an instance of WPGMZA.Circle");
|
2202 |
+
|
2203 |
+
if(circle.map !== this)
|
2204 |
+
throw new Error("Wrong map error");
|
2205 |
+
|
2206 |
+
circle.map = null;
|
2207 |
+
|
2208 |
+
this.circles.splice(this.circles.indexOf(circle), 1);
|
2209 |
+
this.dispatchEvent({type: "circleremoved", circle: circle});
|
2210 |
+
}
|
2211 |
+
|
2212 |
+
WPGMZA.Map.prototype.getCircleByID = function(id)
|
2213 |
+
{
|
2214 |
+
for(var i = 0; i < this.circles.length; i++)
|
2215 |
+
{
|
2216 |
+
if(this.circles[i].id == id)
|
2217 |
+
return this.circles[i];
|
2218 |
+
}
|
2219 |
+
|
2220 |
+
return null;
|
2221 |
+
}
|
2222 |
+
|
2223 |
+
WPGMZA.Map.prototype.deleteCircleByID = function(id)
|
2224 |
+
{
|
2225 |
+
var circle = this.getCircleByID(id);
|
2226 |
+
|
2227 |
+
if(!circle)
|
2228 |
+
return;
|
2229 |
+
|
2230 |
+
this.deleteCircle(circle);
|
2231 |
+
}
|
2232 |
+
|
2233 |
+
/**
|
2234 |
+
* Nudges the map viewport by the given pixel coordinates
|
2235 |
+
* @return void
|
2236 |
+
*/
|
2237 |
+
WPGMZA.Map.prototype.nudge = function(x, y)
|
2238 |
+
{
|
2239 |
+
var pixels = this.latLngToPixels(this.getCenter());
|
2240 |
+
|
2241 |
+
pixels.x += parseFloat(x);
|
2242 |
+
pixels.y += parseFloat(y);
|
2243 |
+
|
2244 |
+
if(isNaN(pixels.x) || isNaN(pixels.y))
|
2245 |
+
throw new Error("Invalid coordinates supplied");
|
2246 |
+
|
2247 |
+
var latLng = this.pixelsToLatLng(pixels);
|
2248 |
+
|
2249 |
+
this.setCenter(latLng);
|
2250 |
+
}
|
2251 |
+
|
2252 |
+
/**
|
2253 |
+
* Triggered when the window resizes
|
2254 |
+
* @return void
|
2255 |
+
*/
|
2256 |
+
WPGMZA.Map.prototype.onWindowResize = function(event)
|
2257 |
+
{
|
2258 |
+
|
2259 |
+
}
|
2260 |
+
|
2261 |
+
/**
|
2262 |
+
* Listener for when the engine map div is resized
|
2263 |
+
* @return void
|
2264 |
+
*/
|
2265 |
+
WPGMZA.Map.prototype.onElementResized = function(event)
|
2266 |
+
{
|
2267 |
+
|
2268 |
+
}
|
2269 |
+
|
2270 |
+
WPGMZA.Map.prototype.onBoundsChanged = function(event)
|
2271 |
+
{
|
2272 |
+
// Native events
|
2273 |
+
this.trigger("boundschanged");
|
2274 |
+
|
2275 |
+
// Google / legacy compatibility events
|
2276 |
+
this.trigger("bounds_changed");
|
2277 |
+
}
|
2278 |
+
|
2279 |
+
WPGMZA.Map.prototype.onIdle = function(event)
|
2280 |
+
{
|
2281 |
+
$(this.element).trigger("idle");
|
2282 |
+
}
|
2283 |
+
|
2284 |
+
/*$(document).ready(function() {
|
2285 |
+
function createMaps()
|
2286 |
+
{
|
2287 |
+
// TODO: Test that this works for maps off screen (which borks google)
|
2288 |
+
$(".wpgmza-map").each(function(index, el) {
|
2289 |
+
if(!el.wpgmzaMap)
|
2290 |
+
{
|
2291 |
+
WPGMZA.runCatchableTask(function() {
|
2292 |
+
WPGMZA.Map.createInstance(el);
|
2293 |
+
}, el);
|
2294 |
+
}
|
2295 |
+
});
|
2296 |
+
}
|
2297 |
+
|
2298 |
+
createMaps();
|
2299 |
+
|
2300 |
+
// Call again each second to load AJAX maps
|
2301 |
+
setInterval(createMaps, 1000);
|
2302 |
+
});*/
|
2303 |
+
});
|
2304 |
+
|
2305 |
+
// js/v8/maps-engine-dialog.js
|
2306 |
+
/**
|
2307 |
+
* @namespace WPGMZA
|
2308 |
+
* @module MapsEngineDialog
|
2309 |
+
* @requires WPGMZA
|
2310 |
+
*/
|
2311 |
+
jQuery(function($) {
|
2312 |
+
|
2313 |
+
WPGMZA.MapsEngineDialog = function(element)
|
2314 |
+
{
|
2315 |
+
var self = this;
|
2316 |
+
|
2317 |
+
this.element = element;
|
2318 |
+
|
2319 |
+
if(window.wpgmzaUnbindSaveReminder)
|
2320 |
+
window.wpgmzaUnbindSaveReminder();
|
2321 |
+
|
2322 |
+
$(element).show();
|
2323 |
+
$(element).remodal().open();
|
2324 |
+
|
2325 |
+
$(element).find("input:radio").on("change", function(event) {
|
2326 |
+
|
2327 |
+
$("#wpgmza-confirm-engine").prop("disabled", false);
|
2328 |
+
|
2329 |
+
});
|
2330 |
+
|
2331 |
+
$("#wpgmza-confirm-engine").on("click", function(event) {
|
2332 |
+
|
2333 |
+
self.onButtonClicked(event);
|
2334 |
+
|
2335 |
+
});
|
2336 |
+
}
|
2337 |
+
|
2338 |
+
WPGMZA.MapsEngineDialog.prototype.onButtonClicked = function(event)
|
2339 |
+
{
|
2340 |
+
$(event.target).prop("disabled", true);
|
2341 |
+
|
2342 |
+
$.ajax(WPGMZA.ajaxurl, {
|
2343 |
+
method: "POST",
|
2344 |
+
data: {
|
2345 |
+
action: "wpgmza_maps_engine_dialog_set_engine",
|
2346 |
+
engine: $("[name='wpgmza_maps_engine']:checked").val()
|
2347 |
+
},
|
2348 |
+
success: function(response, status, xhr) {
|
2349 |
+
window.location.reload();
|
2350 |
+
}
|
2351 |
+
});
|
2352 |
+
}
|
2353 |
+
|
2354 |
+
$(window).on("load", function(event) {
|
2355 |
+
|
2356 |
+
var element = $("#wpgmza-maps-engine-dialog");
|
2357 |
+
|
2358 |
+
if(!element.length)
|
2359 |
+
return;
|
2360 |
+
|
2361 |
+
if(WPGMZA.settings.wpgmza_maps_engine_dialog_done)
|
2362 |
+
return;
|
2363 |
+
|
2364 |
+
WPGMZA.mapsEngineDialog = new WPGMZA.MapsEngineDialog(element);
|
2365 |
+
|
2366 |
+
});
|
2367 |
+
|
2368 |
+
});
|
2369 |
+
|
2370 |
+
// js/v8/marker.js
|
2371 |
+
/**
|
2372 |
+
* @namespace WPGMZA
|
2373 |
+
* @module Marker
|
2374 |
+
* @requires WPGMZA
|
2375 |
+
*/
|
2376 |
+
jQuery(function($) {
|
2377 |
+
/**
|
2378 |
+
* Constructor
|
2379 |
+
* @param json to load (optional)
|
2380 |
+
*/
|
2381 |
+
WPGMZA.Marker = function(row)
|
2382 |
+
{
|
2383 |
+
var self = this;
|
2384 |
+
|
2385 |
+
WPGMZA.assertInstanceOf(this, "Marker");
|
2386 |
+
|
2387 |
+
this.lat = "36.778261";
|
2388 |
+
this.lng = "-119.4179323999";
|
2389 |
+
this.address = "California";
|
2390 |
+
this.title = null;
|
2391 |
+
this.description = "";
|
2392 |
+
this.link = "";
|
2393 |
+
this.icon = "";
|
2394 |
+
this.approved = 1;
|
2395 |
+
this.pic = null;
|
2396 |
+
|
2397 |
+
WPGMZA.MapObject.apply(this, arguments);
|
2398 |
+
|
2399 |
+
if(row && row.heatmap)
|
2400 |
+
return; // Don't listen for these events on heatmap markers.
|
2401 |
+
|
2402 |
+
if(row)
|
2403 |
+
this.on("init", function(event) {
|
2404 |
+
if(row.position)
|
2405 |
+
this.setPosition(row.position);
|
2406 |
+
|
2407 |
+
if(row.map)
|
2408 |
+
row.map.addMarker(this);
|
2409 |
+
});
|
2410 |
+
|
2411 |
+
this.addEventListener("added", function(event) {
|
2412 |
+
self.onAdded(event);
|
2413 |
+
});
|
2414 |
+
}
|
2415 |
+
|
2416 |
+
WPGMZA.Marker.prototype = Object.create(WPGMZA.MapObject.prototype);
|
2417 |
+
WPGMZA.Marker.prototype.constructor = WPGMZA.Marker;
|
2418 |
+
|
2419 |
+
/**
|
2420 |
+
* Gets the constructor. You can use this instead of hard coding the parent class when inheriting,
|
2421 |
+
* which is helpful for making subclasses that work with Basic only, Pro, Google, OL or a
|
2422 |
+
* combination of the four.
|
2423 |
+
* @return function
|
2424 |
+
*/
|
2425 |
+
WPGMZA.Marker.getConstructor = function()
|
2426 |
+
{
|
2427 |
+
switch(WPGMZA.settings.engine)
|
2428 |
+
{
|
2429 |
+
case "open-layers":
|
2430 |
+
if(WPGMZA.isProVersion())
|
2431 |
+
return WPGMZA.OLProMarker;
|
2432 |
+
return WPGMZA.OLMarker;
|
2433 |
+
break;
|
2434 |
+
|
2435 |
+
default:
|
2436 |
+
if(WPGMZA.isProVersion())
|
2437 |
+
return WPGMZA.GoogleProMarker;
|
2438 |
+
return WPGMZA.GoogleMarker;
|
2439 |
+
break;
|
2440 |
+
}
|
2441 |
+
}
|
2442 |
+
|
2443 |
+
WPGMZA.Marker.createInstance = function(row)
|
2444 |
+
{
|
2445 |
+
var constructor = WPGMZA.Marker.getConstructor();
|
2446 |
+
return new constructor(row);
|
2447 |
+
}
|
2448 |
+
|
2449 |
+
WPGMZA.Marker.ANIMATION_NONE = "0";
|
2450 |
+
WPGMZA.Marker.ANIMATION_BOUNCE = "1";
|
2451 |
+
WPGMZA.Marker.ANIMATION_DROP = "2";
|
2452 |
+
|
2453 |
+
WPGMZA.Marker.prototype.onAdded = function(event)
|
2454 |
+
{
|
2455 |
+
var self = this;
|
2456 |
+
|
2457 |
+
// this.infoWindow = WPGMZA.InfoWindow.createInstance(this);
|
2458 |
+
|
2459 |
+
this.addEventListener("click", function(event) {
|
2460 |
+
self.onClick(event);
|
2461 |
+
});
|
2462 |
+
|
2463 |
+
this.addEventListener("mouseover", function(event) {
|
2464 |
+
self.onMouseOver(event);
|
2465 |
+
});
|
2466 |
+
|
2467 |
+
this.addEventListener("select", function(event) {
|
2468 |
+
self.onSelect(event);
|
2469 |
+
});
|
2470 |
+
|
2471 |
+
if(this.map.settings.marker == this.id)
|
2472 |
+
self.trigger("select");
|
2473 |
+
}
|
2474 |
+
|
2475 |
+
/**
|
2476 |
+
* This function will hide the last info the user interacted with
|
2477 |
+
* @return void
|
2478 |
+
*/
|
2479 |
+
WPGMZA.Marker.prototype.hidePreviousInteractedInfoWindow = function()
|
2480 |
+
{
|
2481 |
+
if(!this.map.lastInteractedMarker)
|
2482 |
+
return;
|
2483 |
+
|
2484 |
+
this.map.lastInteractedMarker.infoWindow.close();
|
2485 |
+
}
|
2486 |
+
|
2487 |
+
WPGMZA.Marker.prototype.openInfoWindow = function()
|
2488 |
+
{
|
2489 |
+
//this.hidePreviousInteractedInfoWindow();
|
2490 |
+
//this.infoWindow.open(this.map, this);
|
2491 |
+
//this.map.lastInteractedMarker = this;
|
2492 |
+
}
|
2493 |
+
|
2494 |
+
WPGMZA.Marker.prototype.onClick = function(event)
|
2495 |
+
{
|
2496 |
+
|
2497 |
+
}
|
2498 |
+
|
2499 |
+
WPGMZA.Marker.prototype.onSelect = function(event)
|
2500 |
+
{
|
2501 |
+
this.openInfoWindow();
|
2502 |
+
}
|
2503 |
+
|
2504 |
+
WPGMZA.Marker.prototype.onMouseOver = function(event)
|
2505 |
+
{
|
2506 |
+
if(this.map.settings.info_window_open_by == WPGMZA.InfoWindow.OPEN_BY_HOVER)
|
2507 |
+
this.openInfoWindow();
|
2508 |
+
}
|
2509 |
+
|
2510 |
+
WPGMZA.Marker.prototype.getIcon = function()
|
2511 |
+
{
|
2512 |
+
function stripProtocol(url)
|
2513 |
+
{
|
2514 |
+
if(typeof url != "string")
|
2515 |
+
return url;
|
2516 |
+
|
2517 |
+
return url.replace(/^http(s?):/, "");
|
2518 |
+
}
|
2519 |
+
|
2520 |
+
return stripProtocol(WPGMZA.settings.default_marker_icon);
|
2521 |
+
}
|
2522 |
+
|
2523 |
+
/**
|
2524 |
+
* Gets the position of the marker
|
2525 |
+
* @return object
|
2526 |
+
*/
|
2527 |
+
WPGMZA.Marker.prototype.getPosition = function()
|
2528 |
+
{
|
2529 |
+
return {
|
2530 |
+
lat: parseFloat(this.lat),
|
2531 |
+
lng: parseFloat(this.lng)
|
2532 |
+
};
|
2533 |
+
}
|
2534 |
+
|
2535 |
+
/**
|
2536 |
+
* Sets the position of the marker
|
2537 |
+
* @return void
|
2538 |
+
*/
|
2539 |
+
WPGMZA.Marker.prototype.setPosition = function(latLng)
|
2540 |
+
{
|
2541 |
+
if(latLng instanceof WPGMZA.LatLng)
|
2542 |
+
{
|
2543 |
+
this.lat = latLng.lat;
|
2544 |
+
this.lng = latLng.lng;
|
2545 |
+
}
|
2546 |
+
else
|
2547 |
+
{
|
2548 |
+
this.lat = parseFloat(latLng.lat);
|
2549 |
+
this.lng = parseFloat(latLng.lng);
|
2550 |
+
}
|
2551 |
+
}
|
2552 |
+
|
2553 |
+
/**
|
2554 |
+
* Set the marker animation
|
2555 |
+
* @return void
|
2556 |
+
*/
|
2557 |
+
WPGMZA.Marker.prototype.getAnimation = function(animation)
|
2558 |
+
{
|
2559 |
+
return this.settings.animation;
|
2560 |
+
}
|
2561 |
+
|
2562 |
+
/**
|
2563 |
+
* Set the marker animation
|
2564 |
+
* @return void
|
2565 |
+
*/
|
2566 |
+
WPGMZA.Marker.prototype.setAnimation = function(animation)
|
2567 |
+
{
|
2568 |
+
this.settings.animation = animation;
|
2569 |
+
}
|
2570 |
+
|
2571 |
+
/**
|
2572 |
+
* Get the marker visibility
|
2573 |
+
* @return void
|
2574 |
+
*/
|
2575 |
+
WPGMZA.Marker.prototype.getVisible = function(visible)
|
2576 |
+
{
|
2577 |
+
|
2578 |
+
}
|
2579 |
+
|
2580 |
+
/**
|
2581 |
+
* Set the marker visibility. This is used by the store locator etc. and is not a setting
|
2582 |
+
* @return void
|
2583 |
+
*/
|
2584 |
+
WPGMZA.Marker.prototype.setVisible = function(visible)
|
2585 |
+
{
|
2586 |
+
if(!visible && this.infoWindow)
|
2587 |
+
this.infoWindow.close();
|
2588 |
+
}
|
2589 |
+
|
2590 |
+
WPGMZA.Marker.prototype.setMap = function(map)
|
2591 |
+
{
|
2592 |
+
if(!map)
|
2593 |
+
{
|
2594 |
+
if(this.map)
|
2595 |
+
this.map.removeMarker(this);
|
2596 |
+
|
2597 |
+
return;
|
2598 |
+
}
|
2599 |
+
|
2600 |
+
map.addMarker(this);
|
2601 |
+
}
|
2602 |
+
|
2603 |
+
WPGMZA.Marker.prototype.getDraggable = function()
|
2604 |
+
{
|
2605 |
+
|
2606 |
+
}
|
2607 |
+
|
2608 |
+
WPGMZA.Marker.prototype.setDraggable = function(draggable)
|
2609 |
+
{
|
2610 |
+
|
2611 |
+
}
|
2612 |
+
|
2613 |
+
WPGMZA.Marker.prototype.setOptions = function()
|
2614 |
+
{
|
2615 |
+
|
2616 |
+
}
|
2617 |
+
|
2618 |
+
WPGMZA.Marker.prototype.panIntoView = function()
|
2619 |
+
{
|
2620 |
+
if(!this.map)
|
2621 |
+
throw new Error("Marker hasn't been added to a map");
|
2622 |
+
|
2623 |
+
this.map.setCenter(this.getPosition());
|
2624 |
+
}
|
2625 |
+
|
2626 |
+
/**
|
2627 |
+
* Returns the marker as a JSON object
|
2628 |
+
* @return object
|
2629 |
+
*/
|
2630 |
+
WPGMZA.Marker.prototype.toJSON = function()
|
2631 |
+
{
|
2632 |
+
var result = WPGMZA.MapObject.prototype.toJSON.call(this);
|
2633 |
+
var position = this.getPosition();
|
2634 |
+
|
2635 |
+
$.extend(result, {
|
2636 |
+
lat: position.lat,
|
2637 |
+
lng: position.lng,
|
2638 |
+
address: this.address,
|
2639 |
+
title: this.title,
|
2640 |
+
description: this.description,
|
2641 |
+
link: this.link,
|
2642 |
+
icon: this.icon,
|
2643 |
+
pic: this.pic,
|
2644 |
+
approved: this.approved
|
2645 |
+
});
|
2646 |
+
|
2647 |
+
return result;
|
2648 |
+
}
|
2649 |
+
|
2650 |
+
|
2651 |
+
});
|
2652 |
+
|
2653 |
+
// js/v8/modern-store-locator-circle.js
|
2654 |
+
/**
|
2655 |
+
* @namespace WPGMZA
|
2656 |
+
* @module ModernStoreLocatorCircle
|
2657 |
+
* @requires WPGMZA
|
2658 |
+
*/
|
2659 |
+
jQuery(function($) {
|
2660 |
+
|
2661 |
+
/**
|
2662 |
+
* This module is the modern store locator circle
|
2663 |
+
* @constructor
|
2664 |
+
*/
|
2665 |
+
WPGMZA.ModernStoreLocatorCircle = function(map_id, settings) {
|
2666 |
+
var self = this;
|
2667 |
+
var map;
|
2668 |
+
|
2669 |
+
if(WPGMZA.isProVersion())
|
2670 |
+
map = this.map = MYMAP[map_id].map;
|
2671 |
+
else
|
2672 |
+
map = this.map = MYMAP.map;
|
2673 |
+
|
2674 |
+
this.map_id = map_id;
|
2675 |
+
this.mapElement = map.element;
|
2676 |
+
this.mapSize = {
|
2677 |
+
width: $(this.mapElement).width(),
|
2678 |
+
height: $(this.mapElement).height()
|
2679 |
+
};
|
2680 |
+
|
2681 |
+
this.initCanvasLayer();
|
2682 |
+
|
2683 |
+
this.settings = {
|
2684 |
+
center: new WPGMZA.LatLng(0, 0),
|
2685 |
+
radius: 1,
|
2686 |
+
color: "#63AFF2",
|
2687 |
+
|
2688 |
+
shadowColor: "white",
|
2689 |
+
shadowBlur: 4,
|
2690 |
+
|
2691 |
+
centerRingRadius: 10,
|
2692 |
+
centerRingLineWidth: 3,
|
2693 |
+
|
2694 |
+
numInnerRings: 9,
|
2695 |
+
innerRingLineWidth: 1,
|
2696 |
+
innerRingFade: true,
|
2697 |
+
|
2698 |
+
numOuterRings: 7,
|
2699 |
+
|
2700 |
+
ringLineWidth: 1,
|
2701 |
+
|
2702 |
+
mainRingLineWidth: 2,
|
2703 |
+
|
2704 |
+
numSpokes: 6,
|
2705 |
+
spokesStartAngle: Math.PI / 2,
|
2706 |
+
|
2707 |
+
numRadiusLabels: 6,
|
2708 |
+
radiusLabelsStartAngle: Math.PI / 2,
|
2709 |
+
radiusLabelFont: "13px sans-serif",
|
2710 |
+
|
2711 |
+
visible: false
|
2712 |
+
};
|
2713 |
+
|
2714 |
+
if(settings)
|
2715 |
+
this.setOptions(settings);
|
2716 |
+
};
|
2717 |
+
|
2718 |
+
WPGMZA.ModernStoreLocatorCircle.createInstance = function(map, settings) {
|
2719 |
+
|
2720 |
+
if(WPGMZA.settings.engine == "google-maps")
|
2721 |
+
return new WPGMZA.GoogleModernStoreLocatorCircle(map, settings);
|
2722 |
+
else
|
2723 |
+
return new WPGMZA.OLModernStoreLocatorCircle(map, settings);
|
2724 |
+
|
2725 |
+
};
|
2726 |
+
|
2727 |
+
WPGMZA.ModernStoreLocatorCircle.prototype.initCanvasLayer = function() {
|
2728 |
+
|
2729 |
+
}
|
2730 |
+
|
2731 |
+
WPGMZA.ModernStoreLocatorCircle.prototype.onResize = function(event) {
|
2732 |
+
this.draw();
|
2733 |
+
};
|
2734 |
+
|
2735 |
+
WPGMZA.ModernStoreLocatorCircle.prototype.onUpdate = function(event) {
|
2736 |
+
this.draw();
|
2737 |
+
};
|
2738 |
+
|
2739 |
+
WPGMZA.ModernStoreLocatorCircle.prototype.setOptions = function(options) {
|
2740 |
+
for(var name in options)
|
2741 |
+
{
|
2742 |
+
var functionName = "set" + name.substr(0, 1).toUpperCase() + name.substr(1);
|
2743 |
+
|
2744 |
+
if(typeof this[functionName] == "function")
|
2745 |
+
this[functionName](options[name]);
|
2746 |
+
else
|
2747 |
+
this.settings[name] = options[name];
|
2748 |
+
}
|
2749 |
+
};
|
2750 |
+
|
2751 |
+
WPGMZA.ModernStoreLocatorCircle.prototype.getResolutionScale = function() {
|
2752 |
+
return window.devicePixelRatio || 1;
|
2753 |
+
};
|
2754 |
+
|
2755 |
+
WPGMZA.ModernStoreLocatorCircle.prototype.getCenter = function() {
|
2756 |
+
return this.getPosition();
|
2757 |
+
};
|
2758 |
+
|
2759 |
+
WPGMZA.ModernStoreLocatorCircle.prototype.setCenter = function(value) {
|
2760 |
+
this.setPosition(value);
|
2761 |
+
};
|
2762 |
+
|
2763 |
+
WPGMZA.ModernStoreLocatorCircle.prototype.getPosition = function() {
|
2764 |
+
return this.settings.center;
|
2765 |
+
};
|
2766 |
+
|
2767 |
+
WPGMZA.ModernStoreLocatorCircle.prototype.setPosition = function(position) {
|
2768 |
+
this.settings.center = position;
|
2769 |
+
};
|
2770 |
+
|
2771 |
+
WPGMZA.ModernStoreLocatorCircle.prototype.getRadius = function() {
|
2772 |
+
return this.settings.radius;
|
2773 |
+
};
|
2774 |
+
|
2775 |
+
WPGMZA.ModernStoreLocatorCircle.prototype.setRadius = function(radius) {
|
2776 |
+
|
2777 |
+
if(isNaN(radius))
|
2778 |
+
throw new Error("Invalid radius");
|
2779 |
+
|
2780 |
+
this.settings.radius = radius;
|
2781 |
+
};
|
2782 |
+
|
2783 |
+
WPGMZA.ModernStoreLocatorCircle.prototype.getVisible = function(visible) {
|
2784 |
+
return this.settings.visible;
|
2785 |
+
};
|
2786 |
+
|
2787 |
+
WPGMZA.ModernStoreLocatorCircle.prototype.setVisible = function(visible) {
|
2788 |
+
this.settings.visible = visible;
|
2789 |
+
};
|
2790 |
+
|
2791 |
+
/**
|
2792 |
+
* This function transforms a km radius into canvas space
|
2793 |
+
* @return number
|
2794 |
+
*/
|
2795 |
+
WPGMZA.ModernStoreLocatorCircle.prototype.getTransformedRadius = function(km)
|
2796 |
+
{
|
2797 |
+
throw new Error("Abstract function called");
|
2798 |
+
}
|
2799 |
+
|
2800 |
+
WPGMZA.ModernStoreLocatorCircle.prototype.getContext = function(type)
|
2801 |
+
{
|
2802 |
+
throw new Error("Abstract function called");
|
2803 |
+
}
|
2804 |
+
|
2805 |
+
WPGMZA.ModernStoreLocatorCircle.prototype.getCanvasDimensions = function()
|
2806 |
+
{
|
2807 |
+
throw new Error("Abstract function called");
|
2808 |
+
}
|
2809 |
+
|
2810 |
+
WPGMZA.ModernStoreLocatorCircle.prototype.validateSettings = function()
|
2811 |
+
{
|
2812 |
+
if(!WPGMZA.isHexColorString(this.settings.color))
|
2813 |
+
this.settings.color = "#63AFF2";
|
2814 |
+
}
|
2815 |
+
|
2816 |
+
WPGMZA.ModernStoreLocatorCircle.prototype.draw = function() {
|
2817 |
+
|
2818 |
+
this.validateSettings();
|
2819 |
+
|
2820 |
+
var settings = this.settings;
|
2821 |
+
var canvasDimensions = this.getCanvasDimensions();
|
2822 |
+
|
2823 |
+
var canvasWidth = canvasDimensions.width;
|
2824 |
+
var canvasHeight = canvasDimensions.height;
|
2825 |
+
|
2826 |
+
var map = this.map;
|
2827 |
+
var resolutionScale = this.getResolutionScale();
|
2828 |
+
|
2829 |
+
context = this.getContext("2d");
|
2830 |
+
context.clearRect(0, 0, canvasWidth, canvasHeight);
|
2831 |
+
|
2832 |
+
if(!settings.visible)
|
2833 |
+
return;
|
2834 |
+
|
2835 |
+
context.shadowColor = settings.shadowColor;
|
2836 |
+
context.shadowBlur = settings.shadowBlur;
|
2837 |
+
|
2838 |
+
// NB: 2018/02/13 - Left this here in case it needs to be calibrated more accurately
|
2839 |
+
/*if(!this.testCircle)
|
2840 |
+
{
|
2841 |
+
this.testCircle = new google.maps.Circle({
|
2842 |
+
strokeColor: "#ff0000",
|
2843 |
+
strokeOpacity: 0.5,
|
2844 |
+
strokeWeight: 3,
|
2845 |
+
map: this.map,
|
2846 |
+
center: this.settings.center
|
2847 |
+
});
|
2848 |
+
}
|
2849 |
+
|
2850 |
+
this.testCircle.setCenter(settings.center);
|
2851 |
+
this.testCircle.setRadius(settings.radius * 1000);*/
|
2852 |
+
|
2853 |
+
// Reset transform
|
2854 |
+
context.setTransform(1, 0, 0, 1, 0, 0);
|
2855 |
+
|
2856 |
+
var scale = this.getScale();
|
2857 |
+
context.scale(scale, scale);
|
2858 |
+
|
2859 |
+
// Translate by world origin
|
2860 |
+
var offset = this.getWorldOriginOffset();
|
2861 |
+
context.translate(offset.x, offset.y);
|
2862 |
+
|
2863 |
+
// Get center and project to pixel space
|
2864 |
+
var center = new WPGMZA.LatLng(this.settings.center);
|
2865 |
+
var worldPoint = this.getCenterPixels();
|
2866 |
+
|
2867 |
+
var rgba = WPGMZA.hexToRgba(settings.color);
|
2868 |
+
var ringSpacing = this.getTransformedRadius(settings.radius) / (settings.numInnerRings + 1);
|
2869 |
+
|
2870 |
+
// TODO: Implement gradients for color and opacity
|
2871 |
+
|
2872 |
+
// Inside circle (fixed?)
|
2873 |
+
context.strokeStyle = settings.color;
|
2874 |
+
context.lineWidth = (1 / scale) * settings.centerRingLineWidth;
|
2875 |
+
|
2876 |
+
context.beginPath();
|
2877 |
+
context.arc(
|
2878 |
+
worldPoint.x,
|
2879 |
+
worldPoint.y,
|
2880 |
+
this.getTransformedRadius(settings.centerRingRadius) / scale, 0, 2 * Math.PI
|
2881 |
+
);
|
2882 |
+
context.stroke();
|
2883 |
+
context.closePath();
|
2884 |
+
|
2885 |
+
// Spokes
|
2886 |
+
var radius = this.getTransformedRadius(settings.radius) + (ringSpacing * settings.numOuterRings) + 1;
|
2887 |
+
var grad = context.createRadialGradient(0, 0, 0, 0, 0, radius);
|
2888 |
+
var rgba = WPGMZA.hexToRgba(settings.color);
|
2889 |
+
var start = WPGMZA.rgbaToString(rgba), end;
|
2890 |
+
var spokeAngle;
|
2891 |
+
|
2892 |
+
rgba.a = 0;
|
2893 |
+
end = WPGMZA.rgbaToString(rgba);
|
2894 |
+
|
2895 |
+
grad.addColorStop(0, start);
|
2896 |
+
grad.addColorStop(1, end);
|
2897 |
+
|
2898 |
+
context.save();
|
2899 |
+
|
2900 |
+
context.translate(worldPoint.x, worldPoint.y);
|
2901 |
+
context.strokeStyle = grad;
|
2902 |
+
context.lineWidth = 2 / scale;
|
2903 |
+
|
2904 |
+
for(var i = 0; i < settings.numSpokes; i++)
|
2905 |
+
{
|
2906 |
+
spokeAngle = settings.spokesStartAngle + (Math.PI * 2) * (i / settings.numSpokes);
|
2907 |
+
|
2908 |
+
x = Math.cos(spokeAngle) * radius;
|
2909 |
+
y = Math.sin(spokeAngle) * radius;
|
2910 |
+
|
2911 |
+
context.setLineDash([2 / scale, 15 / scale]);
|
2912 |
+
|
2913 |
+
context.beginPath();
|
2914 |
+
context.moveTo(0, 0);
|
2915 |
+
context.lineTo(x, y);
|
2916 |
+
context.stroke();
|
2917 |
+
}
|
2918 |
+
|
2919 |
+
context.setLineDash([]);
|
2920 |
+
|
2921 |
+
context.restore();
|
2922 |
+
|
2923 |
+
// Inner ringlets
|
2924 |
+
context.lineWidth = (1 / scale) * settings.innerRingLineWidth;
|
2925 |
+
|
2926 |
+
for(var i = 1; i <= settings.numInnerRings; i++)
|
2927 |
+
{
|
2928 |
+
var radius = i * ringSpacing;
|
2929 |
+
|
2930 |
+
if(settings.innerRingFade)
|
2931 |
+
rgba.a = 1 - (i - 1) / settings.numInnerRings;
|
2932 |
+
|
2933 |
+
context.strokeStyle = WPGMZA.rgbaToString(rgba);
|
2934 |
+
|
2935 |
+
context.beginPath();
|
2936 |
+
context.arc(worldPoint.x, worldPoint.y, radius, 0, 2 * Math.PI);
|
2937 |
+
context.stroke();
|
2938 |
+
context.closePath();
|
2939 |
+
}
|
2940 |
+
|
2941 |
+
// Main circle
|
2942 |
+
context.strokeStyle = settings.color;
|
2943 |
+
context.lineWidth = (1 / scale) * settings.centerRingLineWidth;
|
2944 |
+
|
2945 |
+
context.beginPath();
|
2946 |
+
context.arc(worldPoint.x, worldPoint.y, this.getTransformedRadius(settings.radius), 0, 2 * Math.PI);
|
2947 |
+
context.stroke();
|
2948 |
+
context.closePath();
|
2949 |
+
|
2950 |
+
// Outer ringlets
|
2951 |
+
var radius = radius + ringSpacing;
|
2952 |
+
for(var i = 0; i < settings.numOuterRings; i++)
|
2953 |
+
{
|
2954 |
+
if(settings.innerRingFade)
|
2955 |
+
rgba.a = 1 - i / settings.numOuterRings;
|
2956 |
+
|
2957 |
+
context.strokeStyle = WPGMZA.rgbaToString(rgba);
|
2958 |
+
|
2959 |
+
context.beginPath();
|
2960 |
+
context.arc(worldPoint.x, worldPoint.y, radius, 0, 2 * Math.PI);
|
2961 |
+
context.stroke();
|
2962 |
+
context.closePath();
|
2963 |
+
|
2964 |
+
radius += ringSpacing;
|
2965 |
+
}
|
2966 |
+
|
2967 |
+
// Text
|
2968 |
+
if(settings.numRadiusLabels > 0)
|
2969 |
+
{
|
2970 |
+
var m;
|
2971 |
+
var radius = this.getTransformedRadius(settings.radius);
|
2972 |
+
var clipRadius = (12 * 1.1) / scale;
|
2973 |
+
var x, y;
|
2974 |
+
|
2975 |
+
if(m = settings.radiusLabelFont.match(/(\d+)px/))
|
2976 |
+
clipRadius = (parseInt(m[1]) / 2 * 1.1) / scale;
|
2977 |
+
|
2978 |
+
context.font = settings.radiusLabelFont;
|
2979 |
+
context.textAlign = "center";
|
2980 |
+
context.textBaseline = "middle";
|
2981 |
+
context.fillStyle = settings.color;
|
2982 |
+
|
2983 |
+
context.save();
|
2984 |
+
|
2985 |
+
context.translate(worldPoint.x, worldPoint.y)
|
2986 |
+
|
2987 |
+
for(var i = 0; i < settings.numRadiusLabels; i++)
|
2988 |
+
{
|
2989 |
+
var spokeAngle = settings.radiusLabelsStartAngle + (Math.PI * 2) * (i / settings.numRadiusLabels);
|
2990 |
+
var textAngle = spokeAngle + Math.PI / 2;
|
2991 |
+
var text = settings.radiusString;
|
2992 |
+
var width;
|
2993 |
+
|
2994 |
+
if(Math.sin(spokeAngle) > 0)
|
2995 |
+
textAngle -= Math.PI;
|
2996 |
+
|
2997 |
+
x = Math.cos(spokeAngle) * radius;
|
2998 |
+
y = Math.sin(spokeAngle) * radius;
|
2999 |
+
|
3000 |
+
context.save();
|
3001 |
+
|
3002 |
+
context.translate(x, y);
|
3003 |
+
|
3004 |
+
context.rotate(textAngle);
|
3005 |
+
context.scale(1 / scale, 1 / scale);
|
3006 |
+
|
3007 |
+
width = context.measureText(text).width;
|
3008 |
+
height = width / 2;
|
3009 |
+
context.clearRect(-width, -height, 2 * width, 2 * height);
|
3010 |
+
|
3011 |
+
context.fillText(settings.radiusString, 0, 0);
|
3012 |
+
|
3013 |
+
context.restore();
|
3014 |
+
}
|
3015 |
+
|
3016 |
+
context.restore();
|
3017 |
+
}
|
3018 |
+
}
|
3019 |
+
|
3020 |
+
});
|
3021 |
+
|
3022 |
+
// js/v8/modern-store-locator.js
|
3023 |
+
/**
|
3024 |
+
* @namespace WPGMZA
|
3025 |
+
* @module ModernStoreLocator
|
3026 |
+
* @requires WPGMZA
|
3027 |
+
*/
|
3028 |
+
jQuery(function($) {
|
3029 |
+
|
3030 |
+
/**
|
3031 |
+
* The new modern look store locator. It takes the elements
|
3032 |
+
* from the default look and moves them into the map, wrapping
|
3033 |
+
* in a new element so we can apply new styles.
|
3034 |
+
* @return Object
|
3035 |
+
*/
|
3036 |
+
WPGMZA.ModernStoreLocator = function(map_id)
|
3037 |
+
{
|
3038 |
+
var self = this;
|
3039 |
+
var original;
|
3040 |
+
|
3041 |
+
WPGMZA.assertInstanceOf(this, "ModernStoreLocator");
|
3042 |
+
|
3043 |
+
if(WPGMZA.isProVersion())
|
3044 |
+
original = $(".wpgmza_sl_search_button[mid='" + map_id + "']").closest(".wpgmza_sl_main_div");
|
3045 |
+
else
|
3046 |
+
original = $(".wpgmza_sl_search_button").closest(".wpgmza_sl_main_div");
|
3047 |
+
|
3048 |
+
if(!original.length)
|
3049 |
+
return;
|
3050 |
+
|
3051 |
+
// Build / re-arrange elements
|
3052 |
+
this.element = $("<div class='wpgmza-modern-store-locator'><div class='wpgmza-inner wpgmza-modern-hover-opaque'/></div>")[0];
|
3053 |
+
|
3054 |
+
var inner = $(this.element).find(".wpgmza-inner");
|
3055 |
+
|
3056 |
+
var titleSearch = $(original).find("[id='nameInput_" + map_id + "']");
|
3057 |
+
if(titleSearch.length)
|
3058 |
+
{
|
3059 |
+
var placeholder = wpgmaps_localize[map_id].other_settings.store_locator_name_string;
|
3060 |
+
if(placeholder && placeholder.length)
|
3061 |
+
titleSearch.attr("placeholder", placeholder);
|
3062 |
+
inner.append(titleSearch);
|
3063 |
+
}
|
3064 |
+
|
3065 |
+
var addressInput;
|
3066 |
+
if(WPGMZA.isProVersion())
|
3067 |
+
addressInput = $(original).find(".addressInput");
|
3068 |
+
else
|
3069 |
+
addressInput = $(original).find("#addressInput");
|
3070 |
+
|
3071 |
+
if(wpgmaps_localize[map_id].other_settings.store_locator_query_string && wpgmaps_localize[map_id].other_settings.store_locator_query_string.length)
|
3072 |
+
addressInput.attr("placeholder", wpgmaps_localize[map_id].other_settings.store_locator_query_string);
|
3073 |
+
|
3074 |
+
inner.append(addressInput);
|
3075 |
+
|
3076 |
+
inner.append($(original).find("select.wpgmza_sl_radius_select"));
|
3077 |
+
// inner.append($(original).find(".wpgmza_filter_select_" + map_id));
|
3078 |
+
|
3079 |
+
// Buttons
|
3080 |
+
this.searchButton = $(original).find( ".wpgmza_sl_search_button" );
|
3081 |
+
inner.append(this.searchButton);
|
3082 |
+
|
3083 |
+
this.resetButton = $(original).find( ".wpgmza_sl_reset_button_div" );
|
3084 |
+
inner.append(this.resetButton);
|
3085 |
+
|
3086 |
+
this.resetButton.on("click", function(event) {
|
3087 |
+
resetLocations(map_id);
|
3088 |
+
});
|
3089 |
+
|
3090 |
+
this.resetButton.hide();
|
3091 |
+
|
3092 |
+
if(WPGMZA.isProVersion())
|
3093 |
+
{
|
3094 |
+
this.searchButton.on("click", function(event) {
|
3095 |
+
if($("addressInput_" + map_id).val() == 0)
|
3096 |
+
return;
|
3097 |
+
|
3098 |
+
self.searchButton.hide();
|
3099 |
+
self.resetButton.show();
|
3100 |
+
});
|
3101 |
+
this.resetButton.on("click", function(event) {
|
3102 |
+
self.resetButton.hide();
|
3103 |
+
self.searchButton.show();
|
3104 |
+
});
|
3105 |
+
}
|
3106 |
+
|
3107 |
+
// Distance type
|
3108 |
+
inner.append($("#wpgmza_distance_type_" + map_id));
|
3109 |
+
|
3110 |
+
// Categories
|
3111 |
+
var container = $(original).find(".wpgmza_cat_checkbox_holder");
|
3112 |
+
var ul = $(container).children("ul");
|
3113 |
+
var items = $(container).find("li");
|
3114 |
+
var numCategories = 0;
|
3115 |
+
|
3116 |
+
//$(items).find("ul").remove();
|
3117 |
+
//$(ul).append(items);
|
3118 |
+
|
3119 |
+
var icons = [];
|
3120 |
+
|
3121 |
+
items.each(function(index, el) {
|
3122 |
+
var id = $(el).attr("class").match(/\d+/);
|
3123 |
+
|
3124 |
+
for(var category_id in wpgmza_category_data) {
|
3125 |
+
|
3126 |
+
if(id == category_id) {
|
3127 |
+
var src = wpgmza_category_data[category_id].image;
|
3128 |
+
var icon = $('<div class="wpgmza-chip-icon"/>');
|
3129 |
+
|
3130 |
+
icon.css({
|
3131 |
+
"background-image": "url('" + src + "')",
|
3132 |
+
"width": $("#wpgmza_cat_checkbox_" + category_id + " + label").height() + "px"
|
3133 |
+
});
|
3134 |
+
icons.push(icon);
|
3135 |
+
|
3136 |
+
if(src != null && src != ""){
|
3137 |
+
//$(el).find("label").prepend(icon);
|
3138 |
+
$("#wpgmza_cat_checkbox_" + category_id + " + label").prepend(icon);
|
3139 |
+
}
|
3140 |
+
|
3141 |
+
numCategories++;
|
3142 |
+
|
3143 |
+
break;
|
3144 |
+
}
|
3145 |
+
|
3146 |
+
}
|
3147 |
+
});
|
3148 |
+
|
3149 |
+
$(this.element).append(container);
|
3150 |
+
|
3151 |
+
|
3152 |
+
if(numCategories) {
|
3153 |
+
this.optionsButton = $('<span class="wpgmza_store_locator_options_button"><i class="fas fa-list"></i></span>');
|
3154 |
+
$(this.searchButton).before(this.optionsButton);
|
3155 |
+
}
|
3156 |
+
|
3157 |
+
setInterval(function() {
|
3158 |
+
|
3159 |
+
icons.forEach(function(icon) {
|
3160 |
+
var height = $(icon).height();
|
3161 |
+
$(icon).css({"width": height + "px"});
|
3162 |
+
$(icon).closest("label").css({"padding-left": height + 8 + "px"});
|
3163 |
+
});
|
3164 |
+
|
3165 |
+
$(container).css("width", $(self.element).find(".wpgmza-inner").outerWidth() + "px");
|
3166 |
+
|
3167 |
+
}, 1000);
|
3168 |
+
|
3169 |
+
$(this.element).find(".wpgmza_store_locator_options_button").on("click", function(event) {
|
3170 |
+
|
3171 |
+
if(container.hasClass("wpgmza-open"))
|
3172 |
+
container.removeClass("wpgmza-open");
|
3173 |
+
else
|
3174 |
+
container.addClass("wpgmza-open");
|
3175 |
+
|
3176 |
+
});
|
3177 |
+
|
3178 |
+
// Remove original element
|
3179 |
+
$(original).remove();
|
3180 |
+
|
3181 |
+
// Event listeners
|
3182 |
+
$(this.element).find("input, select").on("focus", function() {
|
3183 |
+
$(inner).addClass("active");
|
3184 |
+
});
|
3185 |
+
|
3186 |
+
$(this.element).find("input, select").on("blur", function() {
|
3187 |
+
$(inner).removeClass("active");
|
3188 |
+
});
|
3189 |
+
}
|
3190 |
+
|
3191 |
+
WPGMZA.ModernStoreLocator.createInstance = function(map_id)
|
3192 |
+
{
|
3193 |
+
if(WPGMZA.settings.engine == "google-maps")
|
3194 |
+
return new WPGMZA.GoogleModernStoreLocator(map_id);
|
3195 |
+
else
|
3196 |
+
return new WPGMZA.OLModernStoreLocator(map_id);
|
3197 |
+
}
|
3198 |
+
|
3199 |
+
});
|
3200 |
+
|
3201 |
+
// js/v8/polygon.js
|
3202 |
+
/**
|
3203 |
+
* @namespace WPGMZA
|
3204 |
+
* @module Polygon
|
3205 |
+
* @requires WPGMZA.MapObject
|
3206 |
+
*/
|
3207 |
+
jQuery(function($) {
|
3208 |
+
WPGMZA.Polygon = function(row, enginePolygon)
|
3209 |
+
{
|
3210 |
+
var self = this;
|
3211 |
+
|
3212 |
+
WPGMZA.assertInstanceOf(this, "Polygon");
|
3213 |
+
|
3214 |
+
this.paths = null;
|
3215 |
+
this.title = null;
|
3216 |
+
this.name = null;
|
3217 |
+
this.link = null;
|
3218 |
+
|
3219 |
+
WPGMZA.MapObject.apply(this, arguments);
|
3220 |
+
}
|
3221 |
+
|
3222 |
+
WPGMZA.Polygon.prototype = Object.create(WPGMZA.MapObject.prototype);
|
3223 |
+
WPGMZA.Polygon.prototype.constructor = WPGMZA.Polygon;
|
3224 |
+
|
3225 |
+
WPGMZA.Polygon.getConstructor = function()
|
3226 |
+
{
|
3227 |
+
switch(WPGMZA.settings.engine)
|
3228 |
+
{
|
3229 |
+
case "open-layers":
|
3230 |
+
if(WPGMZA.isProVersion())
|
3231 |
+
return WPGMZA.OLProPolygon;
|
3232 |
+
return WPGMZA.OLPolygon;
|
3233 |
+
break;
|
3234 |
+
|
3235 |
+
default:
|
3236 |
+
if(WPGMZA.isProVersion())
|
3237 |
+
return WPGMZA.GoogleProPolygon;
|
3238 |
+
return WPGMZA.GooglePolygon;
|
3239 |
+
break;
|
3240 |
+
}
|
3241 |
+
}
|
3242 |
+
|
3243 |
+
WPGMZA.Polygon.createInstance = function(row, engineObject)
|
3244 |
+
{
|
3245 |
+
var constructor = WPGMZA.Polygon.getConstructor();
|
3246 |
+
return new constructor(row, engineObject);
|
3247 |
+
}
|
3248 |
+
|
3249 |
+
WPGMZA.Polygon.prototype.toJSON = function()
|
3250 |
+
{
|
3251 |
+
var result = WPGMZA.MapObject.prototype.toJSON.call(this);
|
3252 |
+
|
3253 |
+
$.extend(result, {
|
3254 |
+
name: this.name,
|
3255 |
+
title: this.title,
|
3256 |
+
link: this.link,
|
3257 |
+
});
|
3258 |
+
|
3259 |
+
return result;
|
3260 |
+
}
|
3261 |
+
|
3262 |
+
});
|
3263 |
+
|
3264 |
+
// js/v8/polyline.js
|
3265 |
+
/**
|
3266 |
+
* @namespace WPGMZA
|
3267 |
+
* @module Polyline
|
3268 |
+
* @requires WPGMZA.MapObject
|
3269 |
+
*/
|
3270 |
+
jQuery(function($) {
|
3271 |
+
WPGMZA.Polyline = function(row, googlePolyline)
|
3272 |
+
{
|
3273 |
+
var self = this;
|
3274 |
+
|
3275 |
+
WPGMZA.assertInstanceOf(this, "Polyline");
|
3276 |
+
|
3277 |
+
this.title = null;
|
3278 |
+
|
3279 |
+
WPGMZA.MapObject.apply(this, arguments);
|
3280 |
+
}
|
3281 |
+
|
3282 |
+
WPGMZA.Polyline.prototype = Object.create(WPGMZA.MapObject.prototype);
|
3283 |
+
WPGMZA.Polyline.prototype.constructor = WPGMZA.Polyline;
|
3284 |
+
|
3285 |
+
WPGMZA.Polyline.getConstructor = function()
|
3286 |
+
{
|
3287 |
+
switch(WPGMZA.settings.engine)
|
3288 |
+
{
|
3289 |
+
case "open-layers":
|
3290 |
+
return WPGMZA.OLPolyline;
|
3291 |
+
break;
|
3292 |
+
|
3293 |
+
default:
|
3294 |
+
return WPGMZA.GooglePolyline;
|
3295 |
+
break;
|
3296 |
+
}
|
3297 |
+
}
|
3298 |
+
|
3299 |
+
WPGMZA.Polyline.createInstance = function(row, engineObject)
|
3300 |
+
{
|
3301 |
+
var constructor = WPGMZA.Polyline.getConstructor();
|
3302 |
+
return new constructor(row, engineObject);
|
3303 |
+
}
|
3304 |
+
|
3305 |
+
WPGMZA.Polyline.prototype.getPoints = function()
|
3306 |
+
{
|
3307 |
+
return this.toJSON().points;
|
3308 |
+
}
|
3309 |
+
|
3310 |
+
WPGMZA.Polyline.prototype.toJSON = function()
|
3311 |
+
{
|
3312 |
+
var result = WPGMZA.MapObject.prototype.toJSON.call(this);
|
3313 |
+
|
3314 |
+
result.title = this.title;
|
3315 |
+
|
3316 |
+
return result;
|
3317 |
+
}
|
3318 |
+
|
3319 |
+
|
3320 |
+
});
|
3321 |
+
|
3322 |
+
// js/v8/rest-api.js
|
3323 |
+
/**
|
3324 |
+
* @module WPGMZA.RestAPI
|
3325 |
+
* @namespace WPGMZA
|
3326 |
+
* @requires WPGMZA
|
3327 |
+
* @summary Wrapped for the rest API
|
3328 |
+
*/
|
3329 |
+
jQuery(function($) {
|
3330 |
+
|
3331 |
+
WPGMZA.RestAPI = function()
|
3332 |
+
{
|
3333 |
+
WPGMZA.RestAPI.URL = WPGMZA.resturl;
|
3334 |
+
}
|
3335 |
+
|
3336 |
+
WPGMZA.RestAPI.createInstance = function()
|
3337 |
+
{
|
3338 |
+
return new WPGMZA.RestAPI();
|
3339 |
+
}
|
3340 |
+
|
3341 |
+
WPGMZA.RestAPI.prototype.call = function(route, params)
|
3342 |
+
{
|
3343 |
+
if(typeof route != "string" || !route.match(/^\//))
|
3344 |
+
throw new Error("Invalid route");
|
3345 |
+
|
3346 |
+
$.ajax(WPGMZA.RestAPI.URL + route, params);
|
3347 |
+
}
|
3348 |
+
|
3349 |
+
});
|
3350 |
+
|
3351 |
+
// js/v8/version.js
|
3352 |
+
/**
|
3353 |
+
* @namespace WPGMZA
|
3354 |
+
* @module Version
|
3355 |
+
* @requires WPGMZA
|
3356 |
+
*/
|
3357 |
+
jQuery(function($) {
|
3358 |
+
|
3359 |
+
function isPositiveInteger(x) {
|
3360 |
+
// http://stackoverflow.com/a/1019526/11236
|
3361 |
+
return /^\d+$/.test(x);
|
3362 |
+
}
|
3363 |
+
|
3364 |
+
function validateParts(parts) {
|
3365 |
+
for (var i = 0; i < parts.length; ++i) {
|
3366 |
+
if (!isPositiveInteger(parts[i])) {
|
3367 |
+
return false;
|
3368 |
+
}
|
3369 |
+
}
|
3370 |
+
return true;
|
3371 |
+
}
|
3372 |
+
|
3373 |
+
WPGMZA.Version = function()
|
3374 |
+
{
|
3375 |
+
|
3376 |
+
}
|
3377 |
+
|
3378 |
+
/**
|
3379 |
+
* Compare two software version numbers (e.g. 1.7.1)
|
3380 |
+
* Returns:
|
3381 |
+
*
|
3382 |
+
* 0 if they're identical
|
3383 |
+
* negative if v1 < v2
|
3384 |
+
* positive if v1 > v2
|
3385 |
+
* NaN if they in the wrong format
|
3386 |
+
*
|
3387 |
+
* "Unit tests": http://jsfiddle.net/ripper234/Xv9WL/28/
|
3388 |
+
*
|
3389 |
+
* Taken from http://stackoverflow.com/a/6832721/11236
|
3390 |
+
*/
|
3391 |
+
WPGMZA.Version.compare = function(v1, v2)
|
3392 |
+
{
|
3393 |
+
var v1parts = v1.split('.');
|
3394 |
+
var v2parts = v2.split('.');
|
3395 |
+
|
3396 |
+
// First, validate both numbers are true version numbers
|
3397 |
+
if (!validateParts(v1parts) || !validateParts(v2parts)) {
|
3398 |
+
return NaN;
|
3399 |
+
}
|
3400 |
+
|
3401 |
+
for (var i = 0; i < v1parts.length; ++i) {
|
3402 |
+
if (v2parts.length === i) {
|
3403 |
+
return 1;
|
3404 |
+
}
|
3405 |
+
|
3406 |
+
if (v1parts[i] === v2parts[i]) {
|
3407 |
+
continue;
|
3408 |
+
}
|
3409 |
+
if (v1parts[i] > v2parts[i]) {
|
3410 |
+
return 1;
|
3411 |
+
}
|
3412 |
+
return -1;
|
3413 |
+
}
|
3414 |
+
|
3415 |
+
if (v1parts.length != v2parts.length) {
|
3416 |
+
return -1;
|
3417 |
+
}
|
3418 |
+
|
3419 |
+
return 0;
|
3420 |
+
}
|
3421 |
+
|
3422 |
+
});
|
3423 |
+
|
3424 |
+
// js/v8/compatibility/google-ui-compatibility.js
|
3425 |
+
/**
|
3426 |
+
* @namespace WPGMZA
|
3427 |
+
* @module GoogleUICompatibility
|
3428 |
+
* @requires WPGMZA
|
3429 |
+
*/
|
3430 |
+
jQuery(function($) {
|
3431 |
+
|
3432 |
+
WPGMZA.GoogleUICompatibility = function()
|
3433 |
+
{
|
3434 |
+
var isSafari = navigator.vendor && navigator.vendor.indexOf('Apple') > -1 &&
|
3435 |
+
navigator.userAgent &&
|
3436 |
+
navigator.userAgent.indexOf('CriOS') == -1 &&
|
3437 |
+
navigator.userAgent.indexOf('FxiOS') == -1;
|
3438 |
+
|
3439 |
+
if(!isSafari)
|
3440 |
+
{
|
3441 |
+
var style = $("<style id='wpgmza-google-ui-compatiblity-fix'/>");
|
3442 |
+
style.html(".wpgmza_map img:not(button img) { padding:0 !important; }");
|
3443 |
+
$(document.head).append(style);
|
3444 |
+
}
|
3445 |
+
}
|
3446 |
+
|
3447 |
+
WPGMZA.googleUICompatibility = new WPGMZA.GoogleUICompatibility();
|
3448 |
+
|
3449 |
+
});
|
3450 |
+
|
3451 |
+
// js/v8/google-maps/google-circle.js
|
3452 |
+
/**
|
3453 |
+
* @namespace WPGMZA
|
3454 |
+
* @module GoogleCircle
|
3455 |
+
* @requires WPGMZA.Circle
|
3456 |
+
*/
|
3457 |
+
jQuery(function($) {
|
3458 |
+
|
3459 |
+
WPGMZA.GoogleCircle = function(options, googleCircle)
|
3460 |
+
{
|
3461 |
+
var self = this;
|
3462 |
+
|
3463 |
+
WPGMZA.Circle.call(this, options, googleCircle);
|
3464 |
+
|
3465 |
+
if(googleCircle)
|
3466 |
+
{
|
3467 |
+
this.googleCircle = googleCircle;
|
3468 |
+
}
|
3469 |
+
else
|
3470 |
+
{
|
3471 |
+
this.googleCircle = new google.maps.Circle();
|
3472 |
+
this.googleCircle.wpgmzaCircle = this;
|
3473 |
+
}
|
3474 |
+
|
3475 |
+
google.maps.event.addListener(this.googleCircle, "click", function() {
|
3476 |
+
self.dispatchEvent({type: "click"});
|
3477 |
+
});
|
3478 |
+
|
3479 |
+
if(options)
|
3480 |
+
{
|
3481 |
+
var googleOptions = {};
|
3482 |
+
|
3483 |
+
googleOptions = $.extend({}, options);
|
3484 |
+
delete googleOptions.map;
|
3485 |
+
delete googleOptions.center;
|
3486 |
+
|
3487 |
+
if(options.center)
|
3488 |
+
googleOptions.center = new google.maps.LatLng({
|
3489 |
+
lat: options.center.lat,
|
3490 |
+
lng: options.center.lng
|
3491 |
+
});
|
3492 |
+
|
3493 |
+
this.googleCircle.setOptions(googleOptions);
|
3494 |
+
|
3495 |
+
if(options.map)
|
3496 |
+
options.map.addCircle(this);
|
3497 |
+
}
|
3498 |
+
}
|
3499 |
+
|
3500 |
+
WPGMZA.GoogleCircle.prototype = Object.create(WPGMZA.Circle.prototype);
|
3501 |
+
WPGMZA.GoogleCircle.prototype.constructor = WPGMZA.GoogleCircle;
|
3502 |
+
|
3503 |
+
});
|
3504 |
+
|
3505 |
+
// js/v8/google-maps/google-geocoder.js
|
3506 |
+
/**
|
3507 |
+
* @namespace WPGMZA
|
3508 |
+
* @module GoogleGeocoder
|
3509 |
+
* @requires WPGMZA.Geocoder
|
3510 |
+
*/
|
3511 |
+
jQuery(function($) {
|
3512 |
+
|
3513 |
+
WPGMZA.GoogleGeocoder = function()
|
3514 |
+
{
|
3515 |
+
|
3516 |
+
}
|
3517 |
+
|
3518 |
+
WPGMZA.GoogleGeocoder.prototype = Object.create(WPGMZA.Geocoder.prototype);
|
3519 |
+
WPGMZA.GoogleGeocoder.prototype.constructor = WPGMZA.GoogleGeocoder;
|
3520 |
+
|
3521 |
+
WPGMZA.GoogleGeocoder.prototype.getLatLngFromAddress = function(options, callback)
|
3522 |
+
{
|
3523 |
+
if(!options || !options.address)
|
3524 |
+
throw new Error("No address specified");
|
3525 |
+
|
3526 |
+
if(WPGMZA.isLatLngString(options.address))
|
3527 |
+
return WPGMZA.Geocoder.prototype.getLatLngFromAddress.call(this, options, callback);
|
3528 |
+
|
3529 |
+
if(options.country)
|
3530 |
+
options.componentRestrictions = {
|
3531 |
+
country: options.country
|
3532 |
+
};
|
3533 |
+
|
3534 |
+
var geocoder = new google.maps.Geocoder();
|
3535 |
+
|
3536 |
+
geocoder.geocode(options, function(results, status) {
|
3537 |
+
if(status == google.maps.GeocoderStatus.OK)
|
3538 |
+
{
|
3539 |
+
var location = results[0].geometry.location;
|
3540 |
+
var latLng = {
|
3541 |
+
lat: location.lat(),
|
3542 |
+
lng: location.lng()
|
3543 |
+
};
|
3544 |
+
|
3545 |
+
var results = [
|
3546 |
+
{
|
3547 |
+
geometry: {
|
3548 |
+
location: latLng
|
3549 |
+
},
|
3550 |
+
latLng: latLng,
|
3551 |
+
lat: latLng.lat,
|
3552 |
+
lng: latLng.lng
|
3553 |
+
}
|
3554 |
+
];
|
3555 |
+
|
3556 |
+
callback(results, WPGMZA.Geocoder.SUCCESS);
|
3557 |
+
}
|
3558 |
+
else
|
3559 |
+
{
|
3560 |
+
var nativeStatus = WPGMZA.Geocoder.FAIL;
|
3561 |
+
|
3562 |
+
if(status == google.maps.GeocoderStatus.ZERO_RESULTS)
|
3563 |
+
nativeStatus = WPGMZA.Geocoder.ZERO_RESULTS;
|
3564 |
+
|
3565 |
+
callback(null, nativeStatus);
|
3566 |
+
}
|
3567 |
+
});
|
3568 |
+
}
|
3569 |
+
|
3570 |
+
WPGMZA.GoogleGeocoder.prototype.getAddressFromLatLng = function(options, callback)
|
3571 |
+
{
|
3572 |
+
if(!options || !options.latLng)
|
3573 |
+
throw new Error("No latLng specified");
|
3574 |
+
|
3575 |
+
var latLng = new WPGMZA.LatLng(options.latLng);
|
3576 |
+
var geocoder = new google.maps.Geocoder();
|
3577 |
+
|
3578 |
+
var options = $.extend(options, {
|
3579 |
+
location: {
|
3580 |
+
lat: latLng.lat,
|
3581 |
+
lng: latLng.lng
|
3582 |
+
}
|
3583 |
+
});
|
3584 |
+
delete options.latLng;
|
3585 |
+
|
3586 |
+
geocoder.geocode(options, function(results, status) {
|
3587 |
+
|
3588 |
+
if(status !== "OK")
|
3589 |
+
callback(null, WPGMZA.Geocoder.FAIL);
|
3590 |
+
|
3591 |
+
if(!results || !results.length)
|
3592 |
+
callback([], WPGMZA.Geocoder.NO_RESULTS);
|
3593 |
+
|
3594 |
+
callback([results[0].formatted_address], WPGMZA.Geocoder.SUCCESS);
|
3595 |
+
|
3596 |
+
});
|
3597 |
+
}
|
3598 |
+
|
3599 |
+
});
|
3600 |
+
|
3601 |
+
// js/v8/google-maps/google-info-window.js
|
3602 |
+
/**
|
3603 |
+
* @namespace WPGMZA
|
3604 |
+
* @module GoogleInfoWindow
|
3605 |
+
* @requires WPGMZA.InfoWindow
|
3606 |
+
* @pro-requires WPGMZA.ProInfoWindow
|
3607 |
+
*/
|
3608 |
+
jQuery(function($) {
|
3609 |
+
|
3610 |
+
var Parent;
|
3611 |
+
|
3612 |
+
WPGMZA.GoogleInfoWindow = function(mapObject)
|
3613 |
+
{
|
3614 |
+
Parent.call(this, mapObject);
|
3615 |
+
|
3616 |
+
this.setMapObject(mapObject);
|
3617 |
+
}
|
3618 |
+
|
3619 |
+
if(WPGMZA.isProVersion())
|
3620 |
+
Parent = WPGMZA.ProInfoWindow;
|
3621 |
+
else
|
3622 |
+
Parent = WPGMZA.InfoWindow;
|
3623 |
+
|
3624 |
+
WPGMZA.GoogleInfoWindow.prototype = Object.create(Parent.prototype);
|
3625 |
+
WPGMZA.GoogleInfoWindow.prototype.constructor = WPGMZA.GoogleInfoWindow;
|
3626 |
+
|
3627 |
+
WPGMZA.GoogleInfoWindow.prototype.setMapObject = function(mapObject)
|
3628 |
+
{
|
3629 |
+
if(mapObject instanceof WPGMZA.Marker)
|
3630 |
+
this.googleObject = mapObject.googleMarker;
|
3631 |
+
else if(mapObject instanceof WPGMZA.Polygon)
|
3632 |
+
this.googleObject = mapObject.googlePolygon;
|
3633 |
+
else if(mapObject instanceof WPGMZA.Polyline)
|
3634 |
+
this.googleObject = mapObject.googlePolyline;
|
3635 |
+
}
|
3636 |
+
|
3637 |
+
WPGMZA.GoogleInfoWindow.prototype.createGoogleInfoWindow = function()
|
3638 |
+
{
|
3639 |
+
if(this.googleInfoWindow)
|
3640 |
+
return;
|
3641 |
+
|
3642 |
+
this.googleInfoWindow = new google.maps.InfoWindow();
|
3643 |
+
}
|
3644 |
+
|
3645 |
+
/**
|
3646 |
+
* Opens the info window
|
3647 |
+
* @return boolean FALSE if the info window should not & will not open, TRUE if it will
|
3648 |
+
*/
|
3649 |
+
WPGMZA.GoogleInfoWindow.prototype.open = function(map, mapObject)
|
3650 |
+
{
|
3651 |
+
var self = this;
|
3652 |
+
|
3653 |
+
if(!Parent.prototype.open.call(this, map, mapObject))
|
3654 |
+
return false;
|
3655 |
+
|
3656 |
+
this.createGoogleInfoWindow();
|
3657 |
+
this.setMapObject(mapObject);
|
3658 |
+
|
3659 |
+
this.googleInfoWindow.open(
|
3660 |
+
this.mapObject.map.googleMap,
|
3661 |
+
this.googleObject
|
3662 |
+
);
|
3663 |
+
|
3664 |
+
if(this.content)
|
3665 |
+
this.googleInfoWindow.setContent(this.content);
|
3666 |
+
|
3667 |
+
//this.
|
3668 |
+
|
3669 |
+
/*this.getContent(function(html) {
|
3670 |
+
|
3671 |
+
// Wrap HTML with unique ID
|
3672 |
+
var guid = WPGMZA.guid();
|
3673 |
+
var html = "<div id='" + guid + "'>" + html + "</div>";
|
3674 |
+
var div, intervalID;
|
3675 |
+
|
3676 |
+
self.googleInfoWindow.setContent(html);
|
3677 |
+
self.googleInfoWindow.open(
|
3678 |
+
self.mapObject.map.googleMap,
|
3679 |
+
self.googleObject
|
3680 |
+
);
|
3681 |
+
|
3682 |
+
intervalID = setInterval(function(event) {
|
3683 |
+
|
3684 |
+
div = $("#" + guid);
|
3685 |
+
|
3686 |
+
if(div.find(".gm-style-iw").length)
|
3687 |
+
{
|
3688 |
+
div[0].wpgmzaMapObject = self.mapObject;
|
3689 |
+
|
3690 |
+
self.dispatchEvent("infowindowopen");
|
3691 |
+
div.trigger("infowindowopen");
|
3692 |
+
clearInterval(intervalID);
|
3693 |
+
}
|
3694 |
+
|
3695 |
+
}, 50);
|
3696 |
+
|
3697 |
+
});*/
|
3698 |
+
|
3699 |
+
return true;
|
3700 |
+
}
|
3701 |
+
|
3702 |
+
WPGMZA.GoogleInfoWindow.prototype.close = function()
|
3703 |
+
{
|
3704 |
+
if(!this.googleInfoWindow)
|
3705 |
+
return;
|
3706 |
+
|
3707 |
+
WPGMZA.InfoWindow.prototype.close.call(this);
|
3708 |
+
|
3709 |
+
this.googleInfoWindow.close();
|
3710 |
+
}
|
3711 |
+
|
3712 |
+
WPGMZA.GoogleInfoWindow.prototype.setContent = function(html)
|
3713 |
+
{
|
3714 |
+
Parent.prototype.setContent.call(this, html);
|
3715 |
+
|
3716 |
+
this.content = html;
|
3717 |
+
|
3718 |
+
this.createGoogleInfoWindow();
|
3719 |
+
|
3720 |
+
this.googleInfoWindow.setContent(html);
|
3721 |
+
}
|
3722 |
+
|
3723 |
+
WPGMZA.GoogleInfoWindow.prototype.setOptions = function(options)
|
3724 |
+
{
|
3725 |
+
Parent.prototype.setOptions.call(this, options);
|
3726 |
+
|
3727 |
+
this.createGoogleInfoWindow();
|
3728 |
+
|
3729 |
+
this.googleInfoWindow.setOptions(options);
|
3730 |
+
}
|
3731 |
+
|
3732 |
+
});
|
3733 |
+
|
3734 |
+
// js/v8/google-maps/google-map.js
|
3735 |
+
/**
|
3736 |
+
* @namespace WPGMZA
|
3737 |
+
* @module GoogleMap
|
3738 |
+
* @requires WPGMZA.Map
|
3739 |
+
* @pro-requires WPGMZA.ProMap
|
3740 |
+
*/
|
3741 |
+
jQuery(function($) {
|
3742 |
+
var Parent;
|
3743 |
+
|
3744 |
+
/**
|
3745 |
+
* Constructor
|
3746 |
+
* @param element to contain the map
|
3747 |
+
*/
|
3748 |
+
WPGMZA.GoogleMap = function(element, options)
|
3749 |
+
{
|
3750 |
+
var self = this;
|
3751 |
+
|
3752 |
+
Parent.call(this, element, options);
|
3753 |
+
|
3754 |
+
if(!window.google)
|
3755 |
+
{
|
3756 |
+
var status = WPGMZA.googleAPIStatus;
|
3757 |
+
var message = "Google API not loaded";
|
3758 |
+
|
3759 |
+
if(status && status.message)
|
3760 |
+
message += " - " + status.message;
|
3761 |
+
|
3762 |
+
if(status.code == "USER_CONSENT_NOT_GIVEN")
|
3763 |
+
{
|
3764 |
+
return;
|
3765 |
+
}
|
3766 |
+
|
3767 |
+
$(element).html("<div class='notice notice-error'><p>" + WPGMZA.localized_strings.google_api_not_loaded + "<pre>" + message + "</pre></p></div>");
|
3768 |
+
|
3769 |
+
throw new Error(message);
|
3770 |
+
}
|
3771 |
+
|
3772 |
+
this.loadGoogleMap();
|
3773 |
+
|
3774 |
+
if(options)
|
3775 |
+
this.setOptions(options);
|
3776 |
+
|
3777 |
+
google.maps.event.addListener(this.googleMap, "click", function(event) {
|
3778 |
+
var wpgmzaEvent = new WPGMZA.Event("click");
|
3779 |
+
wpgmzaEvent.latLng = {
|
3780 |
+
lat: event.latLng.lat(),
|
3781 |
+
lng: event.latLng.lng()
|
3782 |
+
};
|
3783 |
+
self.dispatchEvent(wpgmzaEvent);
|
3784 |
+
});
|
3785 |
+
|
3786 |
+
google.maps.event.addListener(this.googleMap, "rightclick", function(event) {
|
3787 |
+
var wpgmzaEvent = new WPGMZA.Event("rightclick");
|
3788 |
+
wpgmzaEvent.latLng = {
|
3789 |
+
lat: event.latLng.lat(),
|
3790 |
+
lng: event.latLng.lng()
|
3791 |
+
};
|
3792 |
+
self.dispatchEvent(wpgmzaEvent);
|
3793 |
+
});
|
3794 |
+
|
3795 |
+
google.maps.event.addListener(this.googleMap, "dragend", function(event) {
|
3796 |
+
self.dispatchEvent("dragend");
|
3797 |
+
});
|
3798 |
+
|
3799 |
+
google.maps.event.addListener(this.googleMap, "zoom_changed", function(event) {
|
3800 |
+
self.dispatchEvent("zoom_changed");
|
3801 |
+
self.dispatchEvent("zoomchanged");
|
3802 |
+
});
|
3803 |
+
|
3804 |
+
// Idle event
|
3805 |
+
google.maps.event.addListener(this.googleMap, "idle", function(event) {
|
3806 |
+
self.onIdle(event);
|
3807 |
+
});
|
3808 |
+
|
3809 |
+
// Dispatch event
|
3810 |
+
if(!WPGMZA.isProVersion())
|
3811 |
+
{
|
3812 |
+
this.dispatchEvent("created");
|
3813 |
+
WPGMZA.events.dispatchEvent({type: "mapcreated", map: this});
|
3814 |
+
}
|
3815 |
+
}
|
3816 |
+
|
3817 |
+
// If we're running the Pro version, inherit from ProMap, otherwise, inherit from Map
|
3818 |
+
if(WPGMZA.isProVersion())
|
3819 |
+
{
|
3820 |
+
Parent = WPGMZA.ProMap;
|
3821 |
+
WPGMZA.GoogleMap.prototype = Object.create(WPGMZA.ProMap.prototype);
|
3822 |
+
}
|
3823 |
+
else
|
3824 |
+
{
|
3825 |
+
Parent = WPGMZA.Map;
|
3826 |
+
WPGMZA.GoogleMap.prototype = Object.create(WPGMZA.Map.prototype);
|
3827 |
+
}
|
3828 |
+
WPGMZA.GoogleMap.prototype.constructor = WPGMZA.GoogleMap;
|
3829 |
+
|
3830 |
+
/**
|
3831 |
+
* Creates the Google Maps map
|
3832 |
+
* @return void
|
3833 |
+
*/
|
3834 |
+
WPGMZA.GoogleMap.prototype.loadGoogleMap = function()
|
3835 |
+
{
|
3836 |
+
var self = this;
|
3837 |
+
var options = this.settings.toGoogleMapsOptions();
|
3838 |
+
|
3839 |
+
this.googleMap = new google.maps.Map(this.engineElement, options);
|
3840 |
+
google.maps.event.addListener(this.googleMap, "bounds_changed", function() {
|
3841 |
+
self.onBoundsChanged();
|
3842 |
+
});
|
3843 |
+
|
3844 |
+
if(this.settings.bicycle == 1)
|
3845 |
+
this.enableBicycleLayer(true);
|
3846 |
+
if(this.settings.traffic == 1)
|
3847 |
+
this.enableTrafficLayer(true);
|
3848 |
+
if(this.settings.transport == 1)
|
3849 |
+
this.enablePublicTransportLayer(true);
|
3850 |
+
this.showPointsOfInterest(this.settings.show_points_of_interest);
|
3851 |
+
|
3852 |
+
// Move the loading wheel into the map element (it has to live outside in the HTML file because it'll be overwritten by Google otherwise)
|
3853 |
+
$(this.engineElement).append($(this.element).find(".wpgmza-loader"));
|
3854 |
+
}
|
3855 |
+
|
3856 |
+
WPGMZA.GoogleMap.prototype.setOptions = function(options)
|
3857 |
+
{
|
3858 |
+
Parent.prototype.setOptions.call(this, options);
|
3859 |
+
|
3860 |
+
this.googleMap.setOptions(this.settings.toGoogleMapsOptions());
|
3861 |
+
|
3862 |
+
var clone = $.extend({}, options);
|
3863 |
+
if(clone.center instanceof WPGMZA.LatLng || typeof clone.center == "object")
|
3864 |
+
clone.center = {
|
3865 |
+
lat: parseFloat(clone.center.lat),
|
3866 |
+
lng: parseFloat(clone.center.lng)
|
3867 |
+
};
|
3868 |
+
|
3869 |
+
this.googleMap.setOptions(clone);
|
3870 |
+
}
|
3871 |
+
|
3872 |
+
/**
|
3873 |
+
* Adds the specified marker to this map
|
3874 |
+
* @return void
|
3875 |
+
*/
|
3876 |
+
WPGMZA.GoogleMap.prototype.addMarker = function(marker)
|
3877 |
+
{
|
3878 |
+
marker.googleMarker.setMap(this.googleMap);
|
3879 |
+
|
3880 |
+
Parent.prototype.addMarker.call(this, marker);
|
3881 |
+
}
|
3882 |
+
|
3883 |
+
/**
|
3884 |
+
* Removes the specified marker from this map
|
3885 |
+
* @return void
|
3886 |
+
*/
|
3887 |
+
WPGMZA.GoogleMap.prototype.removeMarker = function(marker)
|
3888 |
+
{
|
3889 |
+
marker.googleMarker.setMap(null);
|
3890 |
+
|
3891 |
+
Parent.prototype.removeMarker.call(this, marker);
|
3892 |
+
}
|
3893 |
+
|
3894 |
+
/**
|
3895 |
+
* Adds the specified polygon to this map
|
3896 |
+
* @return void
|
3897 |
+
*/
|
3898 |
+
WPGMZA.GoogleMap.prototype.addPolygon = function(polygon)
|
3899 |
+
{
|
3900 |
+
polygon.googlePolygon.setMap(this.googleMap);
|
3901 |
+
|
3902 |
+
Parent.prototype.addPolygon.call(this, polygon);
|
3903 |
+
}
|
3904 |
+
|
3905 |
+
/**
|
3906 |
+
* Removes the specified polygon from this map
|
3907 |
+
* @return void
|
3908 |
+
*/
|
3909 |
+
WPGMZA.GoogleMap.prototype.removePolygon = function(polygon)
|
3910 |
+
{
|
3911 |
+
polygon.googlePolygon.setMap(null);
|
3912 |
+
|
3913 |
+
Parent.prototype.removePolygon.call(this, polygon);
|
3914 |
+
}
|
3915 |
+
|
3916 |
+
/**
|
3917 |
+
* Adds the specified polyline to this map
|
3918 |
+
* @return void
|
3919 |
+
*/
|
3920 |
+
WPGMZA.GoogleMap.prototype.addPolyline = function(polyline)
|
3921 |
+
{
|
3922 |
+
polyline.googlePolyline.setMap(this.googleMap);
|
3923 |
+
|
3924 |
+
Parent.prototype.addPolyline.call(this, polyline);
|
3925 |
+
}
|
3926 |
+
|
3927 |
+
/**
|
3928 |
+
* Removes the specified polygon from this map
|
3929 |
+
* @return void
|
3930 |
+
*/
|
3931 |
+
WPGMZA.GoogleMap.prototype.removePolyline = function(polyline)
|
3932 |
+
{
|
3933 |
+
polyline.googlePolyline.setMap(null);
|
3934 |
+
|
3935 |
+
Parent.prototype.removePolyline.call(this, polyline);
|
3936 |
+
}
|
3937 |
+
|
3938 |
+
WPGMZA.GoogleMap.prototype.addCircle = function(circle)
|
3939 |
+
{
|
3940 |
+
circle.googleCircle.setMap(this.googleMap);
|
3941 |
+
|
3942 |
+
Parent.prototype.addCircle.call(this, circle);
|
3943 |
+
}
|
3944 |
+
|
3945 |
+
WPGMZA.GoogleMap.prototype.removeCircle = function(circle)
|
3946 |
+
{
|
3947 |
+
circle.googleCircle.setMap(null);
|
3948 |
+
|
3949 |
+
Parent.prototype.removeCircle.call(this, circle);
|
3950 |
+
}
|
3951 |
+
|
3952 |
+
/**
|
3953 |
+
* Delegate for google maps getCenter
|
3954 |
+
* @return void
|
3955 |
+
*/
|
3956 |
+
WPGMZA.GoogleMap.prototype.getCenter = function()
|
3957 |
+
{
|
3958 |
+
var latLng = this.googleMap.getCenter();
|
3959 |
+
|
3960 |
+
return {
|
3961 |
+
lat: latLng.lat(),
|
3962 |
+
lng: latLng.lng()
|
3963 |
+
};
|
3964 |
+
}
|
3965 |
+
|
3966 |
+
/**
|
3967 |
+
* Delegate for google maps setCenter
|
3968 |
+
* @return void
|
3969 |
+
*/
|
3970 |
+
WPGMZA.GoogleMap.prototype.setCenter = function(latLng)
|
3971 |
+
{
|
3972 |
+
WPGMZA.Map.prototype.setCenter.call(this, latLng);
|
3973 |
+
|
3974 |
+
if(latLng instanceof WPGMZA.LatLng)
|
3975 |
+
this.googleMap.setCenter({
|
3976 |
+
lat: latLng.lat,
|
3977 |
+
lng: latLng.lng
|
3978 |
+
});
|
3979 |
+
else
|
3980 |
+
this.googleMap.setCenter(latLng);
|
3981 |
+
}
|
3982 |
+
|
3983 |
+
/**
|
3984 |
+
* Delegate for google maps setPan
|
3985 |
+
* @return void
|
3986 |
+
*/
|
3987 |
+
WPGMZA.GoogleMap.prototype.panTo = function(latLng)
|
3988 |
+
{
|
3989 |
+
if(latLng instanceof WPGMZA.LatLng)
|
3990 |
+
this.googleMap.panTo({
|
3991 |
+
lat: latLng.lat,
|
3992 |
+
lng: latLng.lng
|
3993 |
+
});
|
3994 |
+
else
|
3995 |
+
this.googleMap.panTo(latLng);
|
3996 |
+
}
|
3997 |
+
|
3998 |
+
/**
|
3999 |
+
* Delegate for google maps getCenter
|
4000 |
+
* @return void
|
4001 |
+
*/
|
4002 |
+
WPGMZA.GoogleMap.prototype.getZoom = function()
|
4003 |
+
{
|
4004 |
+
return this.googleMap.getZoom();
|
4005 |
+
}
|
4006 |
+
|
4007 |
+
/**
|
4008 |
+
* Delegate for google maps getZoom
|
4009 |
+
* @return void
|
4010 |
+
*/
|
4011 |
+
WPGMZA.GoogleMap.prototype.setZoom = function(value)
|
4012 |
+
{
|
4013 |
+
if(isNaN(value))
|
4014 |
+
throw new Error("Value must not be NaN");
|
4015 |
+
|
4016 |
+
return this.googleMap.setZoom(value);
|
4017 |
+
}
|
4018 |
+
|
4019 |
+
/**
|
4020 |
+
* Gets the bounds
|
4021 |
+
* @return object
|
4022 |
+
*/
|
4023 |
+
WPGMZA.GoogleMap.prototype.getBounds = function()
|
4024 |
+
{
|
4025 |
+
var bounds = this.googleMap.getBounds();
|
4026 |
+
var northEast = bounds.getNorthEast();
|
4027 |
+
var southWest = bounds.getSouthWest();
|
4028 |
+
|
4029 |
+
return {
|
4030 |
+
topLeft: {
|
4031 |
+
lat: northEast.lat(),
|
4032 |
+
lng: southWest.lng()
|
4033 |
+
},
|
4034 |
+
bottomRight: {
|
4035 |
+
lat: southWest.lat(),
|
4036 |
+
lng: northEast.lng()
|
4037 |
+
}
|
4038 |
+
};
|
4039 |
+
}
|
4040 |
+
|
4041 |
+
/**
|
4042 |
+
* Fit to given boundaries
|
4043 |
+
* @return void
|
4044 |
+
*/
|
4045 |
+
WPGMZA.GoogleMap.prototype.fitBounds = function(southWest, northEast)
|
4046 |
+
{
|
4047 |
+
if(southWest instanceof WPGMZA.LatLng)
|
4048 |
+
southWest = {lat: southWest.lat, lng: southWest.lng};
|
4049 |
+
if(northEast instanceof WPGMZA.LatLng)
|
4050 |
+
northEast = {lat: northEast.lat, lng: northEast.lng};
|
4051 |
+
|
4052 |
+
this.googleMap.fitBounds(southWest, northEast);
|
4053 |
+
}
|
4054 |
+
|
4055 |
+
/**
|
4056 |
+
* Fit the map boundaries to visible markers
|
4057 |
+
* @return void
|
4058 |
+
*/
|
4059 |
+
WPGMZA.GoogleMap.prototype.fitBoundsToVisibleMarkers = function()
|
4060 |
+
{
|
4061 |
+
var bounds = new google.maps.LatLngBounds();
|
4062 |
+
for(var i = 0; i < this.markers.length; i++)
|
4063 |
+
{
|
4064 |
+
if(markers[i].getVisible())
|
4065 |
+
bounds.extend(markers[i].getPosition());
|
4066 |
+
}
|
4067 |
+
this.googleMap.fitBounds(bounds);
|
4068 |
+
}
|
4069 |
+
|
4070 |
+
/**
|
4071 |
+
* Enables / disables the bicycle layer
|
4072 |
+
* @param enable boolean, enable or not
|
4073 |
+
* @return void
|
4074 |
+
*/
|
4075 |
+
WPGMZA.GoogleMap.prototype.enableBicycleLayer = function(enable)
|
4076 |
+
{
|
4077 |
+
if(!this.bicycleLayer)
|
4078 |
+
this.bicycleLayer = new google.maps.BicyclingLayer();
|
4079 |
+
|
4080 |
+
this.bicycleLayer.setMap(
|
4081 |
+
enable ? this.googleMap : null
|
4082 |
+
);
|
4083 |
+
}
|
4084 |
+
|
4085 |
+
/**
|
4086 |
+
* Enables / disables the bicycle layer
|
4087 |
+
* @param enable boolean, enable or not
|
4088 |
+
* @return void
|
4089 |
+
*/
|
4090 |
+
WPGMZA.GoogleMap.prototype.enableTrafficLayer = function(enable)
|
4091 |
+
{
|
4092 |
+
if(!this.trafficLayer)
|
4093 |
+
this.trafficLayer = new google.maps.TrafficLayer();
|
4094 |
+
|
4095 |
+
this.trafficLayer.setMap(
|
4096 |
+
enable ? this.googleMap : null
|
4097 |
+
);
|
4098 |
+
}
|
4099 |
+
|
4100 |
+
/**
|
4101 |
+
* Enables / disables the bicycle layer
|
4102 |
+
* @param enable boolean, enable or not
|
4103 |
+
* @return void
|
4104 |
+
*/
|
4105 |
+
WPGMZA.GoogleMap.prototype.enablePublicTransportLayer = function(enable)
|
4106 |
+
{
|
4107 |
+
if(!this.publicTransportLayer)
|
4108 |
+
this.publicTransportLayer = new google.maps.TransitLayer();
|
4109 |
+
|
4110 |
+
this.publicTransportLayer.setMap(
|
4111 |
+
enable ? this.googleMap : null
|
4112 |
+
);
|
4113 |
+
}
|
4114 |
+
|
4115 |
+
/**
|
4116 |
+
* Shows / hides points of interest
|
4117 |
+
* @param show boolean, enable or not
|
4118 |
+
* @return void
|
4119 |
+
*/
|
4120 |
+
WPGMZA.GoogleMap.prototype.showPointsOfInterest = function(show)
|
4121 |
+
{
|
4122 |
+
// TODO: This will bug the front end because there is textarea with theme data
|
4123 |
+
var text = $("textarea[name='theme_data']").val();
|
4124 |
+
|
4125 |
+
if(!text)
|
4126 |
+
return;
|
4127 |
+
|
4128 |
+
var styles = JSON.parse(text);
|
4129 |
+
|
4130 |
+
styles.push({
|
4131 |
+
featureType: "poi",
|
4132 |
+
stylers: [
|
4133 |
+
{
|
4134 |
+
visibility: (show ? "on" : "off")
|
4135 |
+
}
|
4136 |
+
]
|
4137 |
+
});
|
4138 |
+
|
4139 |
+
this.googleMap.setOptions({styles: styles});
|
4140 |
+
}
|
4141 |
+
|
4142 |
+
/**
|
4143 |
+
* Gets the min zoom of the map
|
4144 |
+
* @return int
|
4145 |
+
*/
|
4146 |
+
WPGMZA.GoogleMap.prototype.getMinZoom = function()
|
4147 |
+
{
|
4148 |
+
return parseInt(this.settings.min_zoom);
|
4149 |
+
}
|
4150 |
+
|
4151 |
+
/**
|
4152 |
+
* Sets the min zoom of the map
|
4153 |
+
* @return void
|
4154 |
+
*/
|
4155 |
+
WPGMZA.GoogleMap.prototype.setMinZoom = function(value)
|
4156 |
+
{
|
4157 |
+
this.googleMap.setOptions({
|
4158 |
+
minZoom: value,
|
4159 |
+
maxZoom: this.getMaxZoom()
|
4160 |
+
});
|
4161 |
+
}
|
4162 |
+
|
4163 |
+
/**
|
4164 |
+
* Gets the min zoom of the map
|
4165 |
+
* @return int
|
4166 |
+
*/
|
4167 |
+
WPGMZA.GoogleMap.prototype.getMaxZoom = function()
|
4168 |
+
{
|
4169 |
+
return parseInt(this.settings.max_zoom);
|
4170 |
+
}
|
4171 |
+
|
4172 |
+
/**
|
4173 |
+
* Sets the min zoom of the map
|
4174 |
+
* @return void
|
4175 |
+
*/
|
4176 |
+
WPGMZA.GoogleMap.prototype.setMaxZoom = function(value)
|
4177 |
+
{
|
4178 |
+
this.googleMap.setOptions({
|
4179 |
+
minZoom: this.getMinZoom(),
|
4180 |
+
maxZoom: value
|
4181 |
+
});
|
4182 |
+
}
|
4183 |
+
|
4184 |
+
WPGMZA.GoogleMap.prototype.latLngToPixels = function(latLng)
|
4185 |
+
{
|
4186 |
+
var map = this.googleMap;
|
4187 |
+
var nativeLatLng = new google.maps.LatLng({
|
4188 |
+
lat: parseFloat(latLng.lat),
|
4189 |
+
lng: parseFloat(latLng.lng)
|
4190 |
+
});
|
4191 |
+
var topRight = map.getProjection().fromLatLngToPoint(map.getBounds().getNorthEast());
|
4192 |
+
var bottomLeft = map.getProjection().fromLatLngToPoint(map.getBounds().getSouthWest());
|
4193 |
+
var scale = Math.pow(2, map.getZoom());
|
4194 |
+
var worldPoint = map.getProjection().fromLatLngToPoint(nativeLatLng);
|
4195 |
+
return {
|
4196 |
+
x: (worldPoint.x - bottomLeft.x) * scale,
|
4197 |
+
y: (worldPoint.y - topRight.y) * scale
|
4198 |
+
};
|
4199 |
+
}
|
4200 |
+
|
4201 |
+
WPGMZA.GoogleMap.prototype.pixelsToLatLng = function(x, y)
|
4202 |
+
{
|
4203 |
+
if(y == undefined)
|
4204 |
+
{
|
4205 |
+
if("x" in x && "y" in x)
|
4206 |
+
{
|
4207 |
+
y = x.y;
|
4208 |
+
x = x.x;
|
4209 |
+
}
|
4210 |
+
else
|
4211 |
+
console.warn("Y coordinate undefined in pixelsToLatLng (did you mean to pass 2 arguments?)");
|
4212 |
+
}
|
4213 |
+
|
4214 |
+
var map = this.googleMap;
|
4215 |
+
var topRight = map.getProjection().fromLatLngToPoint(map.getBounds().getNorthEast());
|
4216 |
+
var bottomLeft = map.getProjection().fromLatLngToPoint(map.getBounds().getSouthWest());
|
4217 |
+
var scale = Math.pow(2, map.getZoom());
|
4218 |
+
var worldPoint = new google.maps.Point(x / scale + bottomLeft.x, y / scale + topRight.y);
|
4219 |
+
var latLng = map.getProjection().fromPointToLatLng(worldPoint);
|
4220 |
+
return {
|
4221 |
+
lat: latLng.lat(),
|
4222 |
+
lng: latLng.lng()
|
4223 |
+
};
|
4224 |
+
}
|
4225 |
+
|
4226 |
+
/**
|
4227 |
+
* Handle the map element resizing
|
4228 |
+
* @return void
|
4229 |
+
*/
|
4230 |
+
WPGMZA.GoogleMap.prototype.onElementResized = function(event)
|
4231 |
+
{
|
4232 |
+
if(!this.googleMap)
|
4233 |
+
return;
|
4234 |
+
google.maps.event.trigger(this.googleMap, "resize");
|
4235 |
+
}
|
4236 |
+
|
4237 |
+
});
|
4238 |
+
|
4239 |
+
// js/v8/google-maps/google-marker.js
|
4240 |
+
/**
|
4241 |
+
* @namespace WPGMZA
|
4242 |
+
* @module GoogleMarker
|
4243 |
+
* @requires WPGMZA.Marker
|
4244 |
+
* @pro-requires WPGMZA.ProMarker
|
4245 |
+
*/
|
4246 |
+
jQuery(function($) {
|
4247 |
+
|
4248 |
+
var Parent;
|
4249 |
+
|
4250 |
+
WPGMZA.GoogleMarker = function(row)
|
4251 |
+
{
|
4252 |
+
var self = this;
|
4253 |
+
|
4254 |
+
Parent.call(this, row);
|
4255 |
+
|
4256 |
+
var settings = {};
|
4257 |
+
if(row)
|
4258 |
+
{
|
4259 |
+
for(var name in row)
|
4260 |
+
{
|
4261 |
+
if(row[name] instanceof WPGMZA.LatLng)
|
4262 |
+
{
|
4263 |
+
settings[name] = row[name].toGoogleLatLng();
|
4264 |
+
}
|
4265 |
+
else if(row[name] instanceof WPGMZA.Map)
|
4266 |
+
{
|
4267 |
+
// Do nothing (ignore)
|
4268 |
+
}
|
4269 |
+
else
|
4270 |
+
settings[name] = row[name];
|
4271 |
+
}
|
4272 |
+
}
|
4273 |
+
|
4274 |
+
this.googleMarker = new google.maps.Marker(settings);
|
4275 |
+
this.googleMarker.wpgmzaMarker = this;
|
4276 |
+
|
4277 |
+
this.googleMarker.setPosition(new google.maps.LatLng({
|
4278 |
+
lat: parseFloat(this.lat),
|
4279 |
+
lng: parseFloat(this.lng)
|
4280 |
+
}));
|
4281 |
+
|
4282 |
+
this.googleMarker.setLabel(this.settings.label);
|
4283 |
+
|
4284 |
+
if(this.animation)
|
4285 |
+
this.googleMarker.setAnimation(this.animation);
|
4286 |
+
|
4287 |
+
google.maps.event.addListener(this.googleMarker, "click", function() {
|
4288 |
+
self.dispatchEvent("click");
|
4289 |
+
self.dispatchEvent("select");
|
4290 |
+
});
|
4291 |
+
|
4292 |
+
google.maps.event.addListener(this.googleMarker, "mouseover", function() {
|
4293 |
+
self.dispatchEvent("mouseover");
|
4294 |
+
});
|
4295 |
+
|
4296 |
+
google.maps.event.addListener(this.googleMarker, "dragend", function() {
|
4297 |
+
var googleMarkerPosition = self.googleMarker.getPosition();
|
4298 |
+
|
4299 |
+
self.setPosition({
|
4300 |
+
lat: googleMarkerPosition.lat(),
|
4301 |
+
lng: googleMarkerPosition.lng()
|
4302 |
+
});
|
4303 |
+
|
4304 |
+
self.dispatchEvent({
|
4305 |
+
type: "dragend",
|
4306 |
+
latLng: self.getPosition()
|
4307 |
+
});
|
4308 |
+
});
|
4309 |
+
|
4310 |
+
this.trigger("init");
|
4311 |
+
}
|
4312 |
+
|
4313 |
+
if(WPGMZA.isProVersion())
|
4314 |
+
Parent = WPGMZA.ProMarker;
|
4315 |
+
else
|
4316 |
+
Parent = WPGMZA.Marker;
|
4317 |
+
WPGMZA.GoogleMarker.prototype = Object.create(Parent.prototype);
|
4318 |
+
WPGMZA.GoogleMarker.prototype.constructor = WPGMZA.GoogleMarker;
|
4319 |
+
|
4320 |
+
WPGMZA.GoogleMarker.prototype.setLabel = function(label)
|
4321 |
+
{
|
4322 |
+
if(!label)
|
4323 |
+
{
|
4324 |
+
this.googleMarker.setLabel(null);
|
4325 |
+
return;
|
4326 |
+
}
|
4327 |
+
|
4328 |
+
this.googleMarker.setLabel({
|
4329 |
+
text: label
|
4330 |
+
});
|
4331 |
+
|
4332 |
+
if(!this.googleMarker.getIcon())
|
4333 |
+
this.googleMarker.setIcon(WPGMZA.settings.default_marker_icon);
|
4334 |
+
}
|
4335 |
+
|
4336 |
+
/**
|
4337 |
+
* Sets the position of the marker
|
4338 |
+
* @return void
|
4339 |
+
*/
|
4340 |
+
WPGMZA.GoogleMarker.prototype.setPosition = function(latLng)
|
4341 |
+
{
|
4342 |
+
Parent.prototype.setPosition.call(this, latLng);
|
4343 |
+
this.googleMarker.setPosition({
|
4344 |
+
lat: this.lat,
|
4345 |
+
lng: this.lng
|
4346 |
+
});
|
4347 |
+
}
|
4348 |
+
|
4349 |
+
/**
|
4350 |
+
* Sets the position offset of a marker
|
4351 |
+
* @return void
|
4352 |
+
*/
|
4353 |
+
WPGMZA.GoogleMarker.prototype.setOffset = function(x, y)
|
4354 |
+
{
|
4355 |
+
var self = this;
|
4356 |
+
var icon = this.googleMarker.getIcon();
|
4357 |
+
var img = new Image();
|
4358 |
+
var params;
|
4359 |
+
|
4360 |
+
if(typeof icon == "string")
|
4361 |
+
params = {
|
4362 |
+
url: icon
|
4363 |
+
};
|
4364 |
+
else
|
4365 |
+
params = icon;
|
4366 |
+
|
4367 |
+
img.onload = function()
|
4368 |
+
{
|
4369 |
+
var defaultAnchor = {
|
4370 |
+
x: img.width / 2,
|
4371 |
+
y: img.height
|
4372 |
+
};
|
4373 |
+
|
4374 |
+
params.anchor = new google.maps.Point(defaultAnchor.x - x, defaultAnchor.y - y);
|
4375 |
+
|
4376 |
+
self.googleMarker.setIcon(params);
|
4377 |
+
}
|
4378 |
+
|
4379 |
+
img.src = params.url;
|
4380 |
+
}
|
4381 |
+
|
4382 |
+
WPGMZA.GoogleMarker.prototype.setOptions = function(options)
|
4383 |
+
{
|
4384 |
+
this.googleMarker.setOptions(options);
|
4385 |
+
}
|
4386 |
+
|
4387 |
+
/**
|
4388 |
+
* Set the marker animation
|
4389 |
+
* @return void
|
4390 |
+
*/
|
4391 |
+
WPGMZA.GoogleMarker.prototype.setAnimation = function(animation)
|
4392 |
+
{
|
4393 |
+
Parent.prototype.setAnimation.call(this, animation);
|
4394 |
+
this.googleMarker.setAnimation(animation);
|
4395 |
+
}
|
4396 |
+
|
4397 |
+
/**
|
4398 |
+
* Sets the visibility of the marker
|
4399 |
+
* @return void
|
4400 |
+
*/
|
4401 |
+
WPGMZA.GoogleMarker.prototype.setVisible = function(visible)
|
4402 |
+
{
|
4403 |
+
Parent.prototype.setVisible.call(this, visible);
|
4404 |
+
|
4405 |
+
this.googleMarker.setVisible(visible);
|
4406 |
+
}
|
4407 |
+
|
4408 |
+
WPGMZA.GoogleMarker.prototype.setDraggable = function(draggable)
|
4409 |
+
{
|
4410 |
+
this.googleMarker.setDraggable(draggable);
|
4411 |
+
}
|
4412 |
+
|
4413 |
+
});
|
4414 |
+
|
4415 |
+
// js/v8/google-maps/google-modern-store-locator-circle.js
|
4416 |
+
/**
|
4417 |
+
* @namespace WPGMZA
|
4418 |
+
* @module GoogleModernStoreLocatorCircle
|
4419 |
+
* @requires WPGMZA.ModernStoreLocatorCircle
|
4420 |
+
*/
|
4421 |
+
jQuery(function($) {
|
4422 |
+
|
4423 |
+
WPGMZA.GoogleModernStoreLocatorCircle = function(map, settings)
|
4424 |
+
{
|
4425 |
+
var self = this;
|
4426 |
+
|
4427 |
+
WPGMZA.ModernStoreLocatorCircle.call(this, map, settings);
|
4428 |
+
|
4429 |
+
this.intervalID = setInterval(function() {
|
4430 |
+
|
4431 |
+
var mapSize = {
|
4432 |
+
width: $(self.mapElement).width(),
|
4433 |
+
height: $(self.mapElement).height()
|
4434 |
+
};
|
4435 |
+
|
4436 |
+
if(mapSize.width == self.mapSize.width && mapSize.height == self.mapSize.height)
|
4437 |
+
return;
|
4438 |
+
|
4439 |
+
self.canvasLayer.resize_();
|
4440 |
+
self.canvasLayer.draw();
|
4441 |
+
|
4442 |
+
self.mapSize = mapSize;
|
4443 |
+
|
4444 |
+
}, 1000);
|
4445 |
+
|
4446 |
+
$(document).bind('webkitfullscreenchange mozfullscreenchange fullscreenchange', function() {
|
4447 |
+
|
4448 |
+
self.canvasLayer.resize_();
|
4449 |
+
self.canvasLayer.draw();
|
4450 |
+
|
4451 |
+
});
|
4452 |
+
}
|
4453 |
+
|
4454 |
+
WPGMZA.GoogleModernStoreLocatorCircle.prototype = Object.create(WPGMZA.ModernStoreLocatorCircle.prototype);
|
4455 |
+
WPGMZA.GoogleModernStoreLocatorCircle.prototype.constructor = WPGMZA.GoogleModernStoreLocatorCircle;
|
4456 |
+
|
4457 |
+
WPGMZA.GoogleModernStoreLocatorCircle.prototype.initCanvasLayer = function()
|
4458 |
+
{
|
4459 |
+
var self = this;
|
4460 |
+
|
4461 |
+
if(this.canvasLayer)
|
4462 |
+
{
|
4463 |
+
this.canvasLayer.setMap(null);
|
4464 |
+
this.canvasLayer.setAnimate(false);
|
4465 |
+
}
|
4466 |
+
|
4467 |
+
this.canvasLayer = new CanvasLayer({
|
4468 |
+
map: this.map.googleMap,
|
4469 |
+
resizeHandler: function(event) {
|
4470 |
+
self.onResize(event);
|
4471 |
+
},
|
4472 |
+
updateHandler: function(event) {
|
4473 |
+
self.onUpdate(event);
|
4474 |
+
},
|
4475 |
+
animate: true,
|
4476 |
+
resolutionScale: this.getResolutionScale()
|
4477 |
+
});
|
4478 |
+
}
|
4479 |
+
|
4480 |
+
WPGMZA.GoogleModernStoreLocatorCircle.prototype.setOptions = function(options)
|
4481 |
+
{
|
4482 |
+
WPGMZA.ModernStoreLocatorCircle.prototype.setOptions.call(this, options);
|
4483 |
+
|
4484 |
+
this.canvasLayer.scheduleUpdate();
|
4485 |
+
}
|
4486 |
+
|
4487 |
+
WPGMZA.GoogleModernStoreLocatorCircle.prototype.setPosition = function(position)
|
4488 |
+
{
|
4489 |
+
WPGMZA.ModernStoreLocatorCircle.prototype.setPosition.call(this, position);
|
4490 |
+
|
4491 |
+
this.canvasLayer.scheduleUpdate();
|
4492 |
+
}
|
4493 |
+
|
4494 |
+
WPGMZA.GoogleModernStoreLocatorCircle.prototype.setRadius = function(radius)
|
4495 |
+
{
|
4496 |
+
WPGMZA.ModernStoreLocatorCircle.prototype.setRadius.call(this, radius);
|
4497 |
+
|
4498 |
+
this.canvasLayer.scheduleUpdate();
|
4499 |
+
}
|
4500 |
+
|
4501 |
+
WPGMZA.GoogleModernStoreLocatorCircle.prototype.getTransformedRadius = function(km)
|
4502 |
+
{
|
4503 |
+
var multiplierAtEquator = 0.006395;
|
4504 |
+
var spherical = google.maps.geometry.spherical;
|
4505 |
+
|
4506 |
+
var center = this.settings.center;
|
4507 |
+
var equator = new WPGMZA.LatLng({
|
4508 |
+
lat: 0.0,
|
4509 |
+
lng: 0.0
|
4510 |
+
});
|
4511 |
+
var latitude = new WPGMZA.LatLng({
|
4512 |
+
lat: center.lat,
|
4513 |
+
lng: 0.0
|
4514 |
+
});
|
4515 |
+
|
4516 |
+
var offsetAtEquator = spherical.computeOffset(equator.toGoogleLatLng(), km * 1000, 90);
|
4517 |
+
var offsetAtLatitude = spherical.computeOffset(latitude.toGoogleLatLng(), km * 1000, 90);
|
4518 |
+
|
4519 |
+
var factor = offsetAtLatitude.lng() / offsetAtEquator.lng();
|
4520 |
+
var result = km * multiplierAtEquator * factor;
|
4521 |
+
|
4522 |
+
if(isNaN(result))
|
4523 |
+
throw new Error("here");
|
4524 |
+
|
4525 |
+
return result;
|
4526 |
+
}
|
4527 |
+
|
4528 |
+
WPGMZA.GoogleModernStoreLocatorCircle.prototype.getCanvasDimensions = function()
|
4529 |
+
{
|
4530 |
+
return {
|
4531 |
+
width: this.canvasLayer.canvas.width,
|
4532 |
+
height: this.canvasLayer.canvas.height
|
4533 |
+
};
|
4534 |
+
}
|
4535 |
+
|
4536 |
+
WPGMZA.GoogleModernStoreLocatorCircle.prototype.getWorldOriginOffset = function()
|
4537 |
+
{
|
4538 |
+
var projection = this.map.googleMap.getProjection();
|
4539 |
+
var position = projection.fromLatLngToPoint(this.canvasLayer.getTopLeft());
|
4540 |
+
|
4541 |
+
return {
|
4542 |
+
x: -position.x,
|
4543 |
+
y: -position.y
|
4544 |
+
};
|
4545 |
+
}
|
4546 |
+
|
4547 |
+
WPGMZA.GoogleModernStoreLocatorCircle.prototype.getCenterPixels = function()
|
4548 |
+
{
|
4549 |
+
var center = new WPGMZA.LatLng(this.settings.center);
|
4550 |
+
var projection = this.map.googleMap.getProjection();
|
4551 |
+
return projection.fromLatLngToPoint(center.toGoogleLatLng());
|
4552 |
+
}
|
4553 |
+
|
4554 |
+
WPGMZA.GoogleModernStoreLocatorCircle.prototype.getContext = function(type)
|
4555 |
+
{
|
4556 |
+
return this.canvasLayer.canvas.getContext("2d");
|
4557 |
+
}
|
4558 |
+
|
4559 |
+
WPGMZA.GoogleModernStoreLocatorCircle.prototype.getScale = function()
|
4560 |
+
{
|
4561 |
+
return Math.pow(2, this.map.getZoom()) * this.getResolutionScale();
|
4562 |
+
}
|
4563 |
+
|
4564 |
+
WPGMZA.GoogleModernStoreLocatorCircle.prototype.setVisible = function(visible)
|
4565 |
+
{
|
4566 |
+
WPGMZA.ModernStoreLocatorCircle.prototype.setVisible.call(this, visible);
|
4567 |
+
|
4568 |
+
this.canvasLayer.scheduleUpdate();
|
4569 |
+
}
|
4570 |
+
|
4571 |
+
WPGMZA.GoogleModernStoreLocatorCircle.prototype.destroy = function()
|
4572 |
+
{
|
4573 |
+
this.canvasLayer.setMap(null);
|
4574 |
+
this.canvasLayer = null;
|
4575 |
+
|
4576 |
+
clearInterval(this.intervalID);
|
4577 |
+
}
|
4578 |
+
|
4579 |
+
});
|
4580 |
+
|
4581 |
+
// js/v8/google-maps/google-modern-store-locator.js
|
4582 |
+
/**
|
4583 |
+
* @namespace WPGMZA
|
4584 |
+
* @module GoogleModernStoreLocator
|
4585 |
+
* @requires WPGMZA.ModernStoreLocator
|
4586 |
+
*/
|
4587 |
+
jQuery(function($) {
|
4588 |
+
|
4589 |
+
WPGMZA.GoogleModernStoreLocator = function(map_id)
|
4590 |
+
{
|
4591 |
+
WPGMZA.ModernStoreLocator.call(this, map_id);
|
4592 |
+
|
4593 |
+
var googleMap;
|
4594 |
+
|
4595 |
+
if(WPGMZA.isProVersion())
|
4596 |
+
googleMap = MYMAP[map_id].map.googleMap;
|
4597 |
+
else
|
4598 |
+
googleMap = MYMAP.map.googleMap;
|
4599 |
+
|
4600 |
+
googleMap.controls[google.maps.ControlPosition.TOP_CENTER].push(this.element);
|
4601 |
+
}
|
4602 |
+
|
4603 |
+
WPGMZA.GoogleModernStoreLocator.prototype = Object.create(WPGMZA.ModernStoreLocator.prototype);
|
4604 |
+
WPGMZA.GoogleModernStoreLocator.prototype.constructor = WPGMZA.GoogleModernStoreLocator;
|
4605 |
+
|
4606 |
+
});
|
4607 |
+
|
4608 |
+
// js/v8/google-maps/google-polygon.js
|
4609 |
+
/**
|
4610 |
+
* @namespace WPGMZA
|
4611 |
+
* @module GooglePolygon
|
4612 |
+
* @requires WPGMZA.Polygon
|
4613 |
+
* @pro-requires WPGMZA.ProPolygon
|
4614 |
+
*/
|
4615 |
+
jQuery(function($) {
|
4616 |
+
|
4617 |
+
var Parent;
|
4618 |
+
|
4619 |
+
WPGMZA.GooglePolygon = function(row, googlePolygon)
|
4620 |
+
{
|
4621 |
+
var self = this;
|
4622 |
+
|
4623 |
+
Parent.call(this, row, googlePolygon);
|
4624 |
+
|
4625 |
+
if(googlePolygon)
|
4626 |
+
{
|
4627 |
+
this.googlePolygon = googlePolygon;
|
4628 |
+
}
|
4629 |
+
else
|
4630 |
+
{
|
4631 |
+
this.googlePolygon = new google.maps.Polygon(this.settings);
|
4632 |
+
|
4633 |
+
if(row && row.points)
|
4634 |
+
{
|
4635 |
+
var paths = this.parseGeometry(row.points);
|
4636 |
+
this.googlePolygon.setOptions({paths: paths});
|
4637 |
+
}
|
4638 |
+
}
|
4639 |
+
|
4640 |
+
this.googlePolygon.wpgmzaPolygon = this;
|
4641 |
+
|
4642 |
+
google.maps.event.addListener(this.googlePolygon, "click", function() {
|
4643 |
+
self.dispatchEvent({type: "click"});
|
4644 |
+
});
|
4645 |
+
}
|
4646 |
+
|
4647 |
+
if(WPGMZA.isProVersion())
|
4648 |
+
Parent = WPGMZA.ProPolygon;
|
4649 |
+
else
|
4650 |
+
Parent = WPGMZA.Polygon;
|
4651 |
+
|
4652 |
+
WPGMZA.GooglePolygon.prototype = Object.create(Parent.prototype);
|
4653 |
+
WPGMZA.GooglePolygon.prototype.constructor = WPGMZA.GooglePolygon;
|
4654 |
+
|
4655 |
+
/**
|
4656 |
+
* Returns true if the polygon is editable
|
4657 |
+
* @return void
|
4658 |
+
*/
|
4659 |
+
WPGMZA.GooglePolygon.prototype.getEditable = function()
|
4660 |
+
{
|
4661 |
+
return this.googlePolygon.getOptions().editable;
|
4662 |
+
}
|
4663 |
+
|
4664 |
+
/**
|
4665 |
+
* Sets the editable state of the polygon
|
4666 |
+
* @return void
|
4667 |
+
*/
|
4668 |
+
WPGMZA.GooglePolygon.prototype.setEditable = function(value)
|
4669 |
+
{
|
4670 |
+
this.googlePolygon.setOptions({editable: value});
|
4671 |
+
}
|
4672 |
+
|
4673 |
+
/**
|
4674 |
+
* Returns the polygon represented by a JSON object
|
4675 |
+
* @return object
|
4676 |
+
*/
|
4677 |
+
WPGMZA.GooglePolygon.prototype.toJSON = function()
|
4678 |
+
{
|
4679 |
+
var result = WPGMZA.Polygon.prototype.toJSON.call(this);
|
4680 |
+
|
4681 |
+
result.points = [];
|
4682 |
+
|
4683 |
+
// TODO: Support holes using multiple paths
|
4684 |
+
var path = this.googlePolygon.getPath();
|
4685 |
+
for(var i = 0; i < path.getLength(); i++)
|
4686 |
+
{
|
4687 |
+
var latLng = path.getAt(i);
|
4688 |
+
result.points.push({
|
4689 |
+
lat: latLng.lat(),
|
4690 |
+
lng: latLng.lng()
|
4691 |
+
});
|
4692 |
+
}
|
4693 |
+
|
4694 |
+
return result;
|
4695 |
+
}
|
4696 |
+
|
4697 |
+
});
|
4698 |
+
|
4699 |
+
// js/v8/google-maps/google-polyline.js
|
4700 |
+
/**
|
4701 |
+
* @namespace WPGMZA
|
4702 |
+
* @module GooglePolyline
|
4703 |
+
* @requires WPGMZA.Polyline
|
4704 |
+
*/
|
4705 |
+
jQuery(function($) {
|
4706 |
+
|
4707 |
+
WPGMZA.GooglePolyline = function(row, googlePolyline)
|
4708 |
+
{
|
4709 |
+
var self = this;
|
4710 |
+
|
4711 |
+
WPGMZA.Polyline.call(this, row, googlePolyline);
|
4712 |
+
|
4713 |
+
if(googlePolyline)
|
4714 |
+
{
|
4715 |
+
this.googlePolyline = googlePolyline;
|
4716 |
+
}
|
4717 |
+
else
|
4718 |
+
{
|
4719 |
+
this.googlePolyline = new google.maps.Polyline(this.settings);
|
4720 |
+
this.googlePolyline.wpgmzaPolyline = this;
|
4721 |
+
|
4722 |
+
if(row && row.points)
|
4723 |
+
{
|
4724 |
+
var path = this.parseGeometry(row.points);
|
4725 |
+
this.setPoints(path);
|
4726 |
+
}
|
4727 |
+
}
|
4728 |
+
|
4729 |
+
google.maps.event.addListener(this.googlePolyline, "click", function() {
|
4730 |
+
self.dispatchEvent({type: "click"});
|
4731 |
+
});
|
4732 |
+
}
|
4733 |
+
|
4734 |
+
WPGMZA.GooglePolyline.prototype = Object.create(WPGMZA.Polyline.prototype);
|
4735 |
+
WPGMZA.GooglePolyline.prototype.constructor = WPGMZA.GooglePolyline;
|
4736 |
+
|
4737 |
+
WPGMZA.GooglePolyline.prototype.setEditable = function(value)
|
4738 |
+
{
|
4739 |
+
this.googlePolyline.setOptions({editable: value});
|
4740 |
+
}
|
4741 |
+
|
4742 |
+
WPGMZA.GooglePolyline.prototype.setPoints = function(points)
|
4743 |
+
{
|
4744 |
+
this.googlePolyline.setOptions({path: points});
|
4745 |
+
}
|
4746 |
+
|
4747 |
+
WPGMZA.GooglePolyline.prototype.toJSON = function()
|
4748 |
+
{
|
4749 |
+
var result = WPGMZA.Polyline.prototype.toJSON.call(this);
|
4750 |
+
|
4751 |
+
result.points = [];
|
4752 |
+
|
4753 |
+
var path = this.googlePolyline.getPath();
|
4754 |
+
for(var i = 0; i < path.getLength(); i++)
|
4755 |
+
{
|
4756 |
+
var latLng = path.getAt(i);
|
4757 |
+
result.points.push({
|
4758 |
+
lat: latLng.lat(),
|
4759 |
+
lng: latLng.lng()
|
4760 |
+
});
|
4761 |
+
}
|
4762 |
+
|
4763 |
+
return result;
|
4764 |
+
}
|
4765 |
+
|
4766 |
+
});
|
4767 |
+
|
4768 |
+
// js/v8/google-maps/google-vertex-context-menu.js
|
4769 |
+
/**
|
4770 |
+
* @namespace WPGMZA
|
4771 |
+
* @module GoogleVertexContextMenu
|
4772 |
+
* @requires wpgmza_api_call
|
4773 |
+
*/
|
4774 |
+
jQuery(function($) {
|
4775 |
+
|
4776 |
+
if(WPGMZA.settings.engine != "google-maps")
|
4777 |
+
return;
|
4778 |
+
|
4779 |
+
if(WPGMZA.googleAPIStatus && WPGMZA.googleAPIStatus.code == "USER_CONSENT_NOT_GIVEN")
|
4780 |
+
return;
|
4781 |
+
|
4782 |
+
WPGMZA.GoogleVertexContextMenu = function(mapEditPage)
|
4783 |
+
{
|
4784 |
+
var self = this;
|
4785 |
+
|
4786 |
+
this.mapEditPage = mapEditPage;
|
4787 |
+
|
4788 |
+
this.element = document.createElement("div");
|
4789 |
+
this.element.className = "wpgmza-vertex-context-menu";
|
4790 |
+
this.element.innerHTML = "Delete";
|
4791 |
+
|
4792 |
+
google.maps.event.addDomListener(this.element, "click", function(event) {
|
4793 |
+
self.removeVertex();
|
4794 |
+
event.preventDefault();
|
4795 |
+
event.stopPropagation();
|
4796 |
+
return false;
|
4797 |
+
});
|
4798 |
+
}
|
4799 |
+
|
4800 |
+
WPGMZA.GoogleVertexContextMenu.prototype = new google.maps.OverlayView();
|
4801 |
+
|
4802 |
+
WPGMZA.GoogleVertexContextMenu.prototype.onAdd = function()
|
4803 |
+
{
|
4804 |
+
var self = this;
|
4805 |
+
var map = this.getMap();
|
4806 |
+
|
4807 |
+
this.getPanes().floatPane.appendChild(this.element);
|
4808 |
+
this.divListener = google.maps.event.addDomListener(map.getDiv(), "mousedown", function(e) {
|
4809 |
+
if(e.target != self.element)
|
4810 |
+
self.close();
|
4811 |
+
}, true);
|
4812 |
+
}
|
4813 |
+
|
4814 |
+
WPGMZA.GoogleVertexContextMenu.prototype.onRemove = function()
|
4815 |
+
{
|
4816 |
+
google.maps.event.removeListener(this.divListener);
|
4817 |
+
this.element.parentNode.removeChild(this.element);
|
4818 |
+
|
4819 |
+
this.set("position");
|
4820 |
+
this.set("path");
|
4821 |
+
this.set("vertex");
|
4822 |
+
}
|
4823 |
+
|
4824 |
+
WPGMZA.GoogleVertexContextMenu.prototype.open = function(map, path, vertex)
|
4825 |
+
{
|
4826 |
+
this.set('position', path.getAt(vertex));
|
4827 |
+
this.set('path', path);
|
4828 |
+
this.set('vertex', vertex);
|
4829 |
+
this.setMap(map);
|
4830 |
+
this.draw();
|
4831 |
+
}
|
4832 |
+
|
4833 |
+
WPGMZA.GoogleVertexContextMenu.prototype.close = function()
|
4834 |
+
{
|
4835 |
+
this.setMap(null);
|
4836 |
+
}
|
4837 |
+
|
4838 |
+
WPGMZA.GoogleVertexContextMenu.prototype.draw = function()
|
4839 |
+
{
|
4840 |
+
var position = this.get('position');
|
4841 |
+
var projection = this.getProjection();
|
4842 |
+
|
4843 |
+
if (!position || !projection)
|
4844 |
+
return;
|
4845 |
+
|
4846 |
+
var point = projection.fromLatLngToDivPixel(position);
|
4847 |
+
this.element.style.top = point.y + 'px';
|
4848 |
+
this.element.style.left = point.x + 'px';
|
4849 |
+
}
|
4850 |
+
|
4851 |
+
WPGMZA.GoogleVertexContextMenu.prototype.removeVertex = function()
|
4852 |
+
{
|
4853 |
+
var path = this.get('path');
|
4854 |
+
var vertex = this.get('vertex');
|
4855 |
+
|
4856 |
+
if (!path || vertex == undefined) {
|
4857 |
+
this.close();
|
4858 |
+
return;
|
4859 |
+
}
|
4860 |
+
|
4861 |
+
path.removeAt(vertex);
|
4862 |
+
this.close();
|
4863 |
+
}
|
4864 |
+
|
4865 |
+
});
|
4866 |
+
|
4867 |
+
// js/v8/open-layers/ol-circle.js
|
4868 |
+
/**
|
4869 |
+
* @namespace WPGMZA
|
4870 |
+
* @module OLCircle
|
4871 |
+
* @requires WPGMZA.Circle
|
4872 |
+
*/
|
4873 |
+
jQuery(function($) {
|
4874 |
+
|
4875 |
+
var Parent = WPGMZA.Circle;
|
4876 |
+
|
4877 |
+
WPGMZA.OLCircle = function(options, olFeature)
|
4878 |
+
{
|
4879 |
+
var self = this;
|
4880 |
+
|
4881 |
+
this.center = {lat: 0, lng: 0};
|
4882 |
+
this.radius = 0;
|
4883 |
+
|
4884 |
+
Parent.call(this, options, olFeature);
|
4885 |
+
|
4886 |
+
if(!this.settings.fillColor)
|
4887 |
+
{
|
4888 |
+
this.settings.fillColor = "#ff0000";
|
4889 |
+
this.settings.fillOpacity = 0.6;
|
4890 |
+
}
|
4891 |
+
|
4892 |
+
this.olStyle = new ol.style.Style(this.getStyleFromSettings());
|
4893 |
+
|
4894 |
+
// IMPORTANT: Please note that due to what appears to be a bug in OpenLayers, the following code MUST be exected specifically in this order, or the circle won't appear
|
4895 |
+
var vectorLayer3857 = new ol.layer.Vector({
|
4896 |
+
source: new ol.source.Vector(),
|
4897 |
+
style: this.olStyle
|
4898 |
+
});
|
4899 |
+
|
4900 |
+
if(olFeature)
|
4901 |
+
{
|
4902 |
+
this.olFeature = olFeature;
|
4903 |
+
}
|
4904 |
+
else
|
4905 |
+
{
|
4906 |
+
var wgs84Sphere = new ol.Sphere(6378137);
|
4907 |
+
var radius = this.radius;
|
4908 |
+
var x, y;
|
4909 |
+
|
4910 |
+
x = this.center.lng;
|
4911 |
+
y = this.center.lat;
|
4912 |
+
|
4913 |
+
var circle4326 = ol.geom.Polygon.circular(wgs84Sphere, [x, y], radius, 64);
|
4914 |
+
var circle3857 = circle4326.clone().transform('EPSG:4326', 'EPSG:3857');
|
4915 |
+
|
4916 |
+
vectorLayer3857.getSource().addFeature(new ol.Feature(circle3857));
|
4917 |
+
}
|
4918 |
+
|
4919 |
+
this.layer = vectorLayer3857;
|
4920 |
+
|
4921 |
+
options.map.olMap.addLayer(vectorLayer3857);
|
4922 |
+
}
|
4923 |
+
|
4924 |
+
WPGMZA.OLCircle.prototype = Object.create(Parent.prototype);
|
4925 |
+
WPGMZA.OLCircle.prototype.constructor = WPGMZA.OLCircle;
|
4926 |
+
|
4927 |
+
WPGMZA.OLCircle.prototype.getStyleFromSettings = function()
|
4928 |
+
{
|
4929 |
+
var params = {};
|
4930 |
+
|
4931 |
+
if(this.settings.strokeOpacity)
|
4932 |
+
params.stroke = new ol.style.Stroke({
|
4933 |
+
color: WPGMZA.hexOpacityToRGBA(this.settings.strokeColor, this.settings.strokeOpacity)
|
4934 |
+
});
|
4935 |
+
|
4936 |
+
if(this.settings.fillOpacity)
|
4937 |
+
params.fill = new ol.style.Fill({
|
4938 |
+
color: WPGMZA.hexOpacityToRGBA(this.settings.fillColor, this.settings.fillOpacity)
|
4939 |
+
});
|
4940 |
+
|
4941 |
+
return params;
|
4942 |
+
}
|
4943 |
+
|
4944 |
+
WPGMZA.OLCircle.prototype.updateStyleFromSettings = function()
|
4945 |
+
{
|
4946 |
+
// Re-create the style - working on it directly doesn't cause a re-render
|
4947 |
+
var params = this.getStyleFromSettings();
|
4948 |
+
this.olStyle = new ol.style.Style(params);
|
4949 |
+
this.layer.setStyle(this.olStyle);
|
4950 |
+
}
|
4951 |
+
|
4952 |
+
});
|
4953 |
+
|
4954 |
+
// js/v8/open-layers/ol-geocoder.js
|
4955 |
+
/**
|
4956 |
+
* @namespace WPGMZA
|
4957 |
+
* @module OLGeocoder
|
4958 |
+
* @requires WPGMZA.Geocoder
|
4959 |
+
*/
|
4960 |
+
jQuery(function($) {
|
4961 |
+
|
4962 |
+
/**
|
4963 |
+
* @class OLGeocoder
|
4964 |
+
* @extends Geocoder
|
4965 |
+
* @summary OpenLayers geocoder - uses Nominatim by default
|
4966 |
+
*/
|
4967 |
+
WPGMZA.OLGeocoder = function()
|
4968 |
+
{
|
4969 |
+
|
4970 |
+
}
|
4971 |
+
|
4972 |
+
WPGMZA.OLGeocoder.prototype = Object.create(WPGMZA.Geocoder.prototype);
|
4973 |
+
WPGMZA.OLGeocoder.prototype.constructor = WPGMZA.OLGeocoder;
|
4974 |
+
|
4975 |
+
/**
|
4976 |
+
* @function getResponseFromCache
|
4977 |
+
* @access protected
|
4978 |
+
* @summary Tries to retrieve cached coordinates from server cache
|
4979 |
+
* @param {string} address The street address to geocode
|
4980 |
+
* @param {function} callback Where to send the results, as an array
|
4981 |
+
* @return {void}
|
4982 |
+
*/
|
4983 |
+
WPGMZA.OLGeocoder.prototype.getResponseFromCache = function(address, callback)
|
4984 |
+
{
|
4985 |
+
$.ajax(WPGMZA.ajaxurl, {
|
4986 |
+
data: {
|
4987 |
+
action: "wpgmza_query_nominatim_cache",
|
4988 |
+
query: address
|
4989 |
+
},
|
4990 |
+
success: function(response, xhr, status) {
|
4991 |
+
// Legacy compatibility support
|
4992 |
+
response.lng = response.lon;
|
4993 |
+
|
4994 |
+
callback(response);
|
4995 |
+
}
|
4996 |
+
});
|
4997 |
+
}
|
4998 |
+
|
4999 |
+
/**
|
5000 |
+
* @function getResponseFromNominatim
|
5001 |
+
* @access protected
|
5002 |
+
* @summary Queries Nominatim on the specified address
|
5003 |
+
* @param {object} options An object containing the options for geocoding, address is a mandatory field
|
5004 |
+
* @param {function} callback The function to send the results to, as an array
|
5005 |
+
*/
|
5006 |
+
WPGMZA.OLGeocoder.prototype.getResponseFromNominatim = function(options, callback)
|
5007 |
+
{
|
5008 |
+
var data = {
|
5009 |
+
q: options.address,
|
5010 |
+
format: "json"
|
5011 |
+
};
|
5012 |
+
|
5013 |
+
if(options.country)
|
5014 |
+
data.countrycodes = options.country;
|
5015 |
+
|
5016 |
+
$.ajax("https://nominatim.openstreetmap.org/search/", {
|
5017 |
+
data: data,
|
5018 |
+
success: function(response, xhr, status) {
|
5019 |
+
callback(response);
|
5020 |
+
},
|
5021 |
+
error: function(response, xhr, status) {
|
5022 |
+
callback(null, WPGMZA.Geocoder.FAIL)
|
5023 |
+
}
|
5024 |
+
});
|
5025 |
+
}
|
5026 |
+
|
5027 |
+
/**
|
5028 |
+
* @function cacheResponse
|
5029 |
+
* @access protected
|
5030 |
+
* @summary Caches a response on the server, usually after it's been returned from Nominatim
|
5031 |
+
* @param {string} address The street address
|
5032 |
+
* @param {object|array} response The response to cache
|
5033 |
+
* @returns {void}
|
5034 |
+
*/
|
5035 |
+
WPGMZA.OLGeocoder.prototype.cacheResponse = function(address, response)
|
5036 |
+
{
|
5037 |
+
$.ajax(WPGMZA.ajaxurl, {
|
5038 |
+
data: {
|
5039 |
+
action: "wpgmza_store_nominatim_cache",
|
5040 |
+
query: address,
|
5041 |
+
response: JSON.stringify(response)
|
5042 |
+
},
|
5043 |
+
method: "POST"
|
5044 |
+
});
|
5045 |
+
}
|
5046 |
+
|
5047 |
+
WPGMZA.OLGeocoder.prototype.getLatLngFromAddress = function(options, callback)
|
5048 |
+
{
|
5049 |
+
return WPGMZA.OLGeocoder.prototype.geocode(options, callback);
|
5050 |
+
}
|
5051 |
+
|
5052 |
+
WPGMZA.OLGeocoder.prototype.getAddressFromLatLng = function(options, callback)
|
5053 |
+
{
|
5054 |
+
return WPGMZA.OLGeocoder.prototype.geocode(options, callback);
|
5055 |
+
}
|
5056 |
+
|
5057 |
+
WPGMZA.OLGeocoder.prototype.geocode = function(options, callback)
|
5058 |
+
{
|
5059 |
+
var self = this;
|
5060 |
+
|
5061 |
+
if(!options)
|
5062 |
+
throw new Error("Invalid options");
|
5063 |
+
|
5064 |
+
if(options.location)
|
5065 |
+
options.latLng = new WPGMZA.LatLng(options.location);
|
5066 |
+
|
5067 |
+
var finish, location;
|
5068 |
+
|
5069 |
+
if(options.address)
|
5070 |
+
{
|
5071 |
+
location = options.address;
|
5072 |
+
|
5073 |
+
finish = function(response, status)
|
5074 |
+
{
|
5075 |
+
for(var i = 0; i < response.length; i++)
|
5076 |
+
{
|
5077 |
+
response[i].geometry = {
|
5078 |
+
location: new WPGMZA.LatLng({
|
5079 |
+
lat: parseFloat(response[i].lat),
|
5080 |
+
lng: parseFloat(response[i].lon)
|
5081 |
+
})
|
5082 |
+
};
|
5083 |
+
|
5084 |
+
response[i].latLng = {
|
5085 |
+
lat: parseFloat(response[i].lat),
|
5086 |
+
lng: parseFloat(response[i].lon)
|
5087 |
+
};
|
5088 |
+
|
5089 |
+
// Backward compatibility with old UGM
|
5090 |
+
response[i].lng = response[i].lon;
|
5091 |
+
}
|
5092 |
+
|
5093 |
+
callback(response, status);
|
5094 |
+
}
|
5095 |
+
}
|
5096 |
+
else if(options.latLng)
|
5097 |
+
{
|
5098 |
+
location = options.latLng.toString();
|
5099 |
+
|
5100 |
+
finish = function(response, status)
|
5101 |
+
{
|
5102 |
+
var address = response[0].display_name;
|
5103 |
+
callback([address], status);
|
5104 |
+
}
|
5105 |
+
}
|
5106 |
+
else
|
5107 |
+
throw new Error("You must supply either a latLng or address")
|
5108 |
+
|
5109 |
+
this.getResponseFromCache(location, function(response) {
|
5110 |
+
if(response.length)
|
5111 |
+
{
|
5112 |
+
finish(response, WPGMZA.Geocoder.SUCCESS);
|
5113 |
+
return;
|
5114 |
+
}
|
5115 |
+
|
5116 |
+
self.getResponseFromNominatim($.extend(options, {address: location}), function(response, status) {
|
5117 |
+
if(status == WPGMZA.Geocoder.FAIL)
|
5118 |
+
{
|
5119 |
+
callback(null, WPGMZA.Geocoder.FAIL);
|
5120 |
+
return;
|
5121 |
+
}
|
5122 |
+
|
5123 |
+
if(response.length == 0)
|
5124 |
+
{
|
5125 |
+
callback([], WPGMZA.Geocoder.ZERO_RESULTS);
|
5126 |
+
return;
|
5127 |
+
}
|
5128 |
+
|
5129 |
+
finish(response, WPGMZA.Geocoder.SUCCESS);
|
5130 |
+
|
5131 |
+
self.cacheResponse(location, response);
|
5132 |
+
});
|
5133 |
+
});
|
5134 |
+
}
|
5135 |
+
|
5136 |
+
});
|
5137 |
+
|
5138 |
+
// js/v8/open-layers/ol-info-window.js
|
5139 |
+
/**
|
5140 |
+
* @namespace WPGMZA
|
5141 |
+
* @module OLInfoWindow
|
5142 |
+
* @requires WPGMZA.InfoWindow
|
5143 |
+
* @pro-requires WPGMZA.ProInfoWindow
|
5144 |
+
*/
|
5145 |
+
jQuery(function($) {
|
5146 |
+
|
5147 |
+
var Parent;
|
5148 |
+
|
5149 |
+
WPGMZA.OLInfoWindow = function(mapObject)
|
5150 |
+
{
|
5151 |
+
var self = this;
|
5152 |
+
|
5153 |
+
Parent.call(this, mapObject);
|
5154 |
+
|
5155 |
+
this.element = $("<div class='ol-info-window-container ol-info-window-plain'></div>")[0];
|
5156 |
+
|
5157 |
+
$(this.element).on("click", ".ol-info-window-close", function(event) {
|
5158 |
+
self.close();
|
5159 |
+
});
|
5160 |
+
}
|
5161 |
+
|
5162 |
+
if(WPGMZA.isProVersion())
|
5163 |
+
Parent = WPGMZA.ProInfoWindow;
|
5164 |
+
else
|
5165 |
+
Parent = WPGMZA.InfoWindow;
|
5166 |
+
|
5167 |
+
WPGMZA.OLInfoWindow.prototype = Object.create(Parent.prototype);
|
5168 |
+
WPGMZA.OLInfoWindow.prototype.constructor = WPGMZA.OLInfoWindow;
|
5169 |
+
|
5170 |
+
/**
|
5171 |
+
* Opens the info window
|
5172 |
+
* TODO: This should take a mapObject, not an event
|
5173 |
+
* @return boolean FALSE if the info window should not & will not open, TRUE if it will
|
5174 |
+
*/
|
5175 |
+
WPGMZA.OLInfoWindow.prototype.open = function(map, mapObject)
|
5176 |
+
{
|
5177 |
+
var self = this;
|
5178 |
+
var latLng = mapObject.getPosition();
|
5179 |
+
|
5180 |
+
if(!WPGMZA.InfoWindow.prototype.open.call(this, map, mapObject))
|
5181 |
+
return false;
|
5182 |
+
|
5183 |
+
if(this.overlay)
|
5184 |
+
this.mapObject.map.olMap.removeOverlay(this.overlay);
|
5185 |
+
|
5186 |
+
this.overlay = new ol.Overlay({
|
5187 |
+
element: this.element
|
5188 |
+
});
|
5189 |
+
|
5190 |
+
this.overlay.setPosition(ol.proj.fromLonLat([
|
5191 |
+
latLng.lng,
|
5192 |
+
latLng.lat
|
5193 |
+
]));
|
5194 |
+
self.mapObject.map.olMap.addOverlay(this.overlay);
|
5195 |
+
|
5196 |
+
$(this.element).show();
|
5197 |
+
|
5198 |
+
this.dispatchEvent("infowindowopen");
|
5199 |
+
}
|
5200 |
+
|
5201 |
+
WPGMZA.OLInfoWindow.prototype.close = function(event)
|
5202 |
+
{
|
5203 |
+
// TODO: Why? This shouldn't have to be here. Removing the overlay should hide the element (it doesn't)
|
5204 |
+
$(this.element).hide();
|
5205 |
+
|
5206 |
+
if(!this.overlay)
|
5207 |
+
return;
|
5208 |
+
|
5209 |
+
WPGMZA.InfoWindow.prototype.close.call(this);
|
5210 |
+
|
5211 |
+
this.mapObject.map.olMap.removeOverlay(this.overlay);
|
5212 |
+
this.overlay = null;
|
5213 |
+
}
|
5214 |
+
|
5215 |
+
WPGMZA.OLInfoWindow.prototype.setContent = function(html)
|
5216 |
+
{
|
5217 |
+
$(this.element).html("<i class='fa fa-times ol-info-window-close' aria-hidden='true'></i>" + html);
|
5218 |
+
}
|
5219 |
+
|
5220 |
+
WPGMZA.OLInfoWindow.prototype.setOptions = function(options)
|
5221 |
+
{
|
5222 |
+
if(WPGMZA.settings.developer_mode)
|
5223 |
+
console.log(options);
|
5224 |
+
|
5225 |
+
if(options.maxWidth)
|
5226 |
+
{
|
5227 |
+
$(this.element).css({"max-width": options.maxWidth + "px"});
|
5228 |
+
}
|
5229 |
+
}
|
5230 |
+
|
5231 |
+
});
|
5232 |
+
|
5233 |
+
// js/v8/open-layers/ol-map.js
|
5234 |
+
/**
|
5235 |
+
* @namespace WPGMZA
|
5236 |
+
* @module OLMap
|
5237 |
+
* @requires WPGMZA.Map
|
5238 |
+
* @pro-requires WPGMZA.ProMap
|
5239 |
+
*/
|
5240 |
+
jQuery(function($) {
|
5241 |
+
|
5242 |
+
var Parent;
|
5243 |
+
|
5244 |
+
WPGMZA.OLMap = function(element, options)
|
5245 |
+
{
|
5246 |
+
var self = this;
|
5247 |
+
|
5248 |
+
Parent.call(this, element);
|
5249 |
+
|
5250 |
+
this.setOptions(options);
|
5251 |
+
|
5252 |
+
var viewOptions = this.settings.toOLViewOptions();
|
5253 |
+
|
5254 |
+
$(this.element).html("");
|
5255 |
+
|
5256 |
+
this.olMap = new ol.Map({
|
5257 |
+
target: $(element)[0],
|
5258 |
+
layers: [
|
5259 |
+
this.getTileLayer()
|
5260 |
+
],
|
5261 |
+
view: new ol.View(viewOptions)
|
5262 |
+
});
|
5263 |
+
|
5264 |
+
// TODO: Re-implement using correct setting names
|
5265 |
+
// Interactions
|
5266 |
+
this.olMap.getInteractions().forEach(function(interaction) {
|
5267 |
+
|
5268 |
+
// NB: The true and false values are flipped because these settings represent the "disabled" state when true
|
5269 |
+
if(interaction instanceof ol.interaction.DragPan)
|
5270 |
+
interaction.setActive( (this.settings.wpgmza_settings_map_draggable == "yes" ? false : true) );
|
5271 |
+
else if(interaction instanceof ol.interaction.DoubleClickZoom)
|
5272 |
+
interaction.setActive( (this.settings.wpgmza_settings_map_clickzoom ? false : true) );
|
5273 |
+
else if(interaction instanceof ol.interaction.MouseWheelZoom)
|
5274 |
+
interaction.setActive( (this.settings.wpgmza_settings_map_scroll == "yes" ? false : true) );
|
5275 |
+
|
5276 |
+
}, this);
|
5277 |
+
|
5278 |
+
// Controls
|
5279 |
+
this.olMap.getControls().forEach(function(control) {
|
5280 |
+
|
5281 |
+
// NB: The true and false values are flipped because these settings represent the "disabled" state when true
|
5282 |
+
if(control instanceof ol.control.Zoom && WPGMZA.settings.wpgmza_settings_map_zoom == "yes")
|
5283 |
+
this.olMap.removeControl(control);
|
5284 |
+
|
5285 |
+
}, this);
|
5286 |
+
|
5287 |
+
if(WPGMZA.settings.wpgmza_settings_map_full_screen_control != "yes")
|
5288 |
+
this.olMap.addControl(new ol.control.FullScreen());
|
5289 |
+
|
5290 |
+
// Marker layer
|
5291 |
+
this.markerLayer = new ol.layer.Vector({
|
5292 |
+
source: new ol.source.Vector({
|
5293 |
+
features: []
|
5294 |
+
})
|
5295 |
+
});
|
5296 |
+
this.olMap.addLayer(this.markerLayer);
|
5297 |
+
|
5298 |
+
// Listen for drag start
|
5299 |
+
this.olMap.on("movestart", function(event) {
|
5300 |
+
self.isBeingDragged = true;
|
5301 |
+
});
|
5302 |
+
|
5303 |
+
// Listen for end of pan so we can wrap longitude if needs be
|
5304 |
+
this.olMap.on("moveend", function(event) {
|
5305 |
+
self.wrapLongitude();
|
5306 |
+
|
5307 |
+
self.isBeingDragged = false;
|
5308 |
+
self.dispatchEvent("dragend");
|
5309 |
+
self.onIdle();
|
5310 |
+
});
|
5311 |
+
|
5312 |
+
// Listen for zoom
|
5313 |
+
this.olMap.getView().on("change:resolution", function(event) {
|
5314 |
+
self.dispatchEvent("zoom_changed");
|
5315 |
+
self.dispatchEvent("zoomchanged");
|
5316 |
+
self.onIdle();
|
5317 |
+
});
|
5318 |
+
|
5319 |
+
// Listen for bounds changing
|
5320 |
+
this.olMap.getView().on("change", function() {
|
5321 |
+
// Wrap longitude
|
5322 |
+
self.onBoundsChanged();
|
5323 |
+
});
|
5324 |
+
self.onBoundsChanged();
|
5325 |
+
|
5326 |
+
// Store locator center
|
5327 |
+
var marker;
|
5328 |
+
if(this.storeLocator && (marker = this.storeLocator.centerPointMarker))
|
5329 |
+
{
|
5330 |
+
this.olMap.addOverlay(marker.overlay);
|
5331 |
+
marker.setVisible(false);
|
5332 |
+
}
|
5333 |
+
|
5334 |
+
// Right click listener
|
5335 |
+
$(this.element).on("click contextmenu", function(event) {
|
5336 |
+
|
5337 |
+
var isRight;
|
5338 |
+
event = event || window.event;
|
5339 |
+
|
5340 |
+
var latLng = self.pixelsToLatLng(event.offsetX, event.offsetY);
|
5341 |
+
|
5342 |
+
if("which" in event)
|
5343 |
+
isRight = event.which == 3;
|
5344 |
+
else if("button" in event)
|
5345 |
+
isRight = event.button == 2;
|
5346 |
+
|
5347 |
+
if(event.which == 1 || event.button == 1)
|
5348 |
+
{
|
5349 |
+
if(self.isBeingDragged)
|
5350 |
+
return;
|
5351 |
+
|
5352 |
+
// Left click
|
5353 |
+
self.trigger({
|
5354 |
+
type: "click",
|
5355 |
+
latLng: latLng
|
5356 |
+
});
|
5357 |
+
|
5358 |
+
return;
|
5359 |
+
}
|
5360 |
+
|
5361 |
+
if(!isRight)
|
5362 |
+
return;
|
5363 |
+
|
5364 |
+
return self.onRightClick(event);
|
5365 |
+
});
|
5366 |
+
|
5367 |
+
// Dispatch event
|
5368 |
+
if(!WPGMZA.isProVersion())
|
5369 |
+
{
|
5370 |
+
this.dispatchEvent("created");
|
5371 |
+
WPGMZA.events.dispatchEvent({type: "mapcreated", map: this});
|
5372 |
+
}
|
5373 |
+
}
|
5374 |
+
|
5375 |
+
if(WPGMZA.isProVersion())
|
5376 |
+
Parent = WPGMZA.ProMap;
|
5377 |
+
else
|
5378 |
+
Parent = WPGMZA.Map;
|
5379 |
+
|
5380 |
+
WPGMZA.OLMap.prototype = Object.create(Parent.prototype);
|
5381 |
+
WPGMZA.OLMap.prototype.constructor = WPGMZA.OLMap;
|
5382 |
+
|
5383 |
+
WPGMZA.OLMap.prototype.getTileLayer = function()
|
5384 |
+
{
|
5385 |
+
return new ol.layer.Tile({
|
5386 |
+
source: new ol.source.OSM()
|
5387 |
+
});
|
5388 |
+
}
|
5389 |
+
|
5390 |
+
WPGMZA.OLMap.prototype.wrapLongitude = function()
|
5391 |
+
{
|
5392 |
+
var center = this.getCenter();
|
5393 |
+
|
5394 |
+
if(center.lng >= -180 && center.lng <= 180)
|
5395 |
+
return;
|
5396 |
+
|
5397 |
+
center.lng = center.lng - 360 * Math.floor(center.lng / 360);
|
5398 |
+
|
5399 |
+
if(center.lng > 180)
|
5400 |
+
center.lng -= 360;
|
5401 |
+
|
5402 |
+
this.setCenter(center);
|
5403 |
+
}
|
5404 |
+
|
5405 |
+
WPGMZA.OLMap.prototype.getCenter = function()
|
5406 |
+
{
|
5407 |
+
var lonLat = ol.proj.toLonLat(
|
5408 |
+
this.olMap.getView().getCenter()
|
5409 |
+
);
|
5410 |
+
return {
|
5411 |
+
lat: lonLat[1],
|
5412 |
+
lng: lonLat[0]
|
5413 |
+
};
|
5414 |
+
}
|
5415 |
+
|
5416 |
+
WPGMZA.OLMap.prototype.setCenter = function(latLng)
|
5417 |
+
{
|
5418 |
+
var view = this.olMap.getView();
|
5419 |
+
|
5420 |
+
WPGMZA.Map.prototype.setCenter.call(this, latLng);
|
5421 |
+
|
5422 |
+
view.setCenter(ol.proj.fromLonLat([
|
5423 |
+
latLng.lng,
|
5424 |
+
latLng.lat
|
5425 |
+
]));
|
5426 |
+
|
5427 |
+
this.wrapLongitude();
|
5428 |
+
|
5429 |
+
this.onBoundsChanged();
|
5430 |
+
}
|
5431 |
+
|
5432 |
+
WPGMZA.OLMap.prototype.getBounds = function()
|
5433 |
+
{
|
5434 |
+
var bounds = this.olMap.getView().calculateExtent(this.olMap.getSize());
|
5435 |
+
|
5436 |
+
var topLeft = ol.proj.toLonLat([bounds[0], bounds[1]]);
|
5437 |
+
var bottomRight = ol.proj.toLonLat([bounds[2], bounds[3]]);
|
5438 |
+
|
5439 |
+
return {
|
5440 |
+
topLeft: {
|
5441 |
+
lat: topLeft[1],
|
5442 |
+
lng: topLeft[0]
|
5443 |
+
},
|
5444 |
+
bottomRight: {
|
5445 |
+
lat: bottomRight[1],
|
5446 |
+
lng: bottomRight[0]
|
5447 |
+
}
|
5448 |
+
};
|
5449 |
+
}
|
5450 |
+
|
5451 |
+
/**
|
5452 |
+
* Fit to given boundaries
|
5453 |
+
* @return void
|
5454 |
+
*/
|
5455 |
+
WPGMZA.OLMap.prototype.fitBounds = function(southWest, northEast)
|
5456 |
+
{
|
5457 |
+
this.olMap.getView().fitExtent(
|
5458 |
+
[southWest.lng, southWest.lat, northEast.lng, northEast.lat],
|
5459 |
+
this.olMap.getSize()
|
5460 |
+
);
|
5461 |
+
}
|
5462 |
+
|
5463 |
+
WPGMZA.OLMap.prototype.panTo = function(latLng)
|
5464 |
+
{
|
5465 |
+
var view = this.olMap.getView();
|
5466 |
+
view.animate({
|
5467 |
+
center: ol.proj.fromLonLat([
|
5468 |
+
parseFloat(latLng.lng),
|
5469 |
+
parseFloat(latLng.lat),
|
5470 |
+
]),
|
5471 |
+
duration: 500
|
5472 |
+
});
|
5473 |
+
}
|
5474 |
+
|
5475 |
+
WPGMZA.OLMap.prototype.getZoom = function()
|
5476 |
+
{
|
5477 |
+
return Math.round( this.olMap.getView().getZoom() ) + 1;
|
5478 |
+
}
|
5479 |
+
|
5480 |
+
WPGMZA.OLMap.prototype.setZoom = function(value)
|
5481 |
+
{
|
5482 |
+
this.olMap.getView().setZoom(value);
|
5483 |
+
}
|
5484 |
+
|
5485 |
+
WPGMZA.OLMap.prototype.getMinZoom = function()
|
5486 |
+
{
|
5487 |
+
return this.olMap.getView().getMinZoom();
|
5488 |
+
}
|
5489 |
+
|
5490 |
+
WPGMZA.OLMap.prototype.setMinZoom = function(value)
|
5491 |
+
{
|
5492 |
+
this.olMap.getView().setMinZoom(value);
|
5493 |
+
}
|
5494 |
+
|
5495 |
+
WPGMZA.OLMap.prototype.getMaxZoom = function()
|
5496 |
+
{
|
5497 |
+
return this.olMap.getView().getMaxZoom();
|
5498 |
+
}
|
5499 |
+
|
5500 |
+
WPGMZA.OLMap.prototype.setMaxZoom = function(value)
|
5501 |
+
{
|
5502 |
+
this.olMap.getView().setMaxZoom(value);
|
5503 |
+
}
|
5504 |
+
|
5505 |
+
WPGMZA.OLMap.prototype.setOptions = function(options)
|
5506 |
+
{
|
5507 |
+
Parent.prototype.setOptions.call(this, options);
|
5508 |
+
|
5509 |
+
if(!this.olMap)
|
5510 |
+
return;
|
5511 |
+
|
5512 |
+
this.olMap.getView().setProperties( this.settings.toOLViewOptions() );
|
5513 |
+
}
|
5514 |
+
|
5515 |
+
/**
|
5516 |
+
* TODO: Consider moving all these functions to their respective classes, same on google map (DO IT!!! It's very misleading having them here)
|
5517 |
+
*/
|
5518 |
+
WPGMZA.OLMap.prototype.addMarker = function(marker)
|
5519 |
+
{
|
5520 |
+
this.olMap.addOverlay(marker.overlay);
|
5521 |
+
|
5522 |
+
Parent.prototype.addMarker.call(this, marker);
|
5523 |
+
}
|
5524 |
+
|
5525 |
+
WPGMZA.OLMap.prototype.removeMarker = function(marker)
|
5526 |
+
{
|
5527 |
+
this.olMap.removeOverlay(marker.overlay);
|
5528 |
+
|
5529 |
+
Parent.prototype.removeMarker.call(this, marker);
|
5530 |
+
}
|
5531 |
+
|
5532 |
+
WPGMZA.OLMap.prototype.addPolygon = function(polygon)
|
5533 |
+
{
|
5534 |
+
this.olMap.addLayer(polygon.layer);
|
5535 |
+
|
5536 |
+
Parent.prototype.addPolygon.call(this, polygon);
|
5537 |
+
}
|
5538 |
+
|
5539 |
+
WPGMZA.OLMap.prototype.removePolygon = function(polygon)
|
5540 |
+
{
|
5541 |
+
this.olMap.removeLayer(polygon.layer);
|
5542 |
+
|
5543 |
+
Parent.prototype.removePolygon.call(this, polygon);
|
5544 |
+
}
|
5545 |
+
|
5546 |
+
WPGMZA.OLMap.prototype.addPolyline = function(polyline)
|
5547 |
+
{
|
5548 |
+
this.olMap.addLayer(polyline.layer);
|
5549 |
+
|
5550 |
+
Parent.prototype.addPolyline.call(this, polyline);
|
5551 |
+
}
|
5552 |
+
|
5553 |
+
WPGMZA.OLMap.prototype.removePolyline = function(polyline)
|
5554 |
+
{
|
5555 |
+
this.olMap.removeLayer(polyline.layer);
|
5556 |
+
|
5557 |
+
Parent.prototype.removePolyline.call(this, polyline);
|
5558 |
+
}
|
5559 |
+
|
5560 |
+
WPGMZA.OLMap.prototype.addCircle = function(circle)
|
5561 |
+
{
|
5562 |
+
this.olMap.addLayer(circle.layer);
|
5563 |
+
|
5564 |
+
Parent.prototype.addCircle.call(this, circle);
|
5565 |
+
}
|
5566 |
+
|
5567 |
+
WPGMZA.OLMap.prototype.removeCircle = function(circle)
|
5568 |
+
{
|
5569 |
+
this.olMap.removeLayer(circle.layer);
|
5570 |
+
|
5571 |
+
Parent.prototype.removeCircle.call(this, circle);
|
5572 |
+
}
|
5573 |
+
|
5574 |
+
WPGMZA.OLMap.prototype.pixelsToLatLng = function(x, y)
|
5575 |
+
{
|
5576 |
+
if(y == undefined)
|
5577 |
+
{
|
5578 |
+
if("x" in x && "y" in x)
|
5579 |
+
{
|
5580 |
+
y = x.y;
|
5581 |
+
x = x.x;
|
5582 |
+
}
|
5583 |
+
else
|
5584 |
+
console.warn("Y coordinate undefined in pixelsToLatLng (did you mean to pass 2 arguments?)");
|
5585 |
+
}
|
5586 |
+
|
5587 |
+
var coord = this.olMap.getCoordinateFromPixel([x, y]);
|
5588 |
+
|
5589 |
+
if(!coord)
|
5590 |
+
return {
|
5591 |
+
x: null,
|
5592 |
+
y: null
|
5593 |
+
};
|
5594 |
+
|
5595 |
+
var lonLat = ol.proj.toLonLat(coord);
|
5596 |
+
return {
|
5597 |
+
lat: lonLat[1],
|
5598 |
+
lng: lonLat[0]
|
5599 |
+
};
|
5600 |
+
}
|
5601 |
+
|
5602 |
+
WPGMZA.OLMap.prototype.latLngToPixels = function(latLng)
|
5603 |
+
{
|
5604 |
+
var coord = ol.proj.fromLonLat([latLng.lng, latLng.lat]);
|
5605 |
+
var pixel = this.olMap.getPixelFromCoordinate(coord);
|
5606 |
+
|
5607 |
+
if(!pixel)
|
5608 |
+
return {
|
5609 |
+
x: null,
|
5610 |
+
y: null
|
5611 |
+
};
|
5612 |
+
|
5613 |
+
return {
|
5614 |
+
x: pixel[0],
|
5615 |
+
y: pixel[1]
|
5616 |
+
};
|
5617 |
+
}
|
5618 |
+
|
5619 |
+
WPGMZA.OLMap.prototype.enableBicycleLayer = function(value)
|
5620 |
+
{
|
5621 |
+
if(value)
|
5622 |
+
{
|
5623 |
+
if(!this.bicycleLayer)
|
5624 |
+
this.bicycleLayer = new ol.layer.Tile({
|
5625 |
+
source: new ol.source.OSM({
|
5626 |
+
url: "http://{a-c}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png"
|
5627 |
+
})
|
5628 |
+
});
|
5629 |
+
|
5630 |
+
this.olMap.addLayer(this.bicycleLayer);
|
5631 |
+
}
|
5632 |
+
else
|
5633 |
+
{
|
5634 |
+
if(!this.bicycleLayer)
|
5635 |
+
return;
|
5636 |
+
|
5637 |
+
this.olMap.removeLayer(this.bicycleLayer);
|
5638 |
+
}
|
5639 |
+
}
|
5640 |
+
|
5641 |
+
WPGMZA.OLMap.prototype.onElementResized = function(event)
|
5642 |
+
{
|
5643 |
+
this.olMap.updateSize();
|
5644 |
+
}
|
5645 |
+
|
5646 |
+
WPGMZA.OLMap.prototype.onRightClick = function(event)
|
5647 |
+
{
|
5648 |
+
if($(event.target).closest(".ol-marker, .wpgmza_modern_infowindow, .wpgmza-modern-store-locator").length)
|
5649 |
+
return true;
|
5650 |
+
|
5651 |
+
var parentOffset = $(this.element).offset();
|
5652 |
+
var relX = event.pageX - parentOffset.left;
|
5653 |
+
var relY = event.pageY - parentOffset.top;
|
5654 |
+
var latLng = this.pixelsToLatLng(relX, relY);
|
5655 |
+
|
5656 |
+
this.trigger({type: "rightclick", latLng: latLng});
|
5657 |
+
|
5658 |
+
// Legacy event compatibility
|
5659 |
+
$(this.element).trigger({type: "rightclick", latLng: latLng});
|
5660 |
+
|
5661 |
+
// Prevent menu
|
5662 |
+
event.preventDefault();
|
5663 |
+
return false;
|
5664 |
+
}
|
5665 |
+
|
5666 |
+
});
|
5667 |
+
|
5668 |
+
// js/v8/open-layers/ol-marker.js
|
5669 |
+
/**
|
5670 |
+
* @namespace WPGMZA
|
5671 |
+
* @module OLMarker
|
5672 |
+
* @requires WPGMZA.Marker
|
5673 |
+
* @pro-requires WPGMZA.ProMarker
|
5674 |
+
*/
|
5675 |
+
jQuery(function($) {
|
5676 |
+
|
5677 |
+
var Parent;
|
5678 |
+
|
5679 |
+
WPGMZA.OLMarker = function(row)
|
5680 |
+
{
|
5681 |
+
var self = this;
|
5682 |
+
|
5683 |
+
Parent.call(this, row);
|
5684 |
+
|
5685 |
+
var origin = ol.proj.fromLonLat([
|
5686 |
+
parseFloat(this.lng),
|
5687 |
+
parseFloat(this.lat)
|
5688 |
+
]);
|
5689 |
+
|
5690 |
+
this.element = $("<div class='ol-marker'><img src='" + WPGMZA.settings.default_marker_icon + "'/></div>")[0];
|
5691 |
+
this.element.wpgmzaMarker = this;
|
5692 |
+
|
5693 |
+
$(this.element).on("mouseover", function(event) {
|
5694 |
+
self.dispatchEvent("mouseover");
|
5695 |
+
});
|
5696 |
+
|
5697 |
+
this.overlay = new ol.Overlay({
|
5698 |
+
element: this.element
|
5699 |
+
});
|
5700 |
+
this.overlay.setPosition(origin);
|
5701 |
+
|
5702 |
+
if(this.animation)
|
5703 |
+
this.setAnimation(this.animation);
|
5704 |
+
|
5705 |
+
this.setLabel(this.settings.label);
|
5706 |
+
|
5707 |
+
if(row)
|
5708 |
+
{
|
5709 |
+
if(row.draggable)
|
5710 |
+
this.setDraggable(true);
|
5711 |
+
}
|
5712 |
+
|
5713 |
+
this.rebindClickListener();
|
5714 |
+
|
5715 |
+
this.trigger("init");
|
5716 |
+
}
|
5717 |
+
|
5718 |
+
if(WPGMZA.isProVersion())
|
5719 |
+
Parent = WPGMZA.ProMarker;
|
5720 |
+
else
|
5721 |
+
Parent = WPGMZA.Marker;
|
5722 |
+
WPGMZA.OLMarker.prototype = Object.create(Parent.prototype);
|
5723 |
+
WPGMZA.OLMarker.prototype.constructor = WPGMZA.OLMarker;
|
5724 |
+
|
5725 |
+
WPGMZA.OLMarker.prototype.addLabel = function()
|
5726 |
+
{
|
5727 |
+
this.setLabel(this.getLabelText());
|
5728 |
+
}
|
5729 |
+
|
5730 |
+
WPGMZA.OLMarker.prototype.setLabel = function(label)
|
5731 |
+
{
|
5732 |
+
if(!label)
|
5733 |
+
{
|
5734 |
+
if(this.label)
|
5735 |
+
$(this.element).find(".ol-marker-label").remove();
|
5736 |
+
|
5737 |
+
return;
|
5738 |
+
}
|
5739 |
+
|
5740 |
+
if(!this.label)
|
5741 |
+
{
|
5742 |
+
this.label = $("<div class='ol-marker-label'/>");
|
5743 |
+
$(this.element).append(this.label);
|
5744 |
+
}
|
5745 |
+
|
5746 |
+
this.label.html(label);
|
5747 |
+
}
|
5748 |
+
|
5749 |
+
WPGMZA.OLMarker.prototype.setVisible = function(visible)
|
5750 |
+
{
|
5751 |
+
Parent.prototype.setVisible(visible);
|
5752 |
+
|
5753 |
+
this.overlay.getElement().style.display = (visible ? "block" : "none");
|
5754 |
+
}
|
5755 |
+
|
5756 |
+
WPGMZA.OLMarker.prototype.setPosition = function(latLng)
|
5757 |
+
{
|
5758 |
+
Parent.prototype.setPosition.call(this, latLng);
|
5759 |
+
|
5760 |
+
var origin = ol.proj.fromLonLat([
|
5761 |
+
parseFloat(this.lng),
|
5762 |
+
parseFloat(this.lat)
|
5763 |
+
]);
|
5764 |
+
|
5765 |
+
this.overlay.setPosition(origin);
|
5766 |
+
}
|
5767 |
+
|
5768 |
+
WPGMZA.OLMarker.prototype.setOffset = function(x, y)
|
5769 |
+
{
|
5770 |
+
this.element.style.position = "relative";
|
5771 |
+
this.element.style.left = x + "px";
|
5772 |
+
this.element.style.top = y + "px";
|
5773 |
+
}
|
5774 |
+
|
5775 |
+
WPGMZA.OLMarker.prototype.setAnimation = function(anim)
|
5776 |
+
{
|
5777 |
+
Parent.prototype.setAnimation.call(this, anim);
|
5778 |
+
|
5779 |
+
switch(anim)
|
5780 |
+
{
|
5781 |
+
case WPGMZA.Marker.ANIMATION_NONE:
|
5782 |
+
$(this.element).removeAttr("data-anim");
|
5783 |
+
break;
|
5784 |
+
|
5785 |
+
case WPGMZA.Marker.ANIMATION_BOUNCE:
|
5786 |
+
$(this.element).attr("data-anim", "bounce");
|
5787 |
+
break;
|
5788 |
+
|
5789 |
+
case WPGMZA.Marker.ANIMATION_DROP:
|
5790 |
+
$(this.element).attr("data-anim", "drop");
|
5791 |
+
break;
|
5792 |
+
}
|
5793 |
+
}
|
5794 |
+
|
5795 |
+
WPGMZA.OLMarker.prototype.setDraggable = function(draggable)
|
5796 |
+
{
|
5797 |
+
var self = this;
|
5798 |
+
|
5799 |
+
if(draggable)
|
5800 |
+
{
|
5801 |
+
var options = {
|
5802 |
+
disabled: false
|
5803 |
+
};
|
5804 |
+
|
5805 |
+
if(!this.jQueryDraggableInitialized)
|
5806 |
+
{
|
5807 |
+
options.start = function(event) {
|
5808 |
+
self.onDragStart(event);
|
5809 |
+
}
|
5810 |
+
|
5811 |
+
options.stop = function(event) {
|
5812 |
+
self.onDragEnd(event);
|
5813 |
+
};
|
5814 |
+
}
|
5815 |
+
|
5816 |
+
$(this.element).draggable(options);
|
5817 |
+
this.jQueryDraggableInitialized = true;
|
5818 |
+
|
5819 |
+
this.rebindClickListener();
|
5820 |
+
}
|
5821 |
+
else
|
5822 |
+
$(this.element).draggable({disabled: true});
|
5823 |
+
}
|
5824 |
+
|
5825 |
+
WPGMZA.OLMarker.prototype.onDragStart = function(event)
|
5826 |
+
{
|
5827 |
+
this.isBeingDragged = true;
|
5828 |
+
}
|
5829 |
+
|
5830 |
+
WPGMZA.OLMarker.prototype.onDragEnd = function(event)
|
5831 |
+
{
|
5832 |
+
var offset = {
|
5833 |
+
top: parseFloat( $(this.element).css("top").match(/-?\d+/)[0] ),
|
5834 |
+
left: parseFloat( $(this.element).css("left").match(/-?\d+/)[0] )
|
5835 |
+
};
|
5836 |
+
|
5837 |
+
$(this.element).css({
|
5838 |
+
top: "0px",
|
5839 |
+
left: "0px"
|
5840 |
+
});
|
5841 |
+
|
5842 |
+
var currentLatLng = this.getPosition();
|
5843 |
+
var pixelsBeforeDrag = this.map.latLngToPixels(currentLatLng);
|
5844 |
+
var pixelsAfterDrag = {
|
5845 |
+
x: pixelsBeforeDrag.x + offset.left,
|
5846 |
+
y: pixelsBeforeDrag.y + offset.top
|
5847 |
+
};
|
5848 |
+
var latLngAfterDrag = this.map.pixelsToLatLng(pixelsAfterDrag);
|
5849 |
+
|
5850 |
+
this.setPosition(latLngAfterDrag);
|
5851 |
+
|
5852 |
+
this.isBeingDragged = false;
|
5853 |
+
this.trigger({type: "dragend", latLng: latLngAfterDrag});
|
5854 |
+
}
|
5855 |
+
|
5856 |
+
WPGMZA.OLMarker.prototype.onElementClick = function(event)
|
5857 |
+
{
|
5858 |
+
var self = event.currentTarget.wpgmzaMarker;
|
5859 |
+
|
5860 |
+
if(self.isBeingDragged)
|
5861 |
+
return; // Don't dispatch click event after a drag
|
5862 |
+
|
5863 |
+
self.dispatchEvent("click");
|
5864 |
+
self.dispatchEvent("select");
|
5865 |
+
}
|
5866 |
+
|
5867 |
+
/**
|
5868 |
+
* Binds / rebinds the click listener. This must be bound after draggable is initialized,
|
5869 |
+
* this solves the click listener firing before dragend
|
5870 |
+
*/
|
5871 |
+
WPGMZA.OLMarker.prototype.rebindClickListener = function()
|
5872 |
+
{
|
5873 |
+
$(this.element).off("click", this.onElementClick);
|
5874 |
+
$(this.element).on("click", this.onElementClick);
|
5875 |
+
}
|
5876 |
+
|
5877 |
+
});
|
5878 |
+
|
5879 |
+
// js/v8/open-layers/ol-modern-store-locator-circle.js
|
5880 |
+
/**
|
5881 |
+
* @namespace WPGMZA
|
5882 |
+
* @module OLModernStoreLocatorCircle
|
5883 |
+
* @requires WPGMZA.ModernStoreLocatorCircle
|
5884 |
+
*/
|
5885 |
+
jQuery(function($) {
|
5886 |
+
|
5887 |
+
WPGMZA.OLModernStoreLocatorCircle = function(map, settings)
|
5888 |
+
{
|
5889 |
+
WPGMZA.ModernStoreLocatorCircle.call(this, map, settings);
|
5890 |
+
}
|
5891 |
+
|
5892 |
+
WPGMZA.OLModernStoreLocatorCircle.prototype = Object.create(WPGMZA.ModernStoreLocatorCircle.prototype);
|
5893 |
+
WPGMZA.OLModernStoreLocatorCircle.prototype.constructor = WPGMZA.OLModernStoreLocatorCircle;
|
5894 |
+
|
5895 |
+
WPGMZA.OLModernStoreLocatorCircle.prototype.initCanvasLayer = function()
|
5896 |
+
{
|
5897 |
+
var self = this;
|
5898 |
+
var mapElement = $(this.map.element);
|
5899 |
+
var olViewportElement = mapElement.children(".ol-viewport");
|
5900 |
+
|
5901 |
+
this.canvas = document.createElement("canvas");
|
5902 |
+
this.canvas.className = "wpgmza-ol-canvas-overlay";
|
5903 |
+
mapElement.append(this.canvas);
|
5904 |
+
|
5905 |
+
this.renderFunction = function(event) {
|
5906 |
+
|
5907 |
+
if(self.canvas.width != olViewportElement.width() || self.canvas.height != olViewportElement.height())
|
5908 |
+
{
|
5909 |
+
self.canvas.width = olViewportElement.width();
|
5910 |
+
self.canvas.height = olViewportElement.height();
|
5911 |
+
|
5912 |
+
$(this.canvas).css({
|
5913 |
+
width: olViewportElement.width() + "px",
|
5914 |
+
height: olViewportElement.height() + "px"
|
5915 |
+
});
|
5916 |
+
}
|
5917 |
+
|
5918 |
+
self.draw();
|
5919 |
+
};
|
5920 |
+
|
5921 |
+
this.map.olMap.on("postrender", this.renderFunction);
|
5922 |
+
}
|
5923 |
+
|
5924 |
+
WPGMZA.OLModernStoreLocatorCircle.prototype.getContext = function(type)
|
5925 |
+
{
|
5926 |
+
return this.canvas.getContext(type);
|
5927 |
+
}
|
5928 |
+
|
5929 |
+
WPGMZA.OLModernStoreLocatorCircle.prototype.getCanvasDimensions = function()
|
5930 |
+
{
|
5931 |
+
return {
|
5932 |
+
width: this.canvas.width,
|
5933 |
+
height: this.canvas.height
|
5934 |
+
};
|
5935 |
+
}
|
5936 |
+
|
5937 |
+
WPGMZA.OLModernStoreLocatorCircle.prototype.getCenterPixels = function()
|
5938 |
+
{
|
5939 |
+
var center = this.map.latLngToPixels(this.settings.center);
|
5940 |
+
|
5941 |
+
return center;
|
5942 |
+
}
|
5943 |
+
|
5944 |
+
WPGMZA.OLModernStoreLocatorCircle.prototype.getWorldOriginOffset = function()
|
5945 |
+
{
|
5946 |
+
return {
|
5947 |
+
x: 0,
|
5948 |
+
y: 0
|
5949 |
+
};
|
5950 |
+
}
|
5951 |
+
|
5952 |
+
WPGMZA.OLModernStoreLocatorCircle.prototype.getTransformedRadius = function(km)
|
5953 |
+
{
|
5954 |
+
var center = new WPGMZA.LatLng(this.settings.center);
|
5955 |
+
var outer = new WPGMZA.LatLng(center);
|
5956 |
+
|
5957 |
+
outer.moveByDistance(km, 90);
|
5958 |
+
|
5959 |
+
var centerPixels = this.map.latLngToPixels(center);
|
5960 |
+
var outerPixels = this.map.latLngToPixels(outer);
|
5961 |
+
|
5962 |
+
return Math.abs(outerPixels.x - centerPixels.x);
|
5963 |
+
|
5964 |
+
if(!window.testMarker){
|
5965 |
+
window.testMarker = WPGMZA.Marker.createInstance({
|
5966 |
+
position: outer
|
5967 |
+
});
|
5968 |
+
WPGMZA.maps[0].addMarker(window.testMarker);
|
5969 |
+
}
|
5970 |
+
|
5971 |
+
return 100;
|
5972 |
+
}
|
5973 |
+
|
5974 |
+
WPGMZA.OLModernStoreLocatorCircle.prototype.getScale = function()
|
5975 |
+
{
|
5976 |
+
return 1;
|
5977 |
+
}
|
5978 |
+
|
5979 |
+
WPGMZA.OLModernStoreLocatorCircle.prototype.destroy = function()
|
5980 |
+
{
|
5981 |
+
$(this.canvas).remove();
|
5982 |
+
|
5983 |
+
this.map.olMap.un("postrender", this.renderFunction);
|
5984 |
+
this.map = null;
|
5985 |
+
this.canvas = null;
|
5986 |
+
}
|
5987 |
+
|
5988 |
+
});
|
5989 |
+
|
5990 |
+
// js/v8/open-layers/ol-modern-store-locator.js
|
5991 |
+
/**
|
5992 |
+
* @namespace WPGMZA
|
5993 |
+
* @module OLModernStoreLocator
|
5994 |
+
* @requires WPGMZA.ModernStoreLocator
|
5995 |
+
*/
|
5996 |
+
jQuery(function($) {
|
5997 |
+
|
5998 |
+
WPGMZA.OLModernStoreLocator = function(map_id)
|
5999 |
+
{
|
6000 |
+
var element;
|
6001 |
+
|
6002 |
+
WPGMZA.ModernStoreLocator.call(this, map_id);
|
6003 |
+
|
6004 |
+
if(WPGMZA.isProVersion())
|
6005 |
+
element = $(".wpgmza_map[data-map-id='" + map_id + "']");
|
6006 |
+
else
|
6007 |
+
element = $("#wpgmza_map");
|
6008 |
+
|
6009 |
+
element.append(this.element);
|
6010 |
+
}
|
6011 |
+
|
6012 |
+
WPGMZA.OLModernStoreLocator.prototype = Object.create(WPGMZA.ModernStoreLocator);
|
6013 |
+
WPGMZA.OLModernStoreLocator.prototype.constructor = WPGMZA.OLModernStoreLocator;
|
6014 |
+
|
6015 |
+
});
|
6016 |
+
|
6017 |
+
// js/v8/open-layers/ol-polygon.js
|
6018 |
+
/**
|
6019 |
+
* @namespace WPGMZA
|
6020 |
+
* @module OLPolygon
|
6021 |
+
* @requires WPGMZA.Polygon
|
6022 |
+
* @pro-requires WPGMZA.ProPolygon
|
6023 |
+
*/
|
6024 |
+
jQuery(function($) {
|
6025 |
+
|
6026 |
+
var Parent;
|
6027 |
+
|
6028 |
+
WPGMZA.OLPolygon = function(row, olFeature)
|
6029 |
+
{
|
6030 |
+
var self = this;
|
6031 |
+
|
6032 |
+
Parent.call(this, row, olFeature);
|
6033 |
+
|
6034 |
+
this.olStyle = new ol.style.Style();
|
6035 |
+
|
6036 |
+
if(olFeature)
|
6037 |
+
{
|
6038 |
+
this.olFeature = olFeature;
|
6039 |
+
}
|
6040 |
+
else
|
6041 |
+
{
|
6042 |
+
var coordinates = [[]];
|
6043 |
+
|
6044 |
+
if(row && row.points)
|
6045 |
+
{
|
6046 |
+
var paths = this.parseGeometry(row.points);
|
6047 |
+
|
6048 |
+
for(var i = 0; i < paths.length; i++)
|
6049 |
+
coordinates[0].push(ol.proj.fromLonLat([
|
6050 |
+
parseFloat(paths[i].lng),
|
6051 |
+
parseFloat(paths[i].lat)
|
6052 |
+
]));
|
6053 |
+
|
6054 |
+
this.olStyle = new ol.style.Style(this.getStyleFromSettings());
|
6055 |
+
}
|
6056 |
+
|
6057 |
+
this.olFeature = new ol.Feature({
|
6058 |
+
geometry: new ol.geom.Polygon(coordinates)
|
6059 |
+
});
|
6060 |
+
}
|
6061 |
+
|
6062 |
+
this.layer = new ol.layer.Vector({
|
6063 |
+
source: new ol.source.Vector({
|
6064 |
+
features: [this.olFeature]
|
6065 |
+
}),
|
6066 |
+
style: this.olStyle
|
6067 |
+
});
|
6068 |
+
|
6069 |
+
this.layer.getSource().getFeatures()[0].setProperties({
|
6070 |
+
wpgmzaPolygon: this
|
6071 |
+
});
|
6072 |
+
}
|
6073 |
+
|
6074 |
+
if(WPGMZA.isProVersion())
|
6075 |
+
Parent = WPGMZA.ProPolygon;
|
6076 |
+
else
|
6077 |
+
Parent = WPGMZA.Polygon;
|
6078 |
+
|
6079 |
+
WPGMZA.OLPolygon.prototype = Object.create(Parent.prototype);
|
6080 |
+
WPGMZA.OLPolygon.prototype.constructor = WPGMZA.OLPolygon;
|
6081 |
+
|
6082 |
+
WPGMZA.OLPolygon.prototype.getStyleFromSettings = function()
|
6083 |
+
{
|
6084 |
+
var params = {};
|
6085 |
+
|
6086 |
+
if(this.settings.strokeOpacity)
|
6087 |
+
params.stroke = new ol.style.Stroke({
|
6088 |
+
color: WPGMZA.hexOpacityToRGBA(this.settings.strokeColor, this.settings.strokeOpacity)
|
6089 |
+
});
|
6090 |
+
|
6091 |
+
if(this.settings.fillOpacity)
|
6092 |
+
params.fill = new ol.style.Fill({
|
6093 |
+
color: WPGMZA.hexOpacityToRGBA(this.settings.fillColor, this.settings.fillOpacity)
|
6094 |
+
});
|
6095 |
+
|
6096 |
+
return params;
|
6097 |
+
}
|
6098 |
+
|
6099 |
+
WPGMZA.OLPolygon.prototype.updateStyleFromSettings = function()
|
6100 |
+
{
|
6101 |
+
// Re-create the style - working on it directly doesn't cause a re-render
|
6102 |
+
var params = this.getStyleFromSettings();
|
6103 |
+
this.olStyle = new ol.style.Style(params);
|
6104 |
+
this.layer.setStyle(this.olStyle);
|
6105 |
+
}
|
6106 |
+
|
6107 |
+
WPGMZA.OLPolygon.prototype.setEditable = function(editable)
|
6108 |
+
{
|
6109 |
+
|
6110 |
+
}
|
6111 |
+
|
6112 |
+
WPGMZA.OLPolygon.prototype.toJSON = function()
|
6113 |
+
{
|
6114 |
+
var result = Parent.prototype.toJSON.call(this);
|
6115 |
+
var coordinates = this.olFeature.getGeometry().getCoordinates()[0];
|
6116 |
+
|
6117 |
+
result.points = [];
|
6118 |
+
|
6119 |
+
for(var i = 0; i < coordinates.length; i++)
|
6120 |
+
{
|
6121 |
+
var lonLat = ol.proj.toLonLat(coordinates[i]);
|
6122 |
+
var latLng = {
|
6123 |
+
lat: lonLat[1],
|
6124 |
+
lng: lonLat[0]
|
6125 |
+
};
|
6126 |
+
result.points.push(latLng);
|
6127 |
+
}
|
6128 |
+
|
6129 |
+
return result;
|
6130 |
+
}
|
6131 |
+
|
6132 |
+
});
|
6133 |
+
|
6134 |
+
// js/v8/open-layers/ol-polyline.js
|
6135 |
+
/**
|
6136 |
+
* @namespace WPGMZA
|
6137 |
+
* @module OLPolyline
|
6138 |
+
* @requires WPGMZA.Polyline
|
6139 |
+
*/
|
6140 |
+
jQuery(function($) {
|
6141 |
+
|
6142 |
+
var Parent;
|
6143 |
+
|
6144 |
+
WPGMZA.OLPolyline = function(row, olFeature)
|
6145 |
+
{
|
6146 |
+
var self = this;
|
6147 |
+
|
6148 |
+
WPGMZA.Polyline.call(this, row);
|
6149 |
+
|
6150 |
+
this.olStyle = new ol.style.Style();
|
6151 |
+
|
6152 |
+
if(olFeature)
|
6153 |
+
{
|
6154 |
+
this.olFeature = olFeature;
|
6155 |
+
}
|
6156 |
+
else
|
6157 |
+
{
|
6158 |
+
var coordinates = [];
|
6159 |
+
|
6160 |
+
if(row && row.points)
|
6161 |
+
{
|
6162 |
+
var path = this.parseGeometry(row.points);
|
6163 |
+
|
6164 |
+
for(var i = 0; i < path.length; i++)
|
6165 |
+
coordinates.push(ol.proj.fromLonLat([
|
6166 |
+
parseFloat(path[i].lng),
|
6167 |
+
parseFloat(path[i].lat)
|
6168 |
+
]));
|
6169 |
+
}
|
6170 |
+
|
6171 |
+
var params = this.getStyleFromSettings();
|
6172 |
+
this.olStyle = new ol.style.Style(params);
|
6173 |
+
|
6174 |
+
this.olFeature = new ol.Feature({
|
6175 |
+
geometry: new ol.geom.LineString(coordinates)
|
6176 |
+
});
|
6177 |
+
}
|
6178 |
+
|
6179 |
+
this.layer = new ol.layer.Vector({
|
6180 |
+
source: new ol.source.Vector({
|
6181 |
+
features: [this.olFeature]
|
6182 |
+
}),
|
6183 |
+
style: this.olStyle
|
6184 |
+
});
|
6185 |
+
|
6186 |
+
this.layer.getSource().getFeatures()[0].setProperties({
|
6187 |
+
wpgmzaPolyling: this
|
6188 |
+
});
|
6189 |
+
}
|
6190 |
+
|
6191 |
+
Parent = WPGMZA.Polyline;
|
6192 |
+
|
6193 |
+
WPGMZA.OLPolyline.prototype = Object.create(Parent.prototype);
|
6194 |
+
WPGMZA.OLPolyline.prototype.constructor = WPGMZA.OLPolyline;
|
6195 |
+
|
6196 |
+
WPGMZA.OLPolyline.prototype.getStyleFromSettings = function()
|
6197 |
+
{
|
6198 |
+
var params = {};
|
6199 |
+
|
6200 |
+
if(this.settings.strokeOpacity)
|
6201 |
+
params.stroke = new ol.style.Stroke({
|
6202 |
+
color: WPGMZA.hexOpacityToRGBA(this.settings.strokeColor, this.settings.strokeOpacity),
|
6203 |
+
width: parseInt(this.settings.strokeWeight)
|
6204 |
+
});
|
6205 |
+
|
6206 |
+
return params;
|
6207 |
+
}
|
6208 |
+
|
6209 |
+
WPGMZA.OLPolyline.prototype.updateStyleFromSettings = function()
|
6210 |
+
{
|
6211 |
+
// Re-create the style - working on it directly doesn't cause a re-render
|
6212 |
+
var params = this.getStyleFromSettings();
|
6213 |
+
this.olStyle = new ol.style.Style(params);
|
6214 |
+
this.layer.setStyle(this.olStyle);
|
6215 |
+
}
|
6216 |
+
|
6217 |
+
WPGMZA.OLPolyline.prototype.setEditable = function(editable)
|
6218 |
+
{
|
6219 |
+
|
6220 |
+
}
|
6221 |
+
|
6222 |
+
WPGMZA.OLPolyline.prototype.setPoints = function(points)
|
6223 |
+
{
|
6224 |
+
if(this.olFeature)
|
6225 |
+
this.layer.getSource().removeFeature(this.olFeature);
|
6226 |
+
|
6227 |
+
var coordinates = [];
|
6228 |
+
|
6229 |
+
for(var i = 0; i < points.length; i++)
|
6230 |
+
coordinates.push(ol.proj.fromLonLat([
|
6231 |
+
parseFloat(points[i].lng),
|
6232 |
+
parseFloat(points[i].lat)
|
6233 |
+
]));
|
6234 |
+
|
6235 |
+
this.olFeature = new ol.Feature({
|
6236 |
+
geometry: new ol.geom.LineString(coordinates)
|
6237 |
+
});
|
6238 |
+
|
6239 |
+
this.layer.getSource().addFeature(this.olFeature);
|
6240 |
+
}
|
6241 |
+
|
6242 |
+
WPGMZA.OLPolyline.prototype.toJSON = function()
|
6243 |
+
{
|
6244 |
+
var result = Parent.prototype.toJSON.call(this);
|
6245 |
+
var coordinates = this.olFeature.getGeometry().getCoordinates();
|
6246 |
+
|
6247 |
+
result.points = [];
|
6248 |
+
|
6249 |
+
for(var i = 0; i < coordinates.length; i++)
|
6250 |
+
{
|
6251 |
+
var lonLat = ol.proj.toLonLat(coordinates[i]);
|
6252 |
+
var latLng = {
|
6253 |
+
lat: lonLat[1],
|
6254 |
+
lng: lonLat[0]
|
6255 |
+
};
|
6256 |
+
result.points.push(latLng);
|
6257 |
+
}
|
6258 |
+
|
6259 |
+
return result;
|
6260 |
+
}
|
6261 |
+
|
6262 |
+
});
|
js/v8/wp-google-maps.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
jQuery(function($){var core={maps:[],events:null,settings:null,loadingHTML:'<div class="wpgmza-preloader"><div class="wpgmza-loader">...</div></div>',getScrollAnimationOffset:function(){return WPGMZA.settings.scroll_animation_offset||0},animateScroll:function(element,milliseconds){var offset=WPGMZA.getScrollAnimationOffset();milliseconds||(milliseconds=WPGMZA.settings.scroll_animation_milliseconds?WPGMZA.settings.scroll_animation_milliseconds:500),$("html, body").animate({scrollTop:$(element).offset().top-offset},milliseconds)},guid:function(){var d=(new Date).getTime();return"undefined"!=typeof performance&&"function"==typeof performance.now&&(d+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(c){var r=(d+16*Math.random())%16|0;return d=Math.floor(d/16),("x"===c?r:3&r|8).toString(16)})},hexOpacityToRGBA:function(colour,opacity){return hex=parseInt(colour.replace(/^#/,""),16),[(16711680&hex)>>16,(65280&hex)>>8,255&hex,parseFloat(opacity)]},latLngRegexp:/^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$/,isLatLngString:function(str){if("string"!=typeof str)return null;str.match(/^\(.+\)$/)&&(str=str.replace(/^\(|\)$/,""));var m=str.match(WPGMZA.latLngRegexp);return m?{lat:parseFloat(m[1]),lng:parseFloat(m[3])}:null},stringToLatLng:function(str){var result=WPGMZA.isLatLngString(str);if(!result)throw new Error("Not a valid latLng");return result},isHexColorString:function(str){return"string"==typeof str&&!!str.match(/#[0-9A-F]{6}/i)},imageDimensionsCache:{},getImageDimensions:function(src,callback){if(WPGMZA.imageDimensionsCache[src])callback(WPGMZA.imageDimensionsCache[src]);else{var img=document.createElement("img");img.onload=function(event){var result={width:image.width,height:image.height};WPGMZA.imageDimensionsCache[src]=result,callback(result)},img.src=src}},isDeveloperMode:function(){return this.developer_mode||window.Cookies&&window.Cookies.get("wpgmza-developer-mode")},isProVersion:function(){return"1"==this._isProVersion},openMediaDialog:function(callback){var file_frame;if(file_frame)return file_frame.uploader.uploader.param("post_id",set_to_post_id),void file_frame.open();(file_frame=wp.media.frames.file_frame=wp.media({title:"Select a image to upload",button:{text:"Use this image"},multiple:!1})).on("select",function(){attachment=file_frame.state().get("selection").first().toJSON(),callback(attachment.id,attachment.url)}),file_frame.open()},getCurrentPosition:function(callback){if(navigator.geolocation){var options={enableHighAccuracy:!0};navigator.geolocation.getCurrentPosition(function(position){callback&&callback(position),WPGMZA.events.trigger("userlocationfound")},function(error){options.enableHighAccuracy=!1,navigator.geolocation.getCurrentPosition(function(position){callback&&callback(position),WPGMZA.events.trigger("userlocationfound")},function(error){console.warn(error.code,error.message)},options)},options)}else console.warn("No geolocation available on this device")},runCatchableTask:function(callback,friendlyErrorContainer){if(WPGMZA.isDeveloperMode())callback();else try{callback()}catch(e){var friendlyError=new WPGMZA.FriendlyError(e);$(friendlyErrorContainer).html(""),$(friendlyErrorContainer).append(friendlyError.element),$(friendlyErrorContainer).show()}},assertInstanceOf:function(instance,instanceName){var engine,fullInstanceName,pro=WPGMZA.isProVersion()?"Pro":"";switch(WPGMZA.settings.engine){case"open-layers":engine="OL";break;default:engine="Google"}if(fullInstanceName=WPGMZA[engine+pro+instanceName]?engine+pro+instanceName:WPGMZA[pro+instanceName]?pro+instanceName:WPGMZA[engine+instanceName]?engine+instanceName:instanceName,!(instance instanceof WPGMZA[fullInstanceName]))throw new Error("Object must be an instance of "+fullInstanceName+" (did you call a constructor directly, rather than createInstance?)")},getMapByID:function(id){for(var i=0;i<WPGMZA.maps.length;i++)if(WPGMZA.maps[i].id==id)return WPGMZA.maps[i];return null},isGoogleAutocompleteSupported:function(){return"object"==typeof google&&"object"==typeof google.maps&&"object"==typeof google.maps.places&&"function"==typeof google.maps.places.Autocomplete},googleAPIStatus:window.wpgmza_google_api_status,isDeviceiOS:function(){return/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream||!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)}};window.WPGMZA?window.WPGMZA=$.extend(window.WPGMZA,core):window.WPGMZA=core;for(var key in WPGMZA_localized_data){var value=WPGMZA_localized_data[key];WPGMZA[key]=value}jQuery(function($){$("script[src*='wp-google-maps.combined.js'], script[src*='wp-google-maps-pro.combined.js']").length&&console.warn("Minified script is out of date, using combined script instead.");var elements=$("script").filter(function(){return this.src.match(/(^|\/)jquery\.(min\.)?js(\?|$)/i)});elements.length>1&&console.warn("Multiple jQuery versions detected: ",elements),WPGMZA.restAPI=WPGMZA.RestAPI.createInstance(),$(document).on("click",".wpgmza_edit_btn",function(){WPGMZA.animateScroll("#wpgmaps_tabs_markers")})}),$(window).on("load",function(event){if("https:"!=window.location.protocol){var warning='<div class="notice notice-warning"><p>'+WPGMZA.localized_strings.unsecure_geolocation+"</p></div>";$(".wpgmza-geolocation-setting").each(function(index,el){$(el).after($(warning))})}})}),jQuery(function($){WPGMZA.Compatibility=function(){this.preventDocumentWriteGoogleMapsAPI()},WPGMZA.Compatibility.prototype.preventDocumentWriteGoogleMapsAPI=function(){var old=document.write;document.write=function(content){content.match&&content.match(/maps\.google/)||old.call(document,content)}},WPGMZA.compatiblityModule=new WPGMZA.Compatibility}),function(root,factory){"object"==typeof exports?module.exports=factory(root):"function"==typeof define&&define.amd?define([],factory.bind(root,root)):factory(root)}("undefined"!=typeof global?global:this,function(root){if(root.CSS&&root.CSS.escape)return root.CSS.escape;var cssEscape=function(value){if(0==arguments.length)throw new TypeError("`CSS.escape` requires an argument.");for(var codeUnit,string=String(value),length=string.length,index=-1,result="",firstCodeUnit=string.charCodeAt(0);++index<length;)0!=(codeUnit=string.charCodeAt(index))?result+=codeUnit>=1&&codeUnit<=31||127==codeUnit||0==index&&codeUnit>=48&&codeUnit<=57||1==index&&codeUnit>=48&&codeUnit<=57&&45==firstCodeUnit?"\\"+codeUnit.toString(16)+" ":(0!=index||1!=length||45!=codeUnit)&&(codeUnit>=128||45==codeUnit||95==codeUnit||codeUnit>=48&&codeUnit<=57||codeUnit>=65&&codeUnit<=90||codeUnit>=97&&codeUnit<=122)?string.charAt(index):"\\"+string.charAt(index):result+="�";return result};return root.CSS||(root.CSS={}),root.CSS.escape=cssEscape,cssEscape}),jQuery(function($){WPGMZA.Distance={MILES:!0,KILOMETERS:!1,MILES_PER_KILOMETER:.621371,KILOMETERS_PER_MILE:1.60934,uiToMeters:function(uiDistance){return parseFloat(uiDistance)/(WPGMZA.settings.distance_units==WPGMZA.Distance.MILES?WPGMZA.Distance.MILES_PER_KILOMETER:1)*1e3},uiToKilometers:function(uiDistance){return.001*WPGMZA.Distance.uiToMeters(uiDistance)},uiToMiles:function(uiDistance){return WPGMZA.Distance.uiToKilometers(uiDistance)*WPGMZA.Distance.MILES_PER_KILOMETER},kilometersToUI:function(km){return WPGMZA.settings.distance_units==WPGMZA.Distance.MILES?km*WPGMZA.Distance.MILES_PER_KILOMETER:km}}}),jQuery(function($){WPGMZA.EventDispatcher=function(){WPGMZA.assertInstanceOf(this,"EventDispatcher"),this._listenersByType=[]},WPGMZA.EventDispatcher.prototype.addEventListener=function(type,listener,thisObject,useCapture){var arr,types=type.split(/\s+/);if(types.length>1)for(var i=0;i<types.length;i++)this.addEventListener(types[i],listener,thisObject,useCapture);else{if(!(listener instanceof Function))throw new Error("Listener must be a function");(arr=this._listenersByType[type])||(arr=this._listenersByType[type]=[]);var obj={listener:listener,thisObject:thisObject||this,useCapture:!!useCapture};arr.push(obj)}},WPGMZA.EventDispatcher.prototype.on=WPGMZA.EventDispatcher.prototype.addEventListener,WPGMZA.EventDispatcher.prototype.removeEventListener=function(type,listener,thisObject,useCapture){var arr,obj;if(arr=this._listenersByType[type]){thisObject||(thisObject=this),useCapture=!!useCapture;for(var i=0;i<arr.length;i++)if((obj=arr[i]).listener==listener&&obj.thisObject==thisObject&&obj.useCapture==useCapture)return void arr.splice(i,1)}},WPGMZA.EventDispatcher.prototype.off=WPGMZA.EventDispatcher.prototype.removeEventListener,WPGMZA.EventDispatcher.prototype.hasEventListener=function(type){return!!_listenersByType[type]},WPGMZA.EventDispatcher.prototype.dispatchEvent=function(event){if(!(event instanceof WPGMZA.Event))if("string"==typeof event)event=new WPGMZA.Event(event);else{var src=event;event=new WPGMZA.Event;for(var name in src)event[name]=src[name]}event.target=this;for(var path=[],obj=this.parent;null!=obj;obj=obj.parent)path.unshift(obj);event.phase=WPGMZA.Event.CAPTURING_PHASE;for(var i=0;i<path.length&&!event._cancelled;i++)path[i]._triggerListeners(event);if(!event._cancelled){for(event.phase=WPGMZA.Event.AT_TARGET,this._triggerListeners(event),event.phase=WPGMZA.Event.BUBBLING_PHASE,i=path.length-1;i>=0&&!event._cancelled;i--)path[i]._triggerListeners(event);if(this.element){var customEvent={};for(var key in event){var value=event[key];"type"==key&&(value+=".wpgmza"),customEvent[key]=value}$(this.element).trigger(customEvent)}}},WPGMZA.EventDispatcher.prototype.trigger=WPGMZA.EventDispatcher.prototype.dispatchEvent,WPGMZA.EventDispatcher.prototype._triggerListeners=function(event){var arr,obj;if(arr=this._listenersByType[event.type])for(var i=0;i<arr.length;i++)obj=arr[i],(event.phase!=WPGMZA.Event.CAPTURING_PHASE||obj.useCapture)&&obj.listener.call(arr[i].thisObject,event)},WPGMZA.events=new WPGMZA.EventDispatcher}),jQuery(function($){WPGMZA.Event=function(options){if("string"==typeof options&&(this.type=options),this.bubbles=!0,this.cancelable=!0,this.phase=WPGMZA.Event.PHASE_CAPTURE,this.target=null,this._cancelled=!1,"object"==typeof options)for(var name in options)this[name]=options[name]},WPGMZA.Event.CAPTURING_PHASE=0,WPGMZA.Event.AT_TARGET=1,WPGMZA.Event.BUBBLING_PHASE=2,WPGMZA.Event.prototype.stopPropagation=function(){this._cancelled=!0}}),jQuery(function($){}),jQuery(function($){WPGMZA.Geocoder=function(){WPGMZA.assertInstanceOf(this,"Geocoder")},WPGMZA.Geocoder.SUCCESS="success",WPGMZA.Geocoder.ZERO_RESULTS="zero-results",WPGMZA.Geocoder.FAIL="fail",WPGMZA.Geocoder.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.OLGeocoder;default:return WPGMZA.GoogleGeocoder}},WPGMZA.Geocoder.createInstance=function(){return new(WPGMZA.Geocoder.getConstructor())},WPGMZA.Geocoder.prototype.getLatLngFromAddress=function(options,callback){if(WPGMZA.isLatLngString(options.address)){var parts=options.address.split(/,\s*/);callback([new WPGMZA.LatLng({lat:parseFloat(parts[0]),lng:parseFloat(parts[1])})],WPGMZA.Geocoder.SUCCESS)}},WPGMZA.Geocoder.prototype.getAddressFromLatLng=function(options,callback){callback([new WPGMZA.LatLng(options.latLng).toString()],WPGMZA.Geocoder.SUCCESS)},WPGMZA.Geocoder.prototype.geocode=function(options,callback){if("address"in options)return this.getLatLngFromAddress(options,callback);if("latLng"in options)return this.getAddressFromLatLng(options,callback);throw new Error("You must supply either a latLng or address")}}),jQuery(function($){WPGMZA.GoogleAPIErrorHandler=function(){var self=this;if("google-maps"==WPGMZA.settings.engine&&("map-edit"==WPGMZA.currentPage||0==WPGMZA.is_admin&&1==WPGMZA.userCanAdministrator)&&(this.element=$(WPGMZA.html.googleMapsAPIErrorDialog),1==WPGMZA.is_admin&&this.element.find(".wpgmza-front-end-only").remove(),this.errorMessageList=this.element.find("#wpgmza-google-api-error-list"),this.templateListItem=this.element.find("li.template").remove(),this.messagesAlreadyDisplayed={},!WPGMZA.settings.developer_mode)){var _error=console.error;console.error=function(message){self.onErrorMessage(message),_error.apply(this,arguments)}}},WPGMZA.GoogleAPIErrorHandler.prototype.onErrorMessage=function(message){var m;if((m=message.match(/You have exceeded your (daily )?request quota for this API/))||(m=message.match(/This API project is not authorized to use this API/))){var urls=message.match(/http(s)?:\/\/[^\s]+/gm);this.addErrorMessage(m[0],urls)}else(m=message.match(/^Google Maps.+error: (.+)\s+(http(s?):\/\/.+)/m))&&this.addErrorMessage(m[1].replace(/([A-Z])/g," $1"),[m[2]])},WPGMZA.GoogleAPIErrorHandler.prototype.addErrorMessage=function(message,urls){if(!this.messagesAlreadyDisplayed[message]){var li=this.templateListItem.clone();$(li).find(".wpgmza-message").html(message);var buttonContainer=$(li).find(".wpgmza-documentation-buttons"),buttonTemplate=$(li).find(".wpgmza-documentation-buttons>a");if(buttonTemplate.remove(),urls&&urls.length){for(var i=0;i<urls.length;i++){var url=urls[i],button=buttonTemplate.clone(),icon="fa-external-link",text=WPGMZA.localized_strings.documentation;button.attr("href",urls[i]),url.match(/google.+documentation/)?icon="fa-google":url.match(/maps-no-account/)?(icon="fa-wrench",text=WPGMZA.localized_strings.verify_project):url.match(/console\.developers\.google/)&&(icon="fa-wrench",text=WPGMZA.localized_strings.api_dashboard),$(button).find("i").addClass(icon),$(button).append(text)}buttonContainer.append(button)}switch($(this.errorMessageList).append(li),this.dialog||(this.dialog=$(this.element).remodal()),this.dialog.getState()){case"open":case"opened":case"opening":break;default:this.dialog.open()}this.messagesAlreadyDisplayed[message]=!0}},WPGMZA.googleAPIErrorHandler=new WPGMZA.GoogleAPIErrorHandler}),jQuery(function($){WPGMZA.InfoWindow=function(mapObject){var self=this;WPGMZA.EventDispatcher.call(this),WPGMZA.assertInstanceOf(this,"InfoWindow"),mapObject&&(this.mapObject=mapObject,mapObject.map?setTimeout(function(){self.onMapObjectAdded(event)},100):mapObject.addEventListener("added",function(event){self.onMapObjectAdded(event)}))},WPGMZA.InfoWindow.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.InfoWindow.prototype.constructor=WPGMZA.InfoWindow,WPGMZA.InfoWindow.OPEN_BY_CLICK=1,WPGMZA.InfoWindow.OPEN_BY_HOVER=2,WPGMZA.InfoWindow.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProInfoWindow:WPGMZA.OLInfoWindow;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProInfoWindow:WPGMZA.GoogleInfoWindow}},WPGMZA.InfoWindow.createInstance=function(mapObject){return new(this.getConstructor())(mapObject)},WPGMZA.InfoWindow.prototype.getContent=function(callback){var html="";this.mapObject instanceof WPGMZA.Marker&&(html=this.mapObject.address),callback(html)},WPGMZA.InfoWindow.prototype.open=function(map,mapObject){return this.mapObject=mapObject,!WPGMZA.settings.disable_infowindows},WPGMZA.InfoWindow.prototype.close=function(){},WPGMZA.InfoWindow.prototype.setContent=function(options){},WPGMZA.InfoWindow.prototype.setOptions=function(options){},WPGMZA.InfoWindow.prototype.onMapObjectAdded=function(){1==this.mapObject.settings.infoopen&&this.open()}}),jQuery(function($){WPGMZA.LatLng=function(arg,lng){if(this._lat=0,this._lng=0,0!=arguments.length)if(1==arguments.length){if("string"==typeof arg){var m;if(!(m=arg.match(WPGMZA.LatLng.REGEXP)))throw new Error("Invalid LatLng string");arg={lat:m[1],lng:m[3]}}if("object"!=typeof arg||!("lat"in arg&&"lng"in arg))throw new Error("Argument must be a LatLng literal");this.lat=arg.lat,this.lng=arg.lng}else this.lat=arg,this.lng=lng},WPGMZA.LatLng.REGEXP=/^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$/,WPGMZA.LatLng.isValid=function(obj){return"object"==typeof obj&&("lat"in obj&&"lng"in obj)},Object.defineProperty(WPGMZA.LatLng.prototype,"lat",{get:function(){return this._lat},set:function(val){if(!$.isNumeric(val))throw new Error("Latitude must be numeric");this._lat=parseFloat(val)}}),Object.defineProperty(WPGMZA.LatLng.prototype,"lng",{get:function(){return this._lng},set:function(val){if(!$.isNumeric(val))throw new Error("Longitude must be numeric");this._lng=parseFloat(val)}}),WPGMZA.LatLng.prototype.toString=function(){return this._lat+", "+this._lng},WPGMZA.LatLng.fromGoogleLatLng=function(googleLatLng){return new WPGMZA.LatLng(googleLatLng.lat(),googleLatLng.lng())},WPGMZA.LatLng.prototype.toGoogleLatLng=function(){return new google.maps.LatLng({lat:this.lat,lng:this.lng})},WPGMZA.LatLng.prototype.moveByDistance=function(kilometers,heading){var delta=parseFloat(kilometers)/6371,theta=parseFloat(heading)/180*Math.PI,phi1=this.lat/180*Math.PI,lambda1=this.lng/180*Math.PI,sinPhi1=Math.sin(phi1),cosPhi1=Math.cos(phi1),sinDelta=Math.sin(delta),cosDelta=Math.cos(delta),sinTheta=Math.sin(theta),sinPhi2=sinPhi1*cosDelta+cosPhi1*sinDelta*Math.cos(theta),phi2=Math.asin(sinPhi2),y=sinTheta*sinDelta*cosPhi1,x=cosDelta-sinPhi1*sinPhi2,lambda2=lambda1+Math.atan2(y,x);this.lat=180*phi2/Math.PI,this.lng=180*lambda2/Math.PI}}),jQuery(function($){WPGMZA.LatLngBounds=function(southWest,northEast){},WPGMZA.LatLngBounds.prototype.isInInitialState=function(){return void 0==this.north&&void 0==this.south&&void 0==this.west&&void 0==this.east},WPGMZA.LatLngBounds.prototype.extend=function(latLng){this.isInInitialState()?this.north=this.south=this.west=this.east=new WPGMZA.LatLng(latLng):(latLng instanceof WPGMZA.LatLng||(latLng=new WPGMZA.LatLng(latLng)),latLng.lat<this.north&&(this.north=latLng.lat),latLng.lat>this.south&&(this.south=latLng.lat),latLng.lng<this.west&&(this.west=latLng.lng),latLng.lng>this.east&&(this.east=latLng.lng))}}),jQuery(function($){WPGMZA.MapObject=function(row){if(WPGMZA.assertInstanceOf(this,"MapObject"),WPGMZA.EventDispatcher.call(this),this.id=-1,this.guid=WPGMZA.guid(),this.modified=!0,this.settings={},row)for(var name in row)if("settings"==name){if(null==row.settings)this.settings={};else switch(typeof row.settings){case"string":this.settings=JSON.parse(row[name]);break;case"object":this.settings=row[name];break;default:throw new Error("Don't know how to interpret settings")}for(var name in this.settings){var value=this.settings[name];String(value).match(/^-?\d+$/)&&(this.settings[name]=parseInt(value))}}else this[name]=row[name]},WPGMZA.MapObject.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.MapObject.prototype.constructor=WPGMZA.MapObject,WPGMZA.MapObject.prototype.parseGeometry=function(string){var pairs,coords,results=[];pairs=string.replace(/[^ ,\d\.\-+e]/g,"").split(",");for(var i=0;i<pairs.length;i++)coords=pairs[i].split(" "),results.push({lat:parseFloat(coords[1]),lng:parseFloat(coords[0])});return results},WPGMZA.MapObject.prototype.toJSON=function(){return{id:this.id,guid:this.guid,settings:this.settings}}}),jQuery(function($){var Parent=WPGMZA.MapObject;WPGMZA.Circle=function(options,engineCircle){WPGMZA.assertInstanceOf(this,"Circle"),this.center=new WPGMZA.LatLng,this.radius=100,Parent.apply(this,arguments)},WPGMZA.Circle.prototype=Object.create(Parent.prototype),WPGMZA.Circle.prototype.constructor=WPGMZA.Circle,WPGMZA.Circle.createInstance=function(options){return new("google-maps"==WPGMZA.settings.engine?WPGMZA.GoogleCircle:WPGMZA.OLCircle)(options)},WPGMZA.Circle.prototype.getCenter=function(){return this.center.clone()},WPGMZA.Circle.prototype.setCenter=function(latLng){this.center.lat=latLng.lat,this.center.lng=latLng.lng},WPGMZA.Circle.prototype.getRadius=function(){return this.radius},WPGMZA.Circle.prototype.setRadius=function(radius){this.radius=radius},WPGMZA.Circle.prototype.getMap=function(){return this.map},WPGMZA.Circle.prototype.setMap=function(map){this.map&&this.map.removeCircle(this),map&&map.addCircle(this)}}),jQuery(function($){WPGMZA.MapSettingsPage=function(){var self=this;this.updateEngineSpecificControls(),this.updateGDPRControls(),$("select[name='wpgmza_maps_engine']").on("change",function(event){self.updateEngineSpecificControls()}),$("input[name='wpgmza_gdpr_require_consent_before_load'], input[name='wpgmza_gdpr_require_consent_before_vgm_submit'], input[name='wpgmza_gdpr_override_notice']").on("change",function(event){self.updateGDPRControls()})},WPGMZA.MapSettingsPage.prototype.updateEngineSpecificControls=function(){var engine=$("select[name='wpgmza_maps_engine']").val();$("[data-required-maps-engine][data-required-maps-engine!='"+engine+"']").hide(),$("[data-required-maps-engine='"+engine+"']").show()},WPGMZA.MapSettingsPage.prototype.updateGDPRControls=function(){var showNoticeControls=$("input[name='wpgmza_gdpr_require_consent_before_load']").prop("checked"),vgmCheckbox=$("input[name='wpgmza_gdpr_require_consent_before_vgm_submit']");vgmCheckbox.length&&(showNoticeControls=showNoticeControls||vgmCheckbox.prop("checked"));var showOverrideTextarea=showNoticeControls&&$("input[name='wpgmza_gdpr_override_notice']").prop("checked");showNoticeControls?$("#wpgmza-gdpr-compliance-notice").show("slow"):$("#wpgmza-gdpr-compliance-notice").hide("slow"),showOverrideTextarea?$("#wpgmza_gdpr_override_notice_text").show("slow"):$("#wpgmza_gdpr_override_notice_text").hide("slow")},jQuery(function($){window.location.href.match(/wp-google-maps-menu-settings/)&&(WPGMZA.mapSettingsPage=new WPGMZA.MapSettingsPage)})}),jQuery(function($){WPGMZA.MapSettings=function(element){var str=element.getAttribute("data-settings"),json=JSON.parse(str);WPGMZA.assertInstanceOf(this,"MapSettings");for(var key in WPGMZA.settings){value=WPGMZA.settings[key];this[key]=value}for(var key in json){var value=json[key];String(value).match(/^-?\d+$/)&&(value=parseInt(value)),this[key]=value}},WPGMZA.MapSettings.prototype.toOLViewOptions=function(){function empty(name){return"object"!=typeof self[name]&&(!self[name]||!self[name].length)}var options={center:ol.proj.fromLonLat([-119.4179,36.7783]),zoom:4};if("string"==typeof this.start_location){var coords=this.start_location.replace(/^\(|\)$/g,"").split(",");WPGMZA.isLatLngString(this.start_location)?options.center=ol.proj.fromLonLat([parseFloat(coords[1]),parseFloat(coords[0])]):console.warn("Invalid start location")}return this.center&&(options.center=ol.proj.fromLonLat([parseFloat(this.center.lng),parseFloat(this.center.lat)])),this.zoom&&(options.zoom=parseInt(this.zoom)),this.start_zoom&&(options.zoom=parseInt(this.start_zoom)),empty("min_zoom")||(options.minZoom=parseInt(this.min_zoom)),empty("max_zoom")||(options.maxZoom=parseInt(this.max_zoom)),options},WPGMZA.MapSettings.prototype.toGoogleMapsOptions=function(){function empty(name){return"object"!=typeof self[name]&&(!self[name]||!self[name].length)}function formatCoord(coord){return $.isNumeric(coord)?coord:parseFloat(String(coord).replace(/[\(\)\s]/,""))}var self=this,latLngCoords=this.start_location&&this.start_location.length?this.start_location.split(","):[36.7783,-119.4179],latLng=new google.maps.LatLng(formatCoord(latLngCoords[0]),formatCoord(latLngCoords[1])),zoom=this.start_zoom?parseInt(this.start_zoom):4;!this.start_zoom&&this.zoom&&(zoom=parseInt(this.zoom));var options={zoom:zoom,center:latLng};switch(empty("center")||(options.center=new google.maps.LatLng({lat:parseFloat(this.center.lat),lng:parseFloat(this.center.lng)})),empty("min_zoom")||(options.minZoom=parseInt(this.min_zoom)),empty("max_zoom")||(options.maxZoom=parseInt(this.max_zoom)),options.zoomControl=!("yes"==this.wpgmza_settings_map_zoom),options.panControl=!("yes"==this.wpgmza_settings_map_pan),options.mapTypeControl=!("yes"==this.wpgmza_settings_map_type),options.streetViewControl=!("yes"==this.wpgmza_settings_map_streetview),options.fullscreenControl=!("yes"==this.wpgmza_settings_map_full_screen_control),options.draggable=!("yes"==this.wpgmza_settings_map_draggable),options.disableDoubleClickZoom=!("yes"==this.wpgmza_settings_map_clickzoom),options.scrollwheel=!("yes"==this.wpgmza_settings_map_scroll),"greedy"==this.wpgmza_force_greedy_gestures||"yes"==this.wpgmza_force_greedy_gestures?options.gestureHandling="greedy":options.gestureHandling="cooperative",parseInt(this.map_type)){case 2:options.mapTypeId=google.maps.MapTypeId.SATELLITE;break;case 3:options.mapTypeId=google.maps.MapTypeId.HYBRID;break;case 4:options.mapTypeId=google.maps.MapTypeId.TERRAIN;break;default:options.mapTypeId=google.maps.MapTypeId.ROADMAP}if(this.theme_data&&this.theme_data.length>0)try{options.styles=JSON.parse(this.theme_data)}catch(e){alert("Your theme data is not valid JSON and has been ignored")}return options}}),jQuery(function($){function deg2rad(deg){return deg*(Math.PI/180)}WPGMZA.Map=function(element,options){if(WPGMZA.assertInstanceOf(this,"Map"),WPGMZA.EventDispatcher.call(this),!(element instanceof HTMLElement))throw new Error("Argument must be a HTMLElement");if(this.id=element.getAttribute("data-map-id"),!/\d+/.test(this.id))throw new Error("Map ID must be an integer");WPGMZA.maps.push(this),this.element=element,this.element.wpgmzaMap=this,this.engineElement=element,this.markers=[],this.polygons=[],this.polylines=[],this.circles=[],this.loadSettings(options)},WPGMZA.Map.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.Map.prototype.constructor=WPGMZA.Map,WPGMZA.Map.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProMap:WPGMZA.OLMap;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProMap:WPGMZA.GoogleMap}},WPGMZA.Map.createInstance=function(element,options){return new(WPGMZA.Map.getConstructor())(element,options)},WPGMZA.Map.prototype.loadSettings=function(options){var settings=new WPGMZA.MapSettings(this.element),other_settings=settings.other_settings;if(delete settings.other_settings,other_settings)for(var key in other_settings)settings[key]=other_settings[key];if(options)for(var key in options)settings[key]=options[key];this.settings=settings},WPGMZA.Map.prototype.setOptions=function(options){for(var name in options)this.settings[name]=options[name]};Math.PI;WPGMZA.Map.getGeographicDistance=function(lat1,lon1,lat2,lon2){var dLat=deg2rad(lat2-lat1),dLon=deg2rad(lon2-lon1),a=Math.sin(dLat/2)*Math.sin(dLat/2)+Math.cos(deg2rad(lat1))*Math.cos(deg2rad(lat2))*Math.sin(dLon/2)*Math.sin(dLon/2);return 6371*(2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a)))},WPGMZA.Map.prototype.setCenter=function(latLng){if(!("lat"in latLng&&"lng"in latLng))throw new Error("Argument is not an object with lat and lng")},WPGMZA.Map.prototype.setDimensions=function(width,height){$(this.element).css({width:width}),$(this.engineElement).css({width:"100%",height:height})},WPGMZA.Map.prototype.addMarker=function(marker){if(!(marker instanceof WPGMZA.Marker))throw new Error("Argument must be an instance of WPGMZA.Marker");marker.map=this,marker.parent=this,this.markers.push(marker),this.dispatchEvent({type:"markeradded",marker:marker}),marker.dispatchEvent({type:"added"})},WPGMZA.Map.prototype.removeMarker=function(marker){if(!(marker instanceof WPGMZA.Marker))throw new Error("Argument must be an instance of WPGMZA.Marker");if(marker.map!==this)throw new Error("Wrong map error");marker.map=null,marker.parent=null,this.markers.splice(this.markers.indexOf(marker),1),this.dispatchEvent({type:"markerremoved",marker:marker}),marker.dispatchEvent({type:"removed"})},WPGMZA.Map.prototype.getMarkerByID=function(id){for(var i=0;i<this.markers.length;i++)if(this.markers[i].id==id)return this.markers[i];return null},WPGMZA.Map.prototype.removeMarkerByID=function(id){var marker=this.getMarkerByID(id);marker&&this.removeMarker(marker)},WPGMZA.Map.prototype.addPolygon=function(polygon){if(!(polygon instanceof WPGMZA.Polygon))throw new Error("Argument must be an instance of WPGMZA.Polygon");polygon.map=this,this.polygons.push(polygon),this.dispatchEvent({type:"polygonadded",polygon:polygon})},WPGMZA.Map.prototype.deletePolygon=function(polygon){if(!(polygon instanceof WPGMZA.Polygon))throw new Error("Argument must be an instance of WPGMZA.Polygon");if(polygon.map!==this)throw new Error("Wrong map error");polygon.map=null,this.polygons.splice(this.polygons.indexOf(polygon),1),this.dispatchEvent({type:"polygonremoved",polygon:polygon})},WPGMZA.Map.prototype.getPolygonByID=function(id){for(var i=0;i<this.polygons.length;i++)if(this.polygons[i].id==id)return this.polygons[i];return null},WPGMZA.Map.prototype.deletePolygonByID=function(id){var polygon=this.getPolygonByID(id);polygon&&this.deletePolygon(polygon)},WPGMZA.Map.prototype.getPolylineByID=function(id){for(var i=0;i<this.polylines.length;i++)if(this.polylines[i].id==id)return this.polylines[i];return null},WPGMZA.Map.prototype.addPolyline=function(polyline){if(!(polyline instanceof WPGMZA.Polyline))throw new Error("Argument must be an instance of WPGMZA.Polyline");polyline.map=this,this.polylines.push(polyline),this.dispatchEvent({type:"polylineadded",polyline:polyline})},WPGMZA.Map.prototype.deletePolyline=function(polyline){if(!(polyline instanceof WPGMZA.Polyline))throw new Error("Argument must be an instance of WPGMZA.Polyline");if(polyline.map!==this)throw new Error("Wrong map error");polyline.map=null,this.polylines.splice(this.polylines.indexOf(polyline),1),this.dispatchEvent({type:"polylineremoved",polyline:polyline})},WPGMZA.Map.prototype.getPolylineByID=function(id){for(var i=0;i<this.polylines.length;i++)if(this.polylines[i].id==id)return this.polylines[i];return null},WPGMZA.Map.prototype.deletePolylineByID=function(id){var polyline=this.getPolylineByID(id);polyline&&this.deletePolyline(polyline)},WPGMZA.Map.prototype.addCircle=function(circle){if(!(circle instanceof WPGMZA.Circle))throw new Error("Argument must be an instance of WPGMZA.Circle");circle.map=this,this.circles.push(circle),this.dispatchEvent({type:"circleadded",circle:circle})},WPGMZA.Map.prototype.removeCircle=function(circle){if(!(circle instanceof WPGMZA.Circle))throw new Error("Argument must be an instance of WPGMZA.Circle");if(circle.map!==this)throw new Error("Wrong map error");circle.map=null,this.circles.splice(this.circles.indexOf(circle),1),this.dispatchEvent({type:"circleremoved",circle:circle})},WPGMZA.Map.prototype.getCircleByID=function(id){for(var i=0;i<this.circles.length;i++)if(this.circles[i].id==id)return this.circles[i];return null},WPGMZA.Map.prototype.deleteCircleByID=function(id){var circle=this.getCircleByID(id);circle&&this.deleteCircle(circle)},WPGMZA.Map.prototype.nudge=function(x,y){var pixels=this.latLngToPixels(this.getCenter());if(pixels.x+=parseFloat(x),pixels.y+=parseFloat(y),isNaN(pixels.x)||isNaN(pixels.y))throw new Error("Invalid coordinates supplied");var latLng=this.pixelsToLatLng(pixels);this.setCenter(latLng)},WPGMZA.Map.prototype.onWindowResize=function(event){},WPGMZA.Map.prototype.onElementResized=function(event){},WPGMZA.Map.prototype.onBoundsChanged=function(event){this.trigger("boundschanged"),this.trigger("bounds_changed")},WPGMZA.Map.prototype.onIdle=function(event){$(this.element).trigger("idle")}}),jQuery(function($){WPGMZA.MapsEngineDialog=function(element){var self=this;this.element=element,window.wpgmzaUnbindSaveReminder&&window.wpgmzaUnbindSaveReminder(),$(element).show(),$(element).remodal().open(),$(element).find("input:radio").on("change",function(event){$("#wpgmza-confirm-engine").prop("disabled",!1)}),$("#wpgmza-confirm-engine").on("click",function(event){self.onButtonClicked(event)})},WPGMZA.MapsEngineDialog.prototype.onButtonClicked=function(event){$(event.target).prop("disabled",!0),$.ajax(WPGMZA.ajaxurl,{method:"POST",data:{action:"wpgmza_maps_engine_dialog_set_engine",engine:$("[name='wpgmza_maps_engine']:checked").val()},success:function(response,status,xhr){window.location.reload()}})},$(window).on("load",function(event){var element=$("#wpgmza-maps-engine-dialog");element.length&&(WPGMZA.settings.wpgmza_maps_engine_dialog_done||(WPGMZA.mapsEngineDialog=new WPGMZA.MapsEngineDialog(element)))})}),jQuery(function($){WPGMZA.Marker=function(row){var self=this;WPGMZA.assertInstanceOf(this,"Marker"),this.lat="36.778261",this.lng="-119.4179323999",this.address="California",this.title=null,this.description="",this.link="",this.icon="",this.approved=1,this.pic=null,WPGMZA.MapObject.apply(this,arguments),row&&row.heatmap||(row&&this.on("init",function(event){row.position&&this.setPosition(row.position),row.map&&row.map.addMarker(this)}),this.addEventListener("added",function(event){self.onAdded(event)}))},WPGMZA.Marker.prototype=Object.create(WPGMZA.MapObject.prototype),WPGMZA.Marker.prototype.constructor=WPGMZA.Marker,WPGMZA.Marker.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProMarker:WPGMZA.OLMarker;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProMarker:WPGMZA.GoogleMarker}},WPGMZA.Marker.createInstance=function(row){return new(WPGMZA.Marker.getConstructor())(row)},WPGMZA.Marker.ANIMATION_NONE="0",WPGMZA.Marker.ANIMATION_BOUNCE="1",WPGMZA.Marker.ANIMATION_DROP="2",WPGMZA.Marker.prototype.onAdded=function(event){var self=this;this.addEventListener("click",function(event){self.onClick(event)}),this.addEventListener("mouseover",function(event){self.onMouseOver(event)}),this.addEventListener("select",function(event){self.onSelect(event)}),this.map.settings.marker==this.id&&self.trigger("select")},WPGMZA.Marker.prototype.hidePreviousInteractedInfoWindow=function(){this.map.lastInteractedMarker&&this.map.lastInteractedMarker.infoWindow.close()},WPGMZA.Marker.prototype.openInfoWindow=function(){},WPGMZA.Marker.prototype.onClick=function(event){},WPGMZA.Marker.prototype.onSelect=function(event){this.openInfoWindow()},WPGMZA.Marker.prototype.onMouseOver=function(event){this.map.settings.info_window_open_by==WPGMZA.InfoWindow.OPEN_BY_HOVER&&this.openInfoWindow()},WPGMZA.Marker.prototype.getIcon=function(){return function(url){return"string"!=typeof url?url:url.replace(/^http(s?):/,"")}(WPGMZA.settings.default_marker_icon)},WPGMZA.Marker.prototype.getPosition=function(){return{lat:parseFloat(this.lat),lng:parseFloat(this.lng)}},WPGMZA.Marker.prototype.setPosition=function(latLng){latLng instanceof WPGMZA.LatLng?(this.lat=latLng.lat,this.lng=latLng.lng):(this.lat=parseFloat(latLng.lat),this.lng=parseFloat(latLng.lng))},WPGMZA.Marker.prototype.getAnimation=function(animation){return this.settings.animation},WPGMZA.Marker.prototype.setAnimation=function(animation){this.settings.animation=animation},WPGMZA.Marker.prototype.getVisible=function(visible){},WPGMZA.Marker.prototype.setVisible=function(visible){!visible&&this.infoWindow&&this.infoWindow.close()},WPGMZA.Marker.prototype.setMap=function(map){map?map.addMarker(this):this.map&&this.map.removeMarker(this)},WPGMZA.Marker.prototype.getDraggable=function(){},WPGMZA.Marker.prototype.setDraggable=function(draggable){},WPGMZA.Marker.prototype.setOptions=function(){},WPGMZA.Marker.prototype.panIntoView=function(){if(!this.map)throw new Error("Marker hasn't been added to a map");this.map.setCenter(this.getPosition())},WPGMZA.Marker.prototype.toJSON=function(){var result=WPGMZA.MapObject.prototype.toJSON.call(this),position=this.getPosition();return $.extend(result,{lat:position.lat,lng:position.lng,address:this.address,title:this.title,description:this.description,link:this.link,icon:this.icon,pic:this.pic,approved:this.approved}),result}}),jQuery(function($){WPGMZA.ModernStoreLocatorCircle=function(map_id,settings){var map;map=WPGMZA.isProVersion()?this.map=MYMAP[map_id].map:this.map=MYMAP.map,this.map_id=map_id,this.mapElement=map.element,this.mapSize={width:$(this.mapElement).width(),height:$(this.mapElement).height()},this.initCanvasLayer(),this.settings={center:new WPGMZA.LatLng(0,0),radius:1,color:"#63AFF2",shadowColor:"white",shadowBlur:4,centerRingRadius:10,centerRingLineWidth:3,numInnerRings:9,innerRingLineWidth:1,innerRingFade:!0,numOuterRings:7,ringLineWidth:1,mainRingLineWidth:2,numSpokes:6,spokesStartAngle:Math.PI/2,numRadiusLabels:6,radiusLabelsStartAngle:Math.PI/2,radiusLabelFont:"13px sans-serif",visible:!1},settings&&this.setOptions(settings)},WPGMZA.ModernStoreLocatorCircle.createInstance=function(map,settings){return"google-maps"==WPGMZA.settings.engine?new WPGMZA.GoogleModernStoreLocatorCircle(map,settings):new WPGMZA.OLModernStoreLocatorCircle(map,settings)},WPGMZA.ModernStoreLocatorCircle.prototype.initCanvasLayer=function(){},WPGMZA.ModernStoreLocatorCircle.prototype.onResize=function(event){this.draw()},WPGMZA.ModernStoreLocatorCircle.prototype.onUpdate=function(event){this.draw()},WPGMZA.ModernStoreLocatorCircle.prototype.setOptions=function(options){for(var name in options){var functionName="set"+name.substr(0,1).toUpperCase()+name.substr(1);"function"==typeof this[functionName]?this[functionName](options[name]):this.settings[name]=options[name]}},WPGMZA.ModernStoreLocatorCircle.prototype.getResolutionScale=function(){return window.devicePixelRatio||1},WPGMZA.ModernStoreLocatorCircle.prototype.getCenter=function(){return this.getPosition()},WPGMZA.ModernStoreLocatorCircle.prototype.setCenter=function(value){this.setPosition(value)},WPGMZA.ModernStoreLocatorCircle.prototype.getPosition=function(){return this.settings.center},WPGMZA.ModernStoreLocatorCircle.prototype.setPosition=function(position){this.settings.center=position},WPGMZA.ModernStoreLocatorCircle.prototype.getRadius=function(){return this.settings.radius},WPGMZA.ModernStoreLocatorCircle.prototype.setRadius=function(radius){if(isNaN(radius))throw new Error("Invalid radius");this.settings.radius=radius},WPGMZA.ModernStoreLocatorCircle.prototype.getVisible=function(visible){return this.settings.visible},WPGMZA.ModernStoreLocatorCircle.prototype.setVisible=function(visible){this.settings.visible=visible},WPGMZA.ModernStoreLocatorCircle.prototype.getTransformedRadius=function(km){throw new Error("Abstract function called")},WPGMZA.ModernStoreLocatorCircle.prototype.getContext=function(type){throw new Error("Abstract function called")},WPGMZA.ModernStoreLocatorCircle.prototype.getCanvasDimensions=function(){throw new Error("Abstract function called")},WPGMZA.ModernStoreLocatorCircle.prototype.validateSettings=function(){WPGMZA.isHexColorString(this.settings.color)||(this.settings.color="#63AFF2")},WPGMZA.ModernStoreLocatorCircle.prototype.draw=function(){this.validateSettings();var settings=this.settings,canvasDimensions=this.getCanvasDimensions(),canvasWidth=canvasDimensions.width,canvasHeight=canvasDimensions.height;this.map,this.getResolutionScale();if(context=this.getContext("2d"),context.clearRect(0,0,canvasWidth,canvasHeight),settings.visible){context.shadowColor=settings.shadowColor,context.shadowBlur=settings.shadowBlur,context.setTransform(1,0,0,1,0,0);var scale=this.getScale();context.scale(scale,scale);var offset=this.getWorldOriginOffset();context.translate(offset.x,offset.y);new WPGMZA.LatLng(this.settings.center);var worldPoint=this.getCenterPixels(),rgba=WPGMZA.hexToRgba(settings.color),ringSpacing=this.getTransformedRadius(settings.radius)/(settings.numInnerRings+1);context.strokeStyle=settings.color,context.lineWidth=1/scale*settings.centerRingLineWidth,context.beginPath(),context.arc(worldPoint.x,worldPoint.y,this.getTransformedRadius(settings.centerRingRadius)/scale,0,2*Math.PI),context.stroke(),context.closePath();var end,spokeAngle,radius=this.getTransformedRadius(settings.radius)+ringSpacing*settings.numOuterRings+1,grad=context.createRadialGradient(0,0,0,0,0,radius),rgba=WPGMZA.hexToRgba(settings.color),start=WPGMZA.rgbaToString(rgba);rgba.a=0,end=WPGMZA.rgbaToString(rgba),grad.addColorStop(0,start),grad.addColorStop(1,end),context.save(),context.translate(worldPoint.x,worldPoint.y),context.strokeStyle=grad,context.lineWidth=2/scale;for(i=0;i<settings.numSpokes;i++)spokeAngle=settings.spokesStartAngle+2*Math.PI*(i/settings.numSpokes),x=Math.cos(spokeAngle)*radius,y=Math.sin(spokeAngle)*radius,context.setLineDash([2/scale,15/scale]),context.beginPath(),context.moveTo(0,0),context.lineTo(x,y),context.stroke();context.setLineDash([]),context.restore(),context.lineWidth=1/scale*settings.innerRingLineWidth;for(i=1;i<=settings.numInnerRings;i++){radius=i*ringSpacing;settings.innerRingFade&&(rgba.a=1-(i-1)/settings.numInnerRings),context.strokeStyle=WPGMZA.rgbaToString(rgba),context.beginPath(),context.arc(worldPoint.x,worldPoint.y,radius,0,2*Math.PI),context.stroke(),context.closePath()}context.strokeStyle=settings.color,context.lineWidth=1/scale*settings.centerRingLineWidth,context.beginPath(),context.arc(worldPoint.x,worldPoint.y,this.getTransformedRadius(settings.radius),0,2*Math.PI),context.stroke(),context.closePath();for(var radius=radius+ringSpacing,i=0;i<settings.numOuterRings;i++)settings.innerRingFade&&(rgba.a=1-i/settings.numOuterRings),context.strokeStyle=WPGMZA.rgbaToString(rgba),context.beginPath(),context.arc(worldPoint.x,worldPoint.y,radius,0,2*Math.PI),context.stroke(),context.closePath(),radius+=ringSpacing;if(settings.numRadiusLabels>0){var m,x,y,radius=this.getTransformedRadius(settings.radius);(m=settings.radiusLabelFont.match(/(\d+)px/))&&parseInt(m[1])/2*1.1/scale,context.font=settings.radiusLabelFont,context.textAlign="center",context.textBaseline="middle",context.fillStyle=settings.color,context.save(),context.translate(worldPoint.x,worldPoint.y);for(i=0;i<settings.numRadiusLabels;i++){var width,textAngle=(spokeAngle=settings.radiusLabelsStartAngle+2*Math.PI*(i/settings.numRadiusLabels))+Math.PI/2,text=settings.radiusString;Math.sin(spokeAngle)>0&&(textAngle-=Math.PI),x=Math.cos(spokeAngle)*radius,y=Math.sin(spokeAngle)*radius,context.save(),context.translate(x,y),context.rotate(textAngle),context.scale(1/scale,1/scale),width=context.measureText(text).width,height=width/2,context.clearRect(-width,-height,2*width,2*height),context.fillText(settings.radiusString,0,0),context.restore()}context.restore()}}}}),jQuery(function($){WPGMZA.ModernStoreLocator=function(map_id){var original,self=this;if(WPGMZA.assertInstanceOf(this,"ModernStoreLocator"),(original=WPGMZA.isProVersion()?$(".wpgmza_sl_search_button[mid='"+map_id+"']").closest(".wpgmza_sl_main_div"):$(".wpgmza_sl_search_button").closest(".wpgmza_sl_main_div")).length){this.element=$("<div class='wpgmza-modern-store-locator'><div class='wpgmza-inner wpgmza-modern-hover-opaque'/></div>")[0];var inner=$(this.element).find(".wpgmza-inner"),titleSearch=$(original).find("[id='nameInput_"+map_id+"']");if(titleSearch.length){var placeholder=wpgmaps_localize[map_id].other_settings.store_locator_name_string;placeholder&&placeholder.length&&titleSearch.attr("placeholder",placeholder),inner.append(titleSearch)}var addressInput;addressInput=WPGMZA.isProVersion()?$(original).find(".addressInput"):$(original).find("#addressInput"),wpgmaps_localize[map_id].other_settings.store_locator_query_string&&wpgmaps_localize[map_id].other_settings.store_locator_query_string.length&&addressInput.attr("placeholder",wpgmaps_localize[map_id].other_settings.store_locator_query_string),inner.append(addressInput),inner.append($(original).find("select.wpgmza_sl_radius_select")),this.searchButton=$(original).find(".wpgmza_sl_search_button"),inner.append(this.searchButton),this.resetButton=$(original).find(".wpgmza_sl_reset_button_div"),inner.append(this.resetButton),this.resetButton.on("click",function(event){resetLocations(map_id)}),this.resetButton.hide(),WPGMZA.isProVersion()&&(this.searchButton.on("click",function(event){0!=$("addressInput_"+map_id).val()&&(self.searchButton.hide(),self.resetButton.show())}),this.resetButton.on("click",function(event){self.resetButton.hide(),self.searchButton.show()})),inner.append($("#wpgmza_distance_type_"+map_id));var container=$(original).find(".wpgmza_cat_checkbox_holder"),numCategories=($(container).children("ul"),0),icons=[];$(container).find("li").each(function(index,el){var id=$(el).attr("class").match(/\d+/);for(var category_id in wpgmza_category_data)if(id==category_id){var src=wpgmza_category_data[category_id].image,icon=$('<div class="wpgmza-chip-icon"/>');icon.css({"background-image":"url('"+src+"')",width:$("#wpgmza_cat_checkbox_"+category_id+" + label").height()+"px"}),icons.push(icon),null!=src&&""!=src&&$("#wpgmza_cat_checkbox_"+category_id+" + label").prepend(icon),numCategories++;break}}),$(this.element).append(container),numCategories&&(this.optionsButton=$('<span class="wpgmza_store_locator_options_button"><i class="fas fa-list"></i></span>'),$(this.searchButton).before(this.optionsButton)),setInterval(function(){icons.forEach(function(icon){var height=$(icon).height();$(icon).css({width:height+"px"}),$(icon).closest("label").css({"padding-left":height+8+"px"})}),$(container).css("width",$(self.element).find(".wpgmza-inner").outerWidth()+"px")},1e3),$(this.element).find(".wpgmza_store_locator_options_button").on("click",function(event){container.hasClass("wpgmza-open")?container.removeClass("wpgmza-open"):container.addClass("wpgmza-open")}),$(original).remove(),$(this.element).find("input, select").on("focus",function(){$(inner).addClass("active")}),$(this.element).find("input, select").on("blur",function(){$(inner).removeClass("active")})}},WPGMZA.ModernStoreLocator.createInstance=function(map_id){return"google-maps"==WPGMZA.settings.engine?new WPGMZA.GoogleModernStoreLocator(map_id):new WPGMZA.OLModernStoreLocator(map_id)}}),jQuery(function($){WPGMZA.Polygon=function(row,enginePolygon){WPGMZA.assertInstanceOf(this,"Polygon"),this.paths=null,this.title=null,this.name=null,this.link=null,WPGMZA.MapObject.apply(this,arguments)},WPGMZA.Polygon.prototype=Object.create(WPGMZA.MapObject.prototype),WPGMZA.Polygon.prototype.constructor=WPGMZA.Polygon,WPGMZA.Polygon.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProPolygon:WPGMZA.OLPolygon;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProPolygon:WPGMZA.GooglePolygon}},WPGMZA.Polygon.createInstance=function(row,engineObject){return new(WPGMZA.Polygon.getConstructor())(row,engineObject)},WPGMZA.Polygon.prototype.toJSON=function(){var result=WPGMZA.MapObject.prototype.toJSON.call(this);return $.extend(result,{name:this.name,title:this.title,link:this.link}),result}}),jQuery(function($){WPGMZA.Polyline=function(row,googlePolyline){WPGMZA.assertInstanceOf(this,"Polyline"),this.title=null,WPGMZA.MapObject.apply(this,arguments)},WPGMZA.Polyline.prototype=Object.create(WPGMZA.MapObject.prototype),WPGMZA.Polyline.prototype.constructor=WPGMZA.Polyline,WPGMZA.Polyline.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.OLPolyline;default:return WPGMZA.GooglePolyline}},WPGMZA.Polyline.createInstance=function(row,engineObject){return new(WPGMZA.Polyline.getConstructor())(row,engineObject)},WPGMZA.Polyline.prototype.getPoints=function(){return this.toJSON().points},WPGMZA.Polyline.prototype.toJSON=function(){var result=WPGMZA.MapObject.prototype.toJSON.call(this);return result.title=this.title,result}}),jQuery(function($){WPGMZA.RestAPI=function(){WPGMZA.RestAPI.URL=WPGMZA.resturl},WPGMZA.RestAPI.createInstance=function(){return new WPGMZA.RestAPI},WPGMZA.RestAPI.prototype.call=function(route,params){if("string"!=typeof route||!route.match(/^\//))throw new Error("Invalid route");$.ajax(WPGMZA.RestAPI.URL+route,params)}}),jQuery(function($){function isPositiveInteger(x){return/^\d+$/.test(x)}function validateParts(parts){for(var i=0;i<parts.length;++i)if(!isPositiveInteger(parts[i]))return!1;return!0}WPGMZA.Version=function(){},WPGMZA.Version.compare=function(v1,v2){var v1parts=v1.split("."),v2parts=v2.split(".");if(!validateParts(v1parts)||!validateParts(v2parts))return NaN;for(var i=0;i<v1parts.length;++i){if(v2parts.length===i)return 1;if(v1parts[i]!==v2parts[i])return v1parts[i]>v2parts[i]?1:-1}return v1parts.length!=v2parts.length?-1:0}}),jQuery(function($){WPGMZA.GoogleUICompatibility=function(){if(!(navigator.vendor&&navigator.vendor.indexOf("Apple")>-1&&navigator.userAgent&&-1==navigator.userAgent.indexOf("CriOS")&&-1==navigator.userAgent.indexOf("FxiOS"))){var style=$("<style id='wpgmza-google-ui-compatiblity-fix'/>");style.html(".wpgmza_map img:not(button img) { padding:0 !important; }"),$(document.head).append(style)}},WPGMZA.googleUICompatibility=new WPGMZA.GoogleUICompatibility}),jQuery(function($){WPGMZA.GoogleCircle=function(options,googleCircle){var self=this;if(WPGMZA.Circle.call(this,options,googleCircle),googleCircle?this.googleCircle=googleCircle:(this.googleCircle=new google.maps.Circle,this.googleCircle.wpgmzaCircle=this),google.maps.event.addListener(this.googleCircle,"click",function(){self.dispatchEvent({type:"click"})}),options){var googleOptions={};delete(googleOptions=$.extend({},options)).map,delete googleOptions.center,options.center&&(googleOptions.center=new google.maps.LatLng({lat:options.center.lat,lng:options.center.lng})),this.googleCircle.setOptions(googleOptions),options.map&&options.map.addCircle(this)}},WPGMZA.GoogleCircle.prototype=Object.create(WPGMZA.Circle.prototype),WPGMZA.GoogleCircle.prototype.constructor=WPGMZA.GoogleCircle}),jQuery(function($){WPGMZA.GoogleGeocoder=function(){},WPGMZA.GoogleGeocoder.prototype=Object.create(WPGMZA.Geocoder.prototype),WPGMZA.GoogleGeocoder.prototype.constructor=WPGMZA.GoogleGeocoder,WPGMZA.GoogleGeocoder.prototype.getLatLngFromAddress=function(options,callback){if(!options||!options.address)throw new Error("No address specified");if(WPGMZA.isLatLngString(options.address))return WPGMZA.Geocoder.prototype.getLatLngFromAddress.call(this,options,callback);options.country&&(options.componentRestrictions={country:options.country}),(new google.maps.Geocoder).geocode(options,function(results,status){if(status==google.maps.GeocoderStatus.OK){var location=results[0].geometry.location,latLng={lat:location.lat(),lng:location.lng()};callback(results=[{geometry:{location:latLng},latLng:latLng,lat:latLng.lat,lng:latLng.lng}],WPGMZA.Geocoder.SUCCESS)}else{var nativeStatus=WPGMZA.Geocoder.FAIL;status==google.maps.GeocoderStatus.ZERO_RESULTS&&(nativeStatus=WPGMZA.Geocoder.ZERO_RESULTS),callback(null,nativeStatus)}})},WPGMZA.GoogleGeocoder.prototype.getAddressFromLatLng=function(options,callback){if(!options||!options.latLng)throw new Error("No latLng specified");var latLng=new WPGMZA.LatLng(options.latLng),geocoder=new google.maps.Geocoder;delete(options=$.extend(options,{location:{lat:latLng.lat,lng:latLng.lng}})).latLng,geocoder.geocode(options,function(results,status){"OK"!==status&&callback(null,WPGMZA.Geocoder.FAIL),results&&results.length||callback([],WPGMZA.Geocoder.NO_RESULTS),callback([results[0].formatted_address],WPGMZA.Geocoder.SUCCESS)})}}),jQuery(function($){var Parent;WPGMZA.GoogleInfoWindow=function(mapObject){Parent.call(this,mapObject),this.setMapObject(mapObject)},Parent=WPGMZA.isProVersion()?WPGMZA.ProInfoWindow:WPGMZA.InfoWindow,WPGMZA.GoogleInfoWindow.prototype=Object.create(Parent.prototype),WPGMZA.GoogleInfoWindow.prototype.constructor=WPGMZA.GoogleInfoWindow,WPGMZA.GoogleInfoWindow.prototype.setMapObject=function(mapObject){mapObject instanceof WPGMZA.Marker?this.googleObject=mapObject.googleMarker:mapObject instanceof WPGMZA.Polygon?this.googleObject=mapObject.googlePolygon:mapObject instanceof WPGMZA.Polyline&&(this.googleObject=mapObject.googlePolyline)},WPGMZA.GoogleInfoWindow.prototype.createGoogleInfoWindow=function(){this.googleInfoWindow||(this.googleInfoWindow=new google.maps.InfoWindow)},WPGMZA.GoogleInfoWindow.prototype.open=function(map,mapObject){return!!Parent.prototype.open.call(this,map,mapObject)&&(this.createGoogleInfoWindow(),this.setMapObject(mapObject),this.googleInfoWindow.open(this.mapObject.map.googleMap,this.googleObject),this.content&&this.googleInfoWindow.setContent(this.content),!0)},WPGMZA.GoogleInfoWindow.prototype.close=function(){this.googleInfoWindow&&(WPGMZA.InfoWindow.prototype.close.call(this),this.googleInfoWindow.close())},WPGMZA.GoogleInfoWindow.prototype.setContent=function(html){Parent.prototype.setContent.call(this,html),this.content=html,this.createGoogleInfoWindow(),this.googleInfoWindow.setContent(html)},WPGMZA.GoogleInfoWindow.prototype.setOptions=function(options){Parent.prototype.setOptions.call(this,options),this.createGoogleInfoWindow(),this.googleInfoWindow.setOptions(options)}}),jQuery(function($){var Parent;WPGMZA.GoogleMap=function(element,options){var self=this;if(Parent.call(this,element,options),!window.google){var status=WPGMZA.googleAPIStatus,message="Google API not loaded";if(status&&status.message&&(message+=" - "+status.message),"USER_CONSENT_NOT_GIVEN"==status.code)return;throw $(element).html("<div class='notice notice-error'><p>"+WPGMZA.localized_strings.google_api_not_loaded+"<pre>"+message+"</pre></p></div>"),new Error(message)}this.loadGoogleMap(),options&&this.setOptions(options),google.maps.event.addListener(this.googleMap,"click",function(event){var wpgmzaEvent=new WPGMZA.Event("click");wpgmzaEvent.latLng={lat:event.latLng.lat(),lng:event.latLng.lng()},self.dispatchEvent(wpgmzaEvent)}),google.maps.event.addListener(this.googleMap,"rightclick",function(event){var wpgmzaEvent=new WPGMZA.Event("rightclick");wpgmzaEvent.latLng={lat:event.latLng.lat(),lng:event.latLng.lng()},self.dispatchEvent(wpgmzaEvent)}),google.maps.event.addListener(this.googleMap,"dragend",function(event){self.dispatchEvent("dragend")}),google.maps.event.addListener(this.googleMap,"zoom_changed",function(event){self.dispatchEvent("zoom_changed"),self.dispatchEvent("zoomchanged")}),google.maps.event.addListener(this.googleMap,"idle",function(event){self.onIdle(event)}),WPGMZA.isProVersion()||(this.dispatchEvent("created"),WPGMZA.events.dispatchEvent({type:"mapcreated",map:this}))},WPGMZA.isProVersion()?(Parent=WPGMZA.ProMap,WPGMZA.GoogleMap.prototype=Object.create(WPGMZA.ProMap.prototype)):(Parent=WPGMZA.Map,WPGMZA.GoogleMap.prototype=Object.create(WPGMZA.Map.prototype)),WPGMZA.GoogleMap.prototype.constructor=WPGMZA.GoogleMap,WPGMZA.GoogleMap.prototype.loadGoogleMap=function(){var self=this,options=this.settings.toGoogleMapsOptions();this.googleMap=new google.maps.Map(this.engineElement,options),google.maps.event.addListener(this.googleMap,"bounds_changed",function(){self.onBoundsChanged()}),1==this.settings.bicycle&&this.enableBicycleLayer(!0),1==this.settings.traffic&&this.enableTrafficLayer(!0),1==this.settings.transport&&this.enablePublicTransportLayer(!0),this.showPointsOfInterest(this.settings.show_points_of_interest),$(this.engineElement).append($(this.element).find(".wpgmza-loader"))},WPGMZA.GoogleMap.prototype.setOptions=function(options){Parent.prototype.setOptions.call(this,options),this.googleMap.setOptions(this.settings.toGoogleMapsOptions());var clone=$.extend({},options);(clone.center instanceof WPGMZA.LatLng||"object"==typeof clone.center)&&(clone.center={lat:parseFloat(clone.center.lat),lng:parseFloat(clone.center.lng)}),this.googleMap.setOptions(clone)},WPGMZA.GoogleMap.prototype.addMarker=function(marker){marker.googleMarker.setMap(this.googleMap),Parent.prototype.addMarker.call(this,marker)},WPGMZA.GoogleMap.prototype.removeMarker=function(marker){marker.googleMarker.setMap(null),Parent.prototype.removeMarker.call(this,marker)},WPGMZA.GoogleMap.prototype.addPolygon=function(polygon){polygon.googlePolygon.setMap(this.googleMap),Parent.prototype.addPolygon.call(this,polygon)},WPGMZA.GoogleMap.prototype.removePolygon=function(polygon){polygon.googlePolygon.setMap(null),Parent.prototype.removePolygon.call(this,polygon)},WPGMZA.GoogleMap.prototype.addPolyline=function(polyline){polyline.googlePolyline.setMap(this.googleMap),Parent.prototype.addPolyline.call(this,polyline)},WPGMZA.GoogleMap.prototype.removePolyline=function(polyline){polyline.googlePolyline.setMap(null),Parent.prototype.removePolyline.call(this,polyline)},WPGMZA.GoogleMap.prototype.addCircle=function(circle){circle.googleCircle.setMap(this.googleMap),Parent.prototype.addCircle.call(this,circle)},WPGMZA.GoogleMap.prototype.removeCircle=function(circle){circle.googleCircle.setMap(null),Parent.prototype.removeCircle.call(this,circle)},WPGMZA.GoogleMap.prototype.getCenter=function(){var latLng=this.googleMap.getCenter();return{lat:latLng.lat(),lng:latLng.lng()}},WPGMZA.GoogleMap.prototype.setCenter=function(latLng){WPGMZA.Map.prototype.setCenter.call(this,latLng),latLng instanceof WPGMZA.LatLng?this.googleMap.setCenter({lat:latLng.lat,lng:latLng.lng}):this.googleMap.setCenter(latLng)},WPGMZA.GoogleMap.prototype.panTo=function(latLng){latLng instanceof WPGMZA.LatLng?this.googleMap.panTo({lat:latLng.lat,lng:latLng.lng}):this.googleMap.panTo(latLng)},WPGMZA.GoogleMap.prototype.getZoom=function(){return this.googleMap.getZoom()},WPGMZA.GoogleMap.prototype.setZoom=function(value){if(isNaN(value))throw new Error("Value must not be NaN");return this.googleMap.setZoom(value)},WPGMZA.GoogleMap.prototype.getBounds=function(){var bounds=this.googleMap.getBounds(),northEast=bounds.getNorthEast(),southWest=bounds.getSouthWest();return{topLeft:{lat:northEast.lat(),lng:southWest.lng()},bottomRight:{lat:southWest.lat(),lng:northEast.lng()}}},WPGMZA.GoogleMap.prototype.fitBounds=function(southWest,northEast){southWest instanceof WPGMZA.LatLng&&(southWest={lat:southWest.lat,lng:southWest.lng}),northEast instanceof WPGMZA.LatLng&&(northEast={lat:northEast.lat,lng:northEast.lng}),this.googleMap.fitBounds(southWest,northEast)},WPGMZA.GoogleMap.prototype.fitBoundsToVisibleMarkers=function(){for(var bounds=new google.maps.LatLngBounds,i=0;i<this.markers.length;i++)markers[i].getVisible()&&bounds.extend(markers[i].getPosition());this.googleMap.fitBounds(bounds)},WPGMZA.GoogleMap.prototype.enableBicycleLayer=function(enable){this.bicycleLayer||(this.bicycleLayer=new google.maps.BicyclingLayer),this.bicycleLayer.setMap(enable?this.googleMap:null)},WPGMZA.GoogleMap.prototype.enableTrafficLayer=function(enable){this.trafficLayer||(this.trafficLayer=new google.maps.TrafficLayer),this.trafficLayer.setMap(enable?this.googleMap:null)},WPGMZA.GoogleMap.prototype.enablePublicTransportLayer=function(enable){this.publicTransportLayer||(this.publicTransportLayer=new google.maps.TransitLayer),this.publicTransportLayer.setMap(enable?this.googleMap:null)},WPGMZA.GoogleMap.prototype.showPointsOfInterest=function(show){var text=$("textarea[name='theme_data']").val();if(text){var styles=JSON.parse(text);styles.push({featureType:"poi",stylers:[{visibility:show?"on":"off"}]}),this.googleMap.setOptions({styles:styles})}},WPGMZA.GoogleMap.prototype.getMinZoom=function(){return parseInt(this.settings.min_zoom)},WPGMZA.GoogleMap.prototype.setMinZoom=function(value){this.googleMap.setOptions({minZoom:value,maxZoom:this.getMaxZoom()})},WPGMZA.GoogleMap.prototype.getMaxZoom=function(){return parseInt(this.settings.max_zoom)},WPGMZA.GoogleMap.prototype.setMaxZoom=function(value){this.googleMap.setOptions({minZoom:this.getMinZoom(),maxZoom:value})},WPGMZA.GoogleMap.prototype.latLngToPixels=function(latLng){var map=this.googleMap,nativeLatLng=new google.maps.LatLng({lat:parseFloat(latLng.lat),lng:parseFloat(latLng.lng)}),topRight=map.getProjection().fromLatLngToPoint(map.getBounds().getNorthEast()),bottomLeft=map.getProjection().fromLatLngToPoint(map.getBounds().getSouthWest()),scale=Math.pow(2,map.getZoom()),worldPoint=map.getProjection().fromLatLngToPoint(nativeLatLng);return{x:(worldPoint.x-bottomLeft.x)*scale,y:(worldPoint.y-topRight.y)*scale}},WPGMZA.GoogleMap.prototype.pixelsToLatLng=function(x,y){void 0==y&&("x"in x&&"y"in x?(y=x.y,x=x.x):console.warn("Y coordinate undefined in pixelsToLatLng (did you mean to pass 2 arguments?)"));var map=this.googleMap,topRight=map.getProjection().fromLatLngToPoint(map.getBounds().getNorthEast()),bottomLeft=map.getProjection().fromLatLngToPoint(map.getBounds().getSouthWest()),scale=Math.pow(2,map.getZoom()),worldPoint=new google.maps.Point(x/scale+bottomLeft.x,y/scale+topRight.y),latLng=map.getProjection().fromPointToLatLng(worldPoint);return{lat:latLng.lat(),lng:latLng.lng()}},WPGMZA.GoogleMap.prototype.onElementResized=function(event){this.googleMap&&google.maps.event.trigger(this.googleMap,"resize")}}),jQuery(function($){var Parent;WPGMZA.GoogleMarker=function(row){var self=this;Parent.call(this,row);var settings={};if(row)for(var name in row)row[name]instanceof WPGMZA.LatLng?settings[name]=row[name].toGoogleLatLng():row[name]instanceof WPGMZA.Map||(settings[name]=row[name]);this.googleMarker=new google.maps.Marker(settings),this.googleMarker.wpgmzaMarker=this,this.googleMarker.setPosition(new google.maps.LatLng({lat:parseFloat(this.lat),lng:parseFloat(this.lng)})),this.googleMarker.setLabel(this.settings.label),this.animation&&this.googleMarker.setAnimation(this.animation),google.maps.event.addListener(this.googleMarker,"click",function(){self.dispatchEvent("click"),self.dispatchEvent("select")}),google.maps.event.addListener(this.googleMarker,"mouseover",function(){self.dispatchEvent("mouseover")}),google.maps.event.addListener(this.googleMarker,"dragend",function(){var googleMarkerPosition=self.googleMarker.getPosition();self.setPosition({lat:googleMarkerPosition.lat(),lng:googleMarkerPosition.lng()}),self.dispatchEvent({type:"dragend",latLng:self.getPosition()})}),this.trigger("init")},Parent=WPGMZA.isProVersion()?WPGMZA.ProMarker:WPGMZA.Marker,WPGMZA.GoogleMarker.prototype=Object.create(Parent.prototype),WPGMZA.GoogleMarker.prototype.constructor=WPGMZA.GoogleMarker,WPGMZA.GoogleMarker.prototype.setLabel=function(label){label?(this.googleMarker.setLabel({text:label}),this.googleMarker.getIcon()||this.googleMarker.setIcon(WPGMZA.settings.default_marker_icon)):this.googleMarker.setLabel(null)},WPGMZA.GoogleMarker.prototype.setPosition=function(latLng){Parent.prototype.setPosition.call(this,latLng),this.googleMarker.setPosition({lat:this.lat,lng:this.lng})},WPGMZA.GoogleMarker.prototype.setOffset=function(x,y){var params,self=this,icon=this.googleMarker.getIcon(),img=new Image;params="string"==typeof icon?{url:icon}:icon,img.onload=function(){var defaultAnchor={x:img.width/2,y:img.height};params.anchor=new google.maps.Point(defaultAnchor.x-x,defaultAnchor.y-y),self.googleMarker.setIcon(params)},img.src=params.url},WPGMZA.GoogleMarker.prototype.setOptions=function(options){this.googleMarker.setOptions(options)},WPGMZA.GoogleMarker.prototype.setAnimation=function(animation){Parent.prototype.setAnimation.call(this,animation),this.googleMarker.setAnimation(animation)},WPGMZA.GoogleMarker.prototype.setVisible=function(visible){Parent.prototype.setVisible.call(this,visible),this.googleMarker.setVisible(visible)},WPGMZA.GoogleMarker.prototype.setDraggable=function(draggable){this.googleMarker.setDraggable(draggable)}}),jQuery(function($){WPGMZA.GoogleModernStoreLocatorCircle=function(map,settings){var self=this;WPGMZA.ModernStoreLocatorCircle.call(this,map,settings),this.intervalID=setInterval(function(){var mapSize={width:$(self.mapElement).width(),height:$(self.mapElement).height()};mapSize.width==self.mapSize.width&&mapSize.height==self.mapSize.height||(self.canvasLayer.resize_(),self.canvasLayer.draw(),self.mapSize=mapSize)},1e3),$(document).bind("webkitfullscreenchange mozfullscreenchange fullscreenchange",function(){self.canvasLayer.resize_(),self.canvasLayer.draw()})},WPGMZA.GoogleModernStoreLocatorCircle.prototype=Object.create(WPGMZA.ModernStoreLocatorCircle.prototype),WPGMZA.GoogleModernStoreLocatorCircle.prototype.constructor=WPGMZA.GoogleModernStoreLocatorCircle,WPGMZA.GoogleModernStoreLocatorCircle.prototype.initCanvasLayer=function(){var self=this;this.canvasLayer&&(this.canvasLayer.setMap(null),this.canvasLayer.setAnimate(!1)),this.canvasLayer=new CanvasLayer({map:this.map.googleMap,resizeHandler:function(event){self.onResize(event)},updateHandler:function(event){self.onUpdate(event)},animate:!0,resolutionScale:this.getResolutionScale()})},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setOptions=function(options){WPGMZA.ModernStoreLocatorCircle.prototype.setOptions.call(this,options),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setPosition=function(position){WPGMZA.ModernStoreLocatorCircle.prototype.setPosition.call(this,position),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setRadius=function(radius){WPGMZA.ModernStoreLocatorCircle.prototype.setRadius.call(this,radius),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getTransformedRadius=function(km){var spherical=google.maps.geometry.spherical,center=this.settings.center,equator=new WPGMZA.LatLng({lat:0,lng:0}),latitude=new WPGMZA.LatLng({lat:center.lat,lng:0}),offsetAtEquator=spherical.computeOffset(equator.toGoogleLatLng(),1e3*km,90),result=.006395*km*(spherical.computeOffset(latitude.toGoogleLatLng(),1e3*km,90).lng()/offsetAtEquator.lng());if(isNaN(result))throw new Error("here");return result},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getCanvasDimensions=function(){return{width:this.canvasLayer.canvas.width,height:this.canvasLayer.canvas.height}},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getWorldOriginOffset=function(){var position=this.map.googleMap.getProjection().fromLatLngToPoint(this.canvasLayer.getTopLeft());return{x:-position.x,y:-position.y}},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getCenterPixels=function(){var center=new WPGMZA.LatLng(this.settings.center);return this.map.googleMap.getProjection().fromLatLngToPoint(center.toGoogleLatLng())},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getContext=function(type){return this.canvasLayer.canvas.getContext("2d")},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getScale=function(){return Math.pow(2,this.map.getZoom())*this.getResolutionScale()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setVisible=function(visible){WPGMZA.ModernStoreLocatorCircle.prototype.setVisible.call(this,visible),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.destroy=function(){this.canvasLayer.setMap(null),this.canvasLayer=null,clearInterval(this.intervalID)}}),jQuery(function($){WPGMZA.GoogleModernStoreLocator=function(map_id){WPGMZA.ModernStoreLocator.call(this,map_id);(WPGMZA.isProVersion()?MYMAP[map_id].map.googleMap:MYMAP.map.googleMap).controls[google.maps.ControlPosition.TOP_CENTER].push(this.element)},WPGMZA.GoogleModernStoreLocator.prototype=Object.create(WPGMZA.ModernStoreLocator.prototype),WPGMZA.GoogleModernStoreLocator.prototype.constructor=WPGMZA.GoogleModernStoreLocator}),jQuery(function($){var Parent;WPGMZA.GooglePolygon=function(row,googlePolygon){var self=this;if(Parent.call(this,row,googlePolygon),googlePolygon)this.googlePolygon=googlePolygon;else if(this.googlePolygon=new google.maps.Polygon(this.settings),row&&row.points){var paths=this.parseGeometry(row.points);this.googlePolygon.setOptions({paths:paths})}this.googlePolygon.wpgmzaPolygon=this,google.maps.event.addListener(this.googlePolygon,"click",function(){self.dispatchEvent({type:"click"})})},Parent=WPGMZA.isProVersion()?WPGMZA.ProPolygon:WPGMZA.Polygon,WPGMZA.GooglePolygon.prototype=Object.create(Parent.prototype),WPGMZA.GooglePolygon.prototype.constructor=WPGMZA.GooglePolygon,WPGMZA.GooglePolygon.prototype.getEditable=function(){return this.googlePolygon.getOptions().editable},WPGMZA.GooglePolygon.prototype.setEditable=function(value){this.googlePolygon.setOptions({editable:value})},WPGMZA.GooglePolygon.prototype.toJSON=function(){var result=WPGMZA.Polygon.prototype.toJSON.call(this);result.points=[];for(var path=this.googlePolygon.getPath(),i=0;i<path.getLength();i++){var latLng=path.getAt(i);result.points.push({lat:latLng.lat(),lng:latLng.lng()})}return result}}),jQuery(function($){WPGMZA.GooglePolyline=function(row,googlePolyline){var self=this;if(WPGMZA.Polyline.call(this,row,googlePolyline),googlePolyline)this.googlePolyline=googlePolyline;else if(this.googlePolyline=new google.maps.Polyline(this.settings),this.googlePolyline.wpgmzaPolyline=this,row&&row.points){var path=this.parseGeometry(row.points);this.setPoints(path)}google.maps.event.addListener(this.googlePolyline,"click",function(){self.dispatchEvent({type:"click"})})},WPGMZA.GooglePolyline.prototype=Object.create(WPGMZA.Polyline.prototype),WPGMZA.GooglePolyline.prototype.constructor=WPGMZA.GooglePolyline,WPGMZA.GooglePolyline.prototype.setEditable=function(value){this.googlePolyline.setOptions({editable:value})},WPGMZA.GooglePolyline.prototype.setPoints=function(points){this.googlePolyline.setOptions({path:points})},WPGMZA.GooglePolyline.prototype.toJSON=function(){var result=WPGMZA.Polyline.prototype.toJSON.call(this);result.points=[];for(var path=this.googlePolyline.getPath(),i=0;i<path.getLength();i++){var latLng=path.getAt(i);result.points.push({lat:latLng.lat(),lng:latLng.lng()})}return result}}),jQuery(function($){"google-maps"==WPGMZA.settings.engine&&(WPGMZA.googleAPIStatus&&"USER_CONSENT_NOT_GIVEN"==WPGMZA.googleAPIStatus.code||(WPGMZA.GoogleVertexContextMenu=function(mapEditPage){var self=this;this.mapEditPage=mapEditPage,this.element=document.createElement("div"),this.element.className="wpgmza-vertex-context-menu",this.element.innerHTML="Delete",google.maps.event.addDomListener(this.element,"click",function(event){return self.removeVertex(),event.preventDefault(),event.stopPropagation(),!1})},WPGMZA.GoogleVertexContextMenu.prototype=new google.maps.OverlayView,WPGMZA.GoogleVertexContextMenu.prototype.onAdd=function(){var self=this,map=this.getMap();this.getPanes().floatPane.appendChild(this.element),this.divListener=google.maps.event.addDomListener(map.getDiv(),"mousedown",function(e){e.target!=self.element&&self.close()},!0)},WPGMZA.GoogleVertexContextMenu.prototype.onRemove=function(){google.maps.event.removeListener(this.divListener),this.element.parentNode.removeChild(this.element),this.set("position"),this.set("path"),this.set("vertex")},WPGMZA.GoogleVertexContextMenu.prototype.open=function(map,path,vertex){this.set("position",path.getAt(vertex)),this.set("path",path),this.set("vertex",vertex),this.setMap(map),this.draw()},WPGMZA.GoogleVertexContextMenu.prototype.close=function(){this.setMap(null)},WPGMZA.GoogleVertexContextMenu.prototype.draw=function(){var position=this.get("position"),projection=this.getProjection();if(position&&projection){var point=projection.fromLatLngToDivPixel(position);this.element.style.top=point.y+"px",this.element.style.left=point.x+"px"}},WPGMZA.GoogleVertexContextMenu.prototype.removeVertex=function(){var path=this.get("path"),vertex=this.get("vertex");path&&void 0!=vertex?(path.removeAt(vertex),this.close()):this.close()}))}),jQuery(function($){var Parent=WPGMZA.Circle;WPGMZA.OLCircle=function(options,olFeature){this.center={lat:0,lng:0},this.radius=0,Parent.call(this,options,olFeature),this.settings.fillColor||(this.settings.fillColor="#ff0000",this.settings.fillOpacity=.6),this.olStyle=new ol.style.Style(this.getStyleFromSettings());var vectorLayer3857=new ol.layer.Vector({source:new ol.source.Vector,style:this.olStyle});if(olFeature)this.olFeature=olFeature;else{var x,y,wgs84Sphere=new ol.Sphere(6378137),radius=this.radius;x=this.center.lng,y=this.center.lat;var circle3857=ol.geom.Polygon.circular(wgs84Sphere,[x,y],radius,64).clone().transform("EPSG:4326","EPSG:3857");vectorLayer3857.getSource().addFeature(new ol.Feature(circle3857))}this.layer=vectorLayer3857,options.map.olMap.addLayer(vectorLayer3857)},WPGMZA.OLCircle.prototype=Object.create(Parent.prototype),WPGMZA.OLCircle.prototype.constructor=WPGMZA.OLCircle,WPGMZA.OLCircle.prototype.getStyleFromSettings=function(){var params={};return this.settings.strokeOpacity&&(params.stroke=new ol.style.Stroke({color:WPGMZA.hexOpacityToRGBA(this.settings.strokeColor,this.settings.strokeOpacity)})),this.settings.fillOpacity&&(params.fill=new ol.style.Fill({color:WPGMZA.hexOpacityToRGBA(this.settings.fillColor,this.settings.fillOpacity)})),params},WPGMZA.OLCircle.prototype.updateStyleFromSettings=function(){var params=this.getStyleFromSettings();this.olStyle=new ol.style.Style(params),this.layer.setStyle(this.olStyle)}}),jQuery(function($){WPGMZA.OLGeocoder=function(){},WPGMZA.OLGeocoder.prototype=Object.create(WPGMZA.Geocoder.prototype),WPGMZA.OLGeocoder.prototype.constructor=WPGMZA.OLGeocoder,WPGMZA.OLGeocoder.prototype.getResponseFromCache=function(address,callback){$.ajax(WPGMZA.ajaxurl,{data:{action:"wpgmza_query_nominatim_cache",query:address},success:function(response,xhr,status){response.lng=response.lon,callback(response)}})},WPGMZA.OLGeocoder.prototype.getResponseFromNominatim=function(options,callback){var data={q:options.address,format:"json"};options.country&&(data.countrycodes=options.country),$.ajax("https://nominatim.openstreetmap.org/search/",{data:data,success:function(response,xhr,status){callback(response)},error:function(response,xhr,status){callback(null,WPGMZA.Geocoder.FAIL)}})},WPGMZA.OLGeocoder.prototype.cacheResponse=function(address,response){$.ajax(WPGMZA.ajaxurl,{data:{action:"wpgmza_store_nominatim_cache",query:address,response:JSON.stringify(response)},method:"POST"})},WPGMZA.OLGeocoder.prototype.getLatLngFromAddress=function(options,callback){return WPGMZA.OLGeocoder.prototype.geocode(options,callback)},WPGMZA.OLGeocoder.prototype.getAddressFromLatLng=function(options,callback){return WPGMZA.OLGeocoder.prototype.geocode(options,callback)},WPGMZA.OLGeocoder.prototype.geocode=function(options,callback){var self=this;if(!options)throw new Error("Invalid options");options.location&&(options.latLng=new WPGMZA.LatLng(options.location));var finish,location;if(options.address)location=options.address,finish=function(response,status){for(var i=0;i<response.length;i++)response[i].geometry={location:new WPGMZA.LatLng({lat:parseFloat(response[i].lat),lng:parseFloat(response[i].lon)})},response[i].latLng={lat:parseFloat(response[i].lat),lng:parseFloat(response[i].lon)},response[i].lng=response[i].lon;callback(response,status)};else{if(!options.latLng)throw new Error("You must supply either a latLng or address");location=options.latLng.toString(),finish=function(response,status){var address=response[0].display_name;callback([address],status)}}this.getResponseFromCache(location,function(response){response.length?finish(response,WPGMZA.Geocoder.SUCCESS):self.getResponseFromNominatim($.extend(options,{address:location}),function(response,status){status!=WPGMZA.Geocoder.FAIL?0!=response.length?(finish(response,WPGMZA.Geocoder.SUCCESS),self.cacheResponse(location,response)):callback([],WPGMZA.Geocoder.ZERO_RESULTS):callback(null,WPGMZA.Geocoder.FAIL)})})}}),jQuery(function($){var Parent;WPGMZA.OLInfoWindow=function(mapObject){var self=this;Parent.call(this,mapObject),this.element=$("<div class='ol-info-window-container ol-info-window-plain'></div>")[0],$(this.element).on("click",".ol-info-window-close",function(event){self.close()})},Parent=WPGMZA.isProVersion()?WPGMZA.ProInfoWindow:WPGMZA.InfoWindow,WPGMZA.OLInfoWindow.prototype=Object.create(Parent.prototype),WPGMZA.OLInfoWindow.prototype.constructor=WPGMZA.OLInfoWindow,WPGMZA.OLInfoWindow.prototype.open=function(map,mapObject){var self=this,latLng=mapObject.getPosition();if(!WPGMZA.InfoWindow.prototype.open.call(this,map,mapObject))return!1;this.overlay&&this.mapObject.map.olMap.removeOverlay(this.overlay),this.overlay=new ol.Overlay({element:this.element}),this.overlay.setPosition(ol.proj.fromLonLat([latLng.lng,latLng.lat])),self.mapObject.map.olMap.addOverlay(this.overlay),$(this.element).show(),this.dispatchEvent("infowindowopen")},WPGMZA.OLInfoWindow.prototype.close=function(event){$(this.element).hide(),this.overlay&&(WPGMZA.InfoWindow.prototype.close.call(this),this.mapObject.map.olMap.removeOverlay(this.overlay),this.overlay=null)},WPGMZA.OLInfoWindow.prototype.setContent=function(html){$(this.element).html("<i class='fa fa-times ol-info-window-close' aria-hidden='true'></i>"+html)},WPGMZA.OLInfoWindow.prototype.setOptions=function(options){WPGMZA.settings.developer_mode&&console.log(options),options.maxWidth&&$(this.element).css({"max-width":options.maxWidth+"px"})}}),jQuery(function($){var Parent;WPGMZA.OLMap=function(element,options){var self=this;Parent.call(this,element),this.setOptions(options);var viewOptions=this.settings.toOLViewOptions();$(this.element).html(""),this.olMap=new ol.Map({target:$(element)[0],layers:[this.getTileLayer()],view:new ol.View(viewOptions)}),this.olMap.getInteractions().forEach(function(interaction){interaction instanceof ol.interaction.DragPan?interaction.setActive("yes"!=this.settings.wpgmza_settings_map_draggable):interaction instanceof ol.interaction.DoubleClickZoom?interaction.setActive(!this.settings.wpgmza_settings_map_clickzoom):interaction instanceof ol.interaction.MouseWheelZoom&&interaction.setActive("yes"!=this.settings.wpgmza_settings_map_scroll)},this),this.olMap.getControls().forEach(function(control){control instanceof ol.control.Zoom&&"yes"==WPGMZA.settings.wpgmza_settings_map_zoom&&this.olMap.removeControl(control)},this),"yes"!=WPGMZA.settings.wpgmza_settings_map_full_screen_control&&this.olMap.addControl(new ol.control.FullScreen),this.markerLayer=new ol.layer.Vector({source:new ol.source.Vector({features:[]})}),this.olMap.addLayer(this.markerLayer),this.olMap.on("movestart",function(event){self.isBeingDragged=!0}),this.olMap.on("moveend",function(event){self.wrapLongitude(),self.isBeingDragged=!1,self.dispatchEvent("dragend"),self.onIdle()}),this.olMap.getView().on("change:resolution",function(event){self.dispatchEvent("zoom_changed"),self.dispatchEvent("zoomchanged"),self.onIdle()}),this.olMap.getView().on("change",function(){self.onBoundsChanged()}),self.onBoundsChanged();var marker;this.storeLocator&&(marker=this.storeLocator.centerPointMarker)&&(this.olMap.addOverlay(marker.overlay),marker.setVisible(!1)),$(this.element).on("click contextmenu",function(event){var isRight;event=event||window.event;var latLng=self.pixelsToLatLng(event.offsetX,event.offsetY);if("which"in event?isRight=3==event.which:"button"in event&&(isRight=2==event.button),1!=event.which&&1!=event.button){if(isRight)return self.onRightClick(event)}else{if(self.isBeingDragged)return;self.trigger({type:"click",latLng:latLng})}}),WPGMZA.isProVersion()||(this.dispatchEvent("created"),WPGMZA.events.dispatchEvent({type:"mapcreated",map:this}))},Parent=WPGMZA.isProVersion()?WPGMZA.ProMap:WPGMZA.Map,WPGMZA.OLMap.prototype=Object.create(Parent.prototype),WPGMZA.OLMap.prototype.constructor=WPGMZA.OLMap,WPGMZA.OLMap.prototype.getTileLayer=function(){return new ol.layer.Tile({source:new ol.source.OSM})},WPGMZA.OLMap.prototype.wrapLongitude=function(){var center=this.getCenter();center.lng>=-180&¢er.lng<=180||(center.lng=center.lng-360*Math.floor(center.lng/360),center.lng>180&&(center.lng-=360),this.setCenter(center))},WPGMZA.OLMap.prototype.getCenter=function(){var lonLat=ol.proj.toLonLat(this.olMap.getView().getCenter());return{lat:lonLat[1],lng:lonLat[0]}},WPGMZA.OLMap.prototype.setCenter=function(latLng){var view=this.olMap.getView();WPGMZA.Map.prototype.setCenter.call(this,latLng),view.setCenter(ol.proj.fromLonLat([latLng.lng,latLng.lat])),this.wrapLongitude(),this.onBoundsChanged()},WPGMZA.OLMap.prototype.getBounds=function(){var bounds=this.olMap.getView().calculateExtent(this.olMap.getSize()),topLeft=ol.proj.toLonLat([bounds[0],bounds[1]]),bottomRight=ol.proj.toLonLat([bounds[2],bounds[3]]);return{topLeft:{lat:topLeft[1],lng:topLeft[0]},bottomRight:{lat:bottomRight[1],lng:bottomRight[0]}}},WPGMZA.OLMap.prototype.fitBounds=function(southWest,northEast){this.olMap.getView().fitExtent([southWest.lng,southWest.lat,northEast.lng,northEast.lat],this.olMap.getSize())},WPGMZA.OLMap.prototype.panTo=function(latLng){this.olMap.getView().animate({center:ol.proj.fromLonLat([parseFloat(latLng.lng),parseFloat(latLng.lat)]),duration:500})},WPGMZA.OLMap.prototype.getZoom=function(){return Math.round(this.olMap.getView().getZoom())+1},WPGMZA.OLMap.prototype.setZoom=function(value){this.olMap.getView().setZoom(value)},WPGMZA.OLMap.prototype.getMinZoom=function(){return this.olMap.getView().getMinZoom()},WPGMZA.OLMap.prototype.setMinZoom=function(value){this.olMap.getView().setMinZoom(value)},WPGMZA.OLMap.prototype.getMaxZoom=function(){return this.olMap.getView().getMaxZoom()},WPGMZA.OLMap.prototype.setMaxZoom=function(value){this.olMap.getView().setMaxZoom(value)},WPGMZA.OLMap.prototype.setOptions=function(options){Parent.prototype.setOptions.call(this,options),this.olMap&&this.olMap.getView().setProperties(this.settings.toOLViewOptions())},WPGMZA.OLMap.prototype.addMarker=function(marker){this.olMap.addOverlay(marker.overlay),Parent.prototype.addMarker.call(this,marker)},WPGMZA.OLMap.prototype.removeMarker=function(marker){this.olMap.removeOverlay(marker.overlay),Parent.prototype.removeMarker.call(this,marker)},WPGMZA.OLMap.prototype.addPolygon=function(polygon){this.olMap.addLayer(polygon.layer),Parent.prototype.addPolygon.call(this,polygon)},WPGMZA.OLMap.prototype.removePolygon=function(polygon){this.olMap.removeLayer(polygon.layer),Parent.prototype.removePolygon.call(this,polygon)},WPGMZA.OLMap.prototype.addPolyline=function(polyline){this.olMap.addLayer(polyline.layer),Parent.prototype.addPolyline.call(this,polyline)},WPGMZA.OLMap.prototype.removePolyline=function(polyline){this.olMap.removeLayer(polyline.layer),Parent.prototype.removePolyline.call(this,polyline)},WPGMZA.OLMap.prototype.addCircle=function(circle){this.olMap.addLayer(circle.layer),Parent.prototype.addCircle.call(this,circle)},WPGMZA.OLMap.prototype.removeCircle=function(circle){this.olMap.removeLayer(circle.layer),Parent.prototype.removeCircle.call(this,circle)},WPGMZA.OLMap.prototype.pixelsToLatLng=function(x,y){void 0==y&&("x"in x&&"y"in x?(y=x.y,x=x.x):console.warn("Y coordinate undefined in pixelsToLatLng (did you mean to pass 2 arguments?)"));var coord=this.olMap.getCoordinateFromPixel([x,y]);if(!coord)return{x:null,y:null};var lonLat=ol.proj.toLonLat(coord);return{lat:lonLat[1],lng:lonLat[0]}},WPGMZA.OLMap.prototype.latLngToPixels=function(latLng){var coord=ol.proj.fromLonLat([latLng.lng,latLng.lat]),pixel=this.olMap.getPixelFromCoordinate(coord);return pixel?{x:pixel[0],y:pixel[1]}:{x:null,y:null}},WPGMZA.OLMap.prototype.enableBicycleLayer=function(value){if(value)this.bicycleLayer||(this.bicycleLayer=new ol.layer.Tile({source:new ol.source.OSM({url:"http://{a-c}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png"})})),this.olMap.addLayer(this.bicycleLayer);else{if(!this.bicycleLayer)return;this.olMap.removeLayer(this.bicycleLayer)}},WPGMZA.OLMap.prototype.onElementResized=function(event){this.olMap.updateSize()},WPGMZA.OLMap.prototype.onRightClick=function(event){if($(event.target).closest(".ol-marker, .wpgmza_modern_infowindow, .wpgmza-modern-store-locator").length)return!0;var parentOffset=$(this.element).offset(),relX=event.pageX-parentOffset.left,relY=event.pageY-parentOffset.top,latLng=this.pixelsToLatLng(relX,relY);return this.trigger({type:"rightclick",latLng:latLng}),$(this.element).trigger({type:"rightclick",latLng:latLng}),event.preventDefault(),!1}}),jQuery(function($){var Parent;WPGMZA.OLMarker=function(row){var self=this;Parent.call(this,row);var origin=ol.proj.fromLonLat([parseFloat(this.lng),parseFloat(this.lat)]);this.element=$("<div class='ol-marker'><img src='"+WPGMZA.settings.default_marker_icon+"'/></div>")[0],this.element.wpgmzaMarker=this,$(this.element).on("mouseover",function(event){self.dispatchEvent("mouseover")}),this.overlay=new ol.Overlay({element:this.element}),this.overlay.setPosition(origin),this.animation&&this.setAnimation(this.animation),this.setLabel(this.settings.label),row&&row.draggable&&this.setDraggable(!0),this.rebindClickListener(),this.trigger("init")},Parent=WPGMZA.isProVersion()?WPGMZA.ProMarker:WPGMZA.Marker,WPGMZA.OLMarker.prototype=Object.create(Parent.prototype),WPGMZA.OLMarker.prototype.constructor=WPGMZA.OLMarker,WPGMZA.OLMarker.prototype.addLabel=function(){this.setLabel(this.getLabelText())},WPGMZA.OLMarker.prototype.setLabel=function(label){label?(this.label||(this.label=$("<div class='ol-marker-label'/>"),$(this.element).append(this.label)),this.label.html(label)):this.label&&$(this.element).find(".ol-marker-label").remove()},WPGMZA.OLMarker.prototype.setVisible=function(visible){Parent.prototype.setVisible(visible),this.overlay.getElement().style.display=visible?"block":"none"},WPGMZA.OLMarker.prototype.setPosition=function(latLng){Parent.prototype.setPosition.call(this,latLng);var origin=ol.proj.fromLonLat([parseFloat(this.lng),parseFloat(this.lat)]);this.overlay.setPosition(origin)},WPGMZA.OLMarker.prototype.setOffset=function(x,y){this.element.style.position="relative",this.element.style.left=x+"px",this.element.style.top=y+"px"},WPGMZA.OLMarker.prototype.setAnimation=function(anim){switch(Parent.prototype.setAnimation.call(this,anim),anim){case WPGMZA.Marker.ANIMATION_NONE:$(this.element).removeAttr("data-anim");break;case WPGMZA.Marker.ANIMATION_BOUNCE:$(this.element).attr("data-anim","bounce");break;case WPGMZA.Marker.ANIMATION_DROP:$(this.element).attr("data-anim","drop")}},WPGMZA.OLMarker.prototype.setDraggable=function(draggable){var self=this;if(draggable){var options={disabled:!1};this.jQueryDraggableInitialized||(options.start=function(event){self.onDragStart(event)},options.stop=function(event){self.onDragEnd(event)}),$(this.element).draggable(options),this.jQueryDraggableInitialized=!0,this.rebindClickListener()}else $(this.element).draggable({disabled:!0})},WPGMZA.OLMarker.prototype.onDragStart=function(event){this.isBeingDragged=!0},WPGMZA.OLMarker.prototype.onDragEnd=function(event){var offset={top:parseFloat($(this.element).css("top").match(/-?\d+/)[0]),left:parseFloat($(this.element).css("left").match(/-?\d+/)[0])};$(this.element).css({top:"0px",left:"0px"});var currentLatLng=this.getPosition(),pixelsBeforeDrag=this.map.latLngToPixels(currentLatLng),pixelsAfterDrag={x:pixelsBeforeDrag.x+offset.left,y:pixelsBeforeDrag.y+offset.top},latLngAfterDrag=this.map.pixelsToLatLng(pixelsAfterDrag);this.setPosition(latLngAfterDrag),this.isBeingDragged=!1,this.trigger({type:"dragend",latLng:latLngAfterDrag})},WPGMZA.OLMarker.prototype.onElementClick=function(event){var self=event.currentTarget.wpgmzaMarker;self.isBeingDragged||(self.dispatchEvent("click"),self.dispatchEvent("select"))},WPGMZA.OLMarker.prototype.rebindClickListener=function(){$(this.element).off("click",this.onElementClick),$(this.element).on("click",this.onElementClick)}}),jQuery(function($){WPGMZA.OLModernStoreLocatorCircle=function(map,settings){WPGMZA.ModernStoreLocatorCircle.call(this,map,settings)},WPGMZA.OLModernStoreLocatorCircle.prototype=Object.create(WPGMZA.ModernStoreLocatorCircle.prototype),WPGMZA.OLModernStoreLocatorCircle.prototype.constructor=WPGMZA.OLModernStoreLocatorCircle,WPGMZA.OLModernStoreLocatorCircle.prototype.initCanvasLayer=function(){var self=this,mapElement=$(this.map.element),olViewportElement=mapElement.children(".ol-viewport");this.canvas=document.createElement("canvas"),this.canvas.className="wpgmza-ol-canvas-overlay",mapElement.append(this.canvas),this.renderFunction=function(event){self.canvas.width==olViewportElement.width()&&self.canvas.height==olViewportElement.height()||(self.canvas.width=olViewportElement.width(),self.canvas.height=olViewportElement.height(),$(this.canvas).css({width:olViewportElement.width()+"px",height:olViewportElement.height()+"px"})),self.draw()},this.map.olMap.on("postrender",this.renderFunction)},WPGMZA.OLModernStoreLocatorCircle.prototype.getContext=function(type){return this.canvas.getContext(type)},WPGMZA.OLModernStoreLocatorCircle.prototype.getCanvasDimensions=function(){return{width:this.canvas.width,height:this.canvas.height}},WPGMZA.OLModernStoreLocatorCircle.prototype.getCenterPixels=function(){return this.map.latLngToPixels(this.settings.center)},WPGMZA.OLModernStoreLocatorCircle.prototype.getWorldOriginOffset=function(){return{x:0,y:0}},WPGMZA.OLModernStoreLocatorCircle.prototype.getTransformedRadius=function(km){var center=new WPGMZA.LatLng(this.settings.center),outer=new WPGMZA.LatLng(center);outer.moveByDistance(km,90);var centerPixels=this.map.latLngToPixels(center),outerPixels=this.map.latLngToPixels(outer);return Math.abs(outerPixels.x-centerPixels.x)},WPGMZA.OLModernStoreLocatorCircle.prototype.getScale=function(){return 1},WPGMZA.OLModernStoreLocatorCircle.prototype.destroy=function(){$(this.canvas).remove(),this.map.olMap.un("postrender",this.renderFunction),this.map=null,this.canvas=null}}),jQuery(function($){WPGMZA.OLModernStoreLocator=function(map_id){WPGMZA.ModernStoreLocator.call(this,map_id),$(WPGMZA.isProVersion()?".wpgmza_map[data-map-id='"+map_id+"']":"#wpgmza_map").append(this.element)},WPGMZA.OLModernStoreLocator.prototype=Object.create(WPGMZA.ModernStoreLocator),WPGMZA.OLModernStoreLocator.prototype.constructor=WPGMZA.OLModernStoreLocator}),jQuery(function($){var Parent;WPGMZA.OLPolygon=function(row,olFeature){if(Parent.call(this,row,olFeature),this.olStyle=new ol.style.Style,olFeature)this.olFeature=olFeature;else{var coordinates=[[]];if(row&&row.points){for(var paths=this.parseGeometry(row.points),i=0;i<paths.length;i++)coordinates[0].push(ol.proj.fromLonLat([parseFloat(paths[i].lng),parseFloat(paths[i].lat)]));this.olStyle=new ol.style.Style(this.getStyleFromSettings())}this.olFeature=new ol.Feature({geometry:new ol.geom.Polygon(coordinates)})}this.layer=new ol.layer.Vector({source:new ol.source.Vector({features:[this.olFeature]}),style:this.olStyle}),this.layer.getSource().getFeatures()[0].setProperties({wpgmzaPolygon:this})},Parent=WPGMZA.isProVersion()?WPGMZA.ProPolygon:WPGMZA.Polygon,WPGMZA.OLPolygon.prototype=Object.create(Parent.prototype),WPGMZA.OLPolygon.prototype.constructor=WPGMZA.OLPolygon,WPGMZA.OLPolygon.prototype.getStyleFromSettings=function(){var params={};return this.settings.strokeOpacity&&(params.stroke=new ol.style.Stroke({color:WPGMZA.hexOpacityToRGBA(this.settings.strokeColor,this.settings.strokeOpacity)})),this.settings.fillOpacity&&(params.fill=new ol.style.Fill({color:WPGMZA.hexOpacityToRGBA(this.settings.fillColor,this.settings.fillOpacity)})),params},WPGMZA.OLPolygon.prototype.updateStyleFromSettings=function(){var params=this.getStyleFromSettings();this.olStyle=new ol.style.Style(params),this.layer.setStyle(this.olStyle)},WPGMZA.OLPolygon.prototype.setEditable=function(editable){},WPGMZA.OLPolygon.prototype.toJSON=function(){var result=Parent.prototype.toJSON.call(this),coordinates=this.olFeature.getGeometry().getCoordinates()[0];result.points=[];for(var i=0;i<coordinates.length;i++){var lonLat=ol.proj.toLonLat(coordinates[i]),latLng={lat:lonLat[1],lng:lonLat[0]};result.points.push(latLng)}return result}}),jQuery(function($){var Parent;WPGMZA.OLPolyline=function(row,olFeature){if(WPGMZA.Polyline.call(this,row),this.olStyle=new ol.style.Style,olFeature)this.olFeature=olFeature;else{var coordinates=[];if(row&&row.points)for(var path=this.parseGeometry(row.points),i=0;i<path.length;i++)coordinates.push(ol.proj.fromLonLat([parseFloat(path[i].lng),parseFloat(path[i].lat)]));var params=this.getStyleFromSettings();this.olStyle=new ol.style.Style(params),this.olFeature=new ol.Feature({geometry:new ol.geom.LineString(coordinates)})}this.layer=new ol.layer.Vector({source:new ol.source.Vector({features:[this.olFeature]}),style:this.olStyle}),this.layer.getSource().getFeatures()[0].setProperties({wpgmzaPolyling:this})},Parent=WPGMZA.Polyline,WPGMZA.OLPolyline.prototype=Object.create(Parent.prototype),WPGMZA.OLPolyline.prototype.constructor=WPGMZA.OLPolyline,WPGMZA.OLPolyline.prototype.getStyleFromSettings=function(){var params={};return this.settings.strokeOpacity&&(params.stroke=new ol.style.Stroke({color:WPGMZA.hexOpacityToRGBA(this.settings.strokeColor,this.settings.strokeOpacity),width:parseInt(this.settings.strokeWeight)})),params},WPGMZA.OLPolyline.prototype.updateStyleFromSettings=function(){var params=this.getStyleFromSettings();this.olStyle=new ol.style.Style(params),this.layer.setStyle(this.olStyle)},WPGMZA.OLPolyline.prototype.setEditable=function(editable){},WPGMZA.OLPolyline.prototype.setPoints=function(points){this.olFeature&&this.layer.getSource().removeFeature(this.olFeature);for(var coordinates=[],i=0;i<points.length;i++)coordinates.push(ol.proj.fromLonLat([parseFloat(points[i].lng),parseFloat(points[i].lat)]));this.olFeature=new ol.Feature({geometry:new ol.geom.LineString(coordinates)}),this.layer.getSource().addFeature(this.olFeature)},WPGMZA.OLPolyline.prototype.toJSON=function(){var result=Parent.prototype.toJSON.call(this),coordinates=this.olFeature.getGeometry().getCoordinates();result.points=[];for(var i=0;i<coordinates.length;i++){var lonLat=ol.proj.toLonLat(coordinates[i]),latLng={lat:lonLat[1],lng:lonLat[0]};result.points.push(latLng)}return result}});
|
readme.txt
CHANGED
@@ -216,6 +216,19 @@ Please upgrade your version of WP Google Maps to version 6.0.27 as it includes m
|
|
216 |
|
217 |
== Changelog ==
|
218 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
= 7.10.34 :- 2018-09-17 :- Low priority =
|
220 |
* Added descriptive error messages when Google API is required but not loaded
|
221 |
* Added "I agree" translation to German files
|
216 |
|
217 |
== Changelog ==
|
218 |
|
219 |
+
= 7.10.36 :- 2018-09-25 :- Medium Priority =
|
220 |
+
* Fixed change in 7.10.35 causing problems with OLMarker click event, preventing infowindow opening
|
221 |
+
* Dropped .gitignore which was causing deployment issues, now using .gitattributes to ignore minified files
|
222 |
+
|
223 |
+
= 7.10.35 :- 2018-09-20 :- Medium priority =
|
224 |
+
* Added links to new API troubleshooting documentation to Google Maps API Error dialog
|
225 |
+
* Fixed marker dispatching click event after drag when using OpenLayers
|
226 |
+
* Fixed map dispatching click event after drag when using OpenLayers
|
227 |
+
* Fixed map editor right click marker appearing multiple times
|
228 |
+
* Fixed map editor right click marker disappearing after map drag
|
229 |
+
* Fixed modern store locator circle crashing some iOS devices by disabling this feature on iOS devices
|
230 |
+
* Fixed gesture handling setting not respected when theme data is set in
|
231 |
+
|
232 |
= 7.10.34 :- 2018-09-17 :- Low priority =
|
233 |
* Added descriptive error messages when Google API is required but not loaded
|
234 |
* Added "I agree" translation to German files
|
wpGoogleMaps.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: WP Google Maps
|
4 |
Plugin URI: https://www.wpgmaps.com
|
5 |
Description: The easiest to use Google Maps plugin! Create custom Google Maps with high quality markers containing locations, descriptions, images and links. Add your customized map to your WordPress posts and/or pages quickly and easily with the supplied shortcode. No fuss.
|
6 |
-
Version: 7.10.
|
7 |
Author: WP Google Maps
|
8 |
Author URI: https://www.wpgmaps.com
|
9 |
Text Domain: wp-google-maps
|
@@ -11,6 +11,10 @@ Domain Path: /languages
|
|
11 |
*/
|
12 |
|
13 |
/*
|
|
|
|
|
|
|
|
|
14 |
* 7.10.35 :- 2018-09-20 :- Medium priority
|
15 |
* Added links to new API troubleshooting documentation to Google Maps API Error dialog
|
16 |
* Fixed marker dispatching click event after drag when using OpenLayers
|
3 |
Plugin Name: WP Google Maps
|
4 |
Plugin URI: https://www.wpgmaps.com
|
5 |
Description: The easiest to use Google Maps plugin! Create custom Google Maps with high quality markers containing locations, descriptions, images and links. Add your customized map to your WordPress posts and/or pages quickly and easily with the supplied shortcode. No fuss.
|
6 |
+
Version: 7.10.36
|
7 |
Author: WP Google Maps
|
8 |
Author URI: https://www.wpgmaps.com
|
9 |
Text Domain: wp-google-maps
|
11 |
*/
|
12 |
|
13 |
/*
|
14 |
+
* 7.10.36 :- 2018-09-25 :- Medium Priority
|
15 |
+
* Fixed change in 7.10.35 causing problems with OLMarker click event, preventing infowindow opening
|
16 |
+
* Dropped .gitignore which was causing deployment issues, now using .gitattributes to ignore minified files
|
17 |
+
*
|
18 |
* 7.10.35 :- 2018-09-20 :- Medium priority
|
19 |
* Added links to new API troubleshooting documentation to Google Maps API Error dialog
|
20 |
* Fixed marker dispatching click event after drag when using OpenLayers
|