@bmlt-enabled/croutonjs 3.19.1 → 3.19.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/crouton-core.js +46 -29
- package/crouton-core.min.js +1 -1
- package/crouton-gmaps.js +83 -45
- package/crouton-gmaps.min.js +1 -1
- package/crouton-map.js +37 -16
- package/crouton-map.min.js +1 -1
- package/crouton-nocore.js +10 -10
- package/crouton-nocore.min.js +1 -1
- package/crouton.css +13 -0
- package/crouton.js +83 -45
- package/crouton.min.css +1 -1
- package/crouton.min.js +1 -1
- package/crouton.nojquery.js +83 -45
- package/crouton.nojquery.min.js +1 -1
- package/package.json +1 -1
package/crouton-map.js
CHANGED
|
@@ -21,6 +21,27 @@ function MeetingMap(inConfig) {
|
|
|
21
21
|
function apiLoadedCallback() {
|
|
22
22
|
loadedCallbackFunction(...loadedCallbackArgs);
|
|
23
23
|
}
|
|
24
|
+
|
|
25
|
+
function retrieveGeolocation() {
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
if (window.storedGeolocation) {
|
|
28
|
+
resolve(window.storedGeolocation);
|
|
29
|
+
} else if (navigator.geolocation) {
|
|
30
|
+
navigator.geolocation.getCurrentPosition((position) => {
|
|
31
|
+
window.storedGeolocation = {
|
|
32
|
+
latitude: position.coords.latitude,
|
|
33
|
+
longitude: position.coords.longitude
|
|
34
|
+
};
|
|
35
|
+
resolve(window.storedGeolocation);
|
|
36
|
+
}, (error) => {
|
|
37
|
+
reject(new Error('Error getting geolocation: ' + error.message));
|
|
38
|
+
});
|
|
39
|
+
} else {
|
|
40
|
+
reject(new Error('Geolocation is not supported by this browser.'));
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
24
45
|
/************************************************************************************//**
|
|
25
46
|
* \brief Load the map and set it up. *
|
|
26
47
|
****************************************************************************************/
|
|
@@ -126,14 +147,15 @@ function MeetingMap(inConfig) {
|
|
|
126
147
|
var controlDiv = document.createElement('div');
|
|
127
148
|
controlDiv.innerHTML = template(menuContext);
|
|
128
149
|
controlDiv.querySelector("#nearbyMeetings").addEventListener('click', function (e) {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
});
|
|
134
|
-
}
|
|
150
|
+
retrieveGeolocation().then(position => {
|
|
151
|
+
gDelegate.setViewToPosition(position, filterMeetingsAndBounds);
|
|
152
|
+
}).catch(error => {
|
|
153
|
+
console.error(error.message);
|
|
154
|
+
$('.geo').removeClass("hide").addClass("show").html(`<p>${error.message}</p>`);
|
|
155
|
+
});
|
|
135
156
|
dropdownContent = document.getElementById("map-menu-dropdown").style.display = "none";
|
|
136
157
|
});
|
|
158
|
+
|
|
137
159
|
controlDiv.querySelector("#lookupLocation").addEventListener('click', showGeocodingDialog);
|
|
138
160
|
controlDiv.querySelector("#filterMeetings").addEventListener('click', showFilterDialog);
|
|
139
161
|
controlDiv.querySelector("#showAsTable").addEventListener('click', showListView);
|
|
@@ -193,17 +215,15 @@ function MeetingMap(inConfig) {
|
|
|
193
215
|
searchResponseCallback(fitDuringFilter);
|
|
194
216
|
};
|
|
195
217
|
function nearMeSearch() {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
)
|
|
204
|
-
}
|
|
218
|
+
retrieveGeolocation().then(position => {
|
|
219
|
+
showThrobber();
|
|
220
|
+
crouton.searchByCoordinates(position.latitude, position.longitude, config.map_search.width);
|
|
221
|
+
}).catch(error => {
|
|
222
|
+
console.error(error.message);
|
|
223
|
+
});
|
|
224
|
+
showBmltSearchDialog();
|
|
205
225
|
closeModalWindow(gSearchModal);
|
|
206
|
-
}
|
|
226
|
+
};
|
|
207
227
|
function clickSearch(e) {
|
|
208
228
|
gDelegate.clickSearch(e, function(lat,lng) {
|
|
209
229
|
showThrobber();
|
|
@@ -651,6 +671,7 @@ MeetingMap.prototype.refreshMeetings = null;
|
|
|
651
671
|
MeetingMap.prototype.openModalWindow = null;
|
|
652
672
|
MeetingMap.prototype.closeModalWindow = null;
|
|
653
673
|
MeetingMap.prototype.loadPopupMap = null;
|
|
674
|
+
|
|
654
675
|
function MapDelegate(config) {
|
|
655
676
|
var g_icon_image_single = L.icon({
|
|
656
677
|
iconUrl: config.BMLTPlugin_images+"/NAMarker.png",
|