@bmlt-enabled/croutonjs 3.20.12 → 3.21.1
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.css +3 -0
- package/crouton-core.js +189 -205
- package/crouton-core.min.css +1 -1
- package/crouton-core.min.js +1 -1
- package/crouton-gmaps.js +277 -218
- package/crouton-gmaps.min.js +1 -1
- package/crouton-map.js +86 -13
- package/crouton-map.min.js +1 -1
- package/crouton-nocore.js +83 -79
- package/crouton-nocore.min.js +1 -1
- package/crouton.css +23 -1
- package/crouton.js +275 -218
- package/crouton.min.css +1 -1
- package/crouton.min.js +1 -1
- package/crouton.nojquery.js +275 -218
- package/crouton.nojquery.min.js +1 -1
- package/package.json +1 -1
package/crouton-map.js
CHANGED
|
@@ -46,7 +46,7 @@ function MeetingMap(inConfig) {
|
|
|
46
46
|
* \brief Load the map and set it up. *
|
|
47
47
|
****************************************************************************************/
|
|
48
48
|
|
|
49
|
-
function loadMap(inDiv, menuContext, handlebarMapOptions=null,cb=null) {
|
|
49
|
+
function loadMap(inDiv, menuContext, handlebarMapOptions=null,cb=null,hide=false) {
|
|
50
50
|
if (inDiv) {
|
|
51
51
|
crouton_Handlebars.registerPartial("markerContentsTemplate", config['marker_contents_template']);
|
|
52
52
|
gInDiv = inDiv;
|
|
@@ -66,7 +66,7 @@ function MeetingMap(inConfig) {
|
|
|
66
66
|
}
|
|
67
67
|
let loc = {latitude: config.lat, longitude: config.lng, zoom: config.zoom};
|
|
68
68
|
if (handlebarMapOptions) loc = {latitude: handlebarMapOptions.lat, longitude: handlebarMapOptions.lng};
|
|
69
|
-
if (gDelegate.createMap(inDiv, loc)) {
|
|
69
|
+
if (gDelegate.createMap(inDiv, loc, hide)) {
|
|
70
70
|
gDelegate.addListener('zoomend', function (ev) {
|
|
71
71
|
if (shouldRedrawMarkers() && gAllMeetings) {
|
|
72
72
|
if (listOnlyVisible) {
|
|
@@ -92,12 +92,19 @@ function MeetingMap(inConfig) {
|
|
|
92
92
|
};
|
|
93
93
|
};
|
|
94
94
|
var gSearchModal;
|
|
95
|
-
function createSearchButton(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
95
|
+
function createSearchButton() {
|
|
96
|
+
const template = hbs_Crouton.templates['mapSearch'];
|
|
97
|
+
const controlDiv = document.createElement('div');
|
|
98
|
+
const params = {'hasClickSearch': gDelegate.hasClickSearch()}
|
|
99
|
+
controlDiv.innerHTML = template(params);
|
|
99
100
|
controlDiv.querySelector("#map-search-button").addEventListener('click', showBmltSearchDialog);
|
|
100
101
|
controlDiv.querySelector("#bmltsearch-nearbyMeetings").addEventListener('click', nearMeSearch);
|
|
102
|
+
controlDiv.querySelector("#bmltsearch-goto-text").addEventListener('keypress', function (event) {
|
|
103
|
+
if (event.key === "Enter") {
|
|
104
|
+
event.preventDefault();
|
|
105
|
+
document.getElementById("bmltsearch-text-button").click();
|
|
106
|
+
}
|
|
107
|
+
});
|
|
101
108
|
controlDiv.querySelector("#bmltsearch-text-button").addEventListener('click', function () {
|
|
102
109
|
let text = document.getElementById("bmltsearch-goto-text").value.trim();
|
|
103
110
|
if (text === "") return;
|
|
@@ -105,7 +112,35 @@ function MeetingMap(inConfig) {
|
|
|
105
112
|
gDelegate.callGeocoder(text, null, mapSearchGeocode);
|
|
106
113
|
closeModalWindow(gSearchModal);
|
|
107
114
|
});
|
|
108
|
-
controlDiv.querySelector("#
|
|
115
|
+
controlDiv.querySelector("#modal-seach-parameters").style.display = 'none';
|
|
116
|
+
controlDiv.querySelector("#show-search-parameters").addEventListener('click', function (e) {
|
|
117
|
+
const controlDiv = e.target.parentElement.parentElement;
|
|
118
|
+
let w = config.map_search.width;
|
|
119
|
+
let checked = '#search_radius';
|
|
120
|
+
if (w < 0) {
|
|
121
|
+
w = -w;
|
|
122
|
+
checked = '#search_count';
|
|
123
|
+
}
|
|
124
|
+
controlDiv.querySelector(checked).checked = true;
|
|
125
|
+
controlDiv.querySelector('#search_parameter').value = w;
|
|
126
|
+
controlDiv.querySelector("#modal-seach-parameters").style.display = 'block';
|
|
127
|
+
controlDiv.querySelector("#modal-search-page").style.display = 'none';
|
|
128
|
+
controlDiv.querySelector("#search_radius_label").innerHTML = crouton.localization.getWord('Radius of search in $$').replace('$$', crouton.config.distance_units);
|
|
129
|
+
});
|
|
130
|
+
controlDiv.querySelector("#show-search-page").addEventListener('click', function (e) {
|
|
131
|
+
const controlDiv = e.target.parentElement.parentElement;
|
|
132
|
+
let w = controlDiv.querySelector('#search_parameter').value;
|
|
133
|
+
if (controlDiv.querySelector('#search_count')) {
|
|
134
|
+
w = -Math.round(w);
|
|
135
|
+
if (w == 0) w = -1;
|
|
136
|
+
}
|
|
137
|
+
config.map_search.width = w;
|
|
138
|
+
controlDiv.querySelector("#modal-seach-parameters").style.display = 'none';
|
|
139
|
+
controlDiv.querySelector("#modal-search-page").style.display = 'block';
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
if (gDelegate.hasClickSearch()) controlDiv.querySelector("#bmltsearch-clicksearch").addEventListener('click', clickSearch);
|
|
109
144
|
[...controlDiv.getElementsByClassName('modal-close')].forEach((elem)=>elem.addEventListener('click', (e)=>closeModalWindow(e.target)));
|
|
110
145
|
gSearchModal = controlDiv.querySelector("#bmltsearch_modal");
|
|
111
146
|
gSearchModal.parentElement.removeChild(gSearchModal);
|
|
@@ -200,14 +235,14 @@ function MeetingMap(inConfig) {
|
|
|
200
235
|
function hasMapSearch() {
|
|
201
236
|
return 'map_search' in config;
|
|
202
237
|
}
|
|
203
|
-
function loadFromCrouton(inDiv_id, meetings_responseObject, menuContext = null, handlebarMapOptions = null, fitBounds = true, callback) {
|
|
238
|
+
function loadFromCrouton(inDiv_id, meetings_responseObject, menuContext = null, handlebarMapOptions = null, fitBounds = true, callback, hide) {
|
|
204
239
|
if (!gDelegate.isApiLoaded()) {
|
|
205
|
-
preloadApiLoadedCallback(loadFromCrouton, [inDiv_id, meetings_responseObject, menuContext, handlebarMapOptions, fitBounds, callback]);
|
|
240
|
+
preloadApiLoadedCallback(loadFromCrouton, [inDiv_id, meetings_responseObject, menuContext, handlebarMapOptions, fitBounds, callback, hide]);
|
|
206
241
|
gDelegate.loadApi();
|
|
207
242
|
return;
|
|
208
243
|
}
|
|
209
244
|
let inDiv = document.getElementById(inDiv_id);
|
|
210
|
-
loadMap(inDiv, menuContext, handlebarMapOptions,callback);
|
|
245
|
+
loadMap(inDiv, menuContext, handlebarMapOptions, callback, hide);
|
|
211
246
|
loadAllMeetings(meetings_responseObject, fitBounds, true);
|
|
212
247
|
};
|
|
213
248
|
function loadPopupMap(inDiv_id, meeting, handlebarMapOptions = null) {
|
|
@@ -282,10 +317,14 @@ function MeetingMap(inConfig) {
|
|
|
282
317
|
};
|
|
283
318
|
};
|
|
284
319
|
function mapSearchGeocode(resp) {
|
|
285
|
-
|
|
320
|
+
showThrobber();
|
|
286
321
|
if (document.getElementById("bmltsearch-goto-text"))
|
|
287
322
|
document.getElementById("bmltsearch-goto-text").value = "";
|
|
288
|
-
|
|
323
|
+
let latlng = gDelegate.getGeocodeCenter(resp);
|
|
324
|
+
if (!latlng) {
|
|
325
|
+
hideThrobber();
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
289
328
|
crouton.searchByCoordinates(latlng.lat, latlng.lng, config.map_search.width);
|
|
290
329
|
}
|
|
291
330
|
function loadAllMeetings(meetings_responseObject, fitBounds=true, fitAll=false) {
|
|
@@ -471,6 +510,7 @@ function MeetingMap(inConfig) {
|
|
|
471
510
|
return false;
|
|
472
511
|
}
|
|
473
512
|
function drawMarkers(expand = false) {
|
|
513
|
+
if (!gDelegate.hasClickSearch()) return;
|
|
474
514
|
gDelegate.clearAllMarkers();
|
|
475
515
|
gDelegate.removeClusterLayer();
|
|
476
516
|
// This calculates which markers are the red "multi" markers.
|
|
@@ -773,8 +813,15 @@ function MapDelegate(config) {
|
|
|
773
813
|
var gMainMap;
|
|
774
814
|
var gTileLayer;
|
|
775
815
|
var gClusterLayer = null;
|
|
776
|
-
function createMap(inDiv, inCenter) {
|
|
816
|
+
function createMap(inDiv, inCenter, inHidden = false) {
|
|
777
817
|
if (! inCenter ) return null;
|
|
818
|
+
if ( inHidden ) {
|
|
819
|
+
gDiv = inDiv;
|
|
820
|
+
gDiv.style.height = 'auto';
|
|
821
|
+
gDiv.style.marginBottom = '10px';
|
|
822
|
+
gMainMap = null;
|
|
823
|
+
return gDiv;
|
|
824
|
+
}
|
|
778
825
|
myOptions = {
|
|
779
826
|
'minZoom': config.minZoom,
|
|
780
827
|
'maxZoom': config.maxZoom,
|
|
@@ -804,6 +851,7 @@ function MapDelegate(config) {
|
|
|
804
851
|
return gMainMap;
|
|
805
852
|
}
|
|
806
853
|
function addListener(ev,f,once) {
|
|
854
|
+
if (!gMainMap) return;
|
|
807
855
|
if (ev=='idle') {
|
|
808
856
|
ev = 'moveend';
|
|
809
857
|
}
|
|
@@ -821,9 +869,11 @@ function MapDelegate(config) {
|
|
|
821
869
|
return {'event': ev, 'f': f};
|
|
822
870
|
}
|
|
823
871
|
function removeListener(o) {
|
|
872
|
+
if (!gMainMap) return;
|
|
824
873
|
gMainMap.off(o.event, o.f);
|
|
825
874
|
}
|
|
826
875
|
function setViewToPosition(position, filterMeetings, extra=null) {
|
|
876
|
+
if (!gMainMap) return;
|
|
827
877
|
var latlng = L.latLng(position.latitude, position.longitude);
|
|
828
878
|
gMainMap.flyTo(latlng);
|
|
829
879
|
gMainMap.once('moveend', function(ev) {
|
|
@@ -845,10 +895,12 @@ function MapDelegate(config) {
|
|
|
845
895
|
}
|
|
846
896
|
function clearAllMarkers ( )
|
|
847
897
|
{
|
|
898
|
+
if (!gMainMap) return;
|
|
848
899
|
gAllMarkers && gAllMarkers.forEach((m) => {m.marker.closePopup(); gMainMap.removeLayer(m.marker)});
|
|
849
900
|
gAllMarkers = [];
|
|
850
901
|
};
|
|
851
902
|
function getZoom() {
|
|
903
|
+
if (!gMainMap) return null;
|
|
852
904
|
return gMainMap.getZoom();
|
|
853
905
|
}
|
|
854
906
|
function getZoomAdjust(only_out,filterMeetings) {
|
|
@@ -891,12 +943,15 @@ function MapDelegate(config) {
|
|
|
891
943
|
return ret;
|
|
892
944
|
}
|
|
893
945
|
function setZoom(filterMeetings, force=0) {
|
|
946
|
+
if (!gMainMap) return;
|
|
894
947
|
(force > 0) ? gMainMap.setZoom(force) : gMainMap.setZoom(getZoomAdjust(false,filterMeetings));
|
|
895
948
|
}
|
|
896
949
|
function zoomOut(filterMeetings) {
|
|
950
|
+
if (!gMainMap) return;
|
|
897
951
|
gMainMap.setZoom(getZoomAdjust(true,filterMeetings));
|
|
898
952
|
}
|
|
899
953
|
function fromLatLngToPoint(lat, lng) {
|
|
954
|
+
if (!gMainMap) return null;
|
|
900
955
|
return gMainMap.latLngToLayerPoint(L.latLng(lat,lng));
|
|
901
956
|
}
|
|
902
957
|
function createMarker ( inCoords, ///< The long/lat for the marker.
|
|
@@ -906,6 +961,7 @@ function MapDelegate(config) {
|
|
|
906
961
|
in_ids
|
|
907
962
|
)
|
|
908
963
|
{
|
|
964
|
+
if (!gMainMap) return;
|
|
909
965
|
var in_main_icon = (multi ? g_icon_image_multi : g_icon_image_single);
|
|
910
966
|
|
|
911
967
|
let highlightRow = function(target) {
|
|
@@ -937,6 +993,7 @@ function MapDelegate(config) {
|
|
|
937
993
|
gAllMarkers.push( {ids: in_ids, marker: marker} );
|
|
938
994
|
}
|
|
939
995
|
function openMarker(id) {
|
|
996
|
+
if (!gMainMap) return;
|
|
940
997
|
marker = gAllMarkers.find((m) => m.ids.includes(id));
|
|
941
998
|
if (marker) {
|
|
942
999
|
marker.marker.openPopup();
|
|
@@ -947,6 +1004,10 @@ function openMarker(id) {
|
|
|
947
1004
|
jQuery("#meeting-data-row-" + id + " > td").addClass("rowHighlight");
|
|
948
1005
|
}
|
|
949
1006
|
function addControl(div,pos,cb) {
|
|
1007
|
+
if (!gMainMap) {
|
|
1008
|
+
gDiv.appendChild(div);
|
|
1009
|
+
return;
|
|
1010
|
+
}
|
|
950
1011
|
var ControlClass = L.Control.extend({
|
|
951
1012
|
onAdd: function (map) {
|
|
952
1013
|
return div;
|
|
@@ -1090,25 +1151,32 @@ function addControl(div,pos,cb) {
|
|
|
1090
1151
|
geocode(in_loc, geoCodeParams, callback, filterMeetings);
|
|
1091
1152
|
}
|
|
1092
1153
|
function contains(bounds, lat, lng) {
|
|
1154
|
+
if (!gMainMap) return true;
|
|
1093
1155
|
return bounds.contains(L.latLng ( lat, lng ));
|
|
1094
1156
|
}
|
|
1095
1157
|
function getBounds() {
|
|
1158
|
+
if (!gMainMap) return null;
|
|
1096
1159
|
return gMainMap.getBounds();
|
|
1097
1160
|
}
|
|
1098
1161
|
function invalidateSize() {
|
|
1162
|
+
if (!gMainMap) return;
|
|
1099
1163
|
gMainMap.invalidateSize();
|
|
1100
1164
|
}
|
|
1101
1165
|
function fitBounds(locations) {
|
|
1166
|
+
if (!gMainMap) return;
|
|
1102
1167
|
const bounds = locations.reduce(function(b,lat_lng) {b.extend(lat_lng); return b;}, L.latLngBounds());
|
|
1103
1168
|
gMainMap.fitBounds(bounds);
|
|
1104
1169
|
}
|
|
1105
1170
|
function createClusterLayer() {
|
|
1171
|
+
if (!gMainMap) return;
|
|
1106
1172
|
gClusterLayer = L.markerClusterGroup();
|
|
1107
1173
|
}
|
|
1108
1174
|
function addClusterLayer() {
|
|
1175
|
+
if (!gMainMap) return;
|
|
1109
1176
|
gClusterLayer && gMainMap.addLayer(gClusterLayer);
|
|
1110
1177
|
}
|
|
1111
1178
|
function removeClusterLayer() {
|
|
1179
|
+
if (!gMainMap) return;
|
|
1112
1180
|
gClusterLayer && gMainMap.removeLayer(gClusterLayer);
|
|
1113
1181
|
gClusterLayer = null;
|
|
1114
1182
|
}
|
|
@@ -1131,6 +1199,9 @@ function addControl(div,pos,cb) {
|
|
|
1131
1199
|
f();
|
|
1132
1200
|
}
|
|
1133
1201
|
function returnTrue() {return true;}
|
|
1202
|
+
function hasClickSearch() {
|
|
1203
|
+
return gMainMap != null;
|
|
1204
|
+
}
|
|
1134
1205
|
this.createMap = createMap;
|
|
1135
1206
|
this.addListener = addListener;
|
|
1136
1207
|
this.removeListener = removeListener;
|
|
@@ -1157,6 +1228,7 @@ function addControl(div,pos,cb) {
|
|
|
1157
1228
|
this.modalOn = modalOn;
|
|
1158
1229
|
this.modalOff = modalOff;
|
|
1159
1230
|
this.afterInit = afterInit;
|
|
1231
|
+
this.hasClickSearch = hasClickSearch;
|
|
1160
1232
|
}
|
|
1161
1233
|
MapDelegate.prototype.createMap = null;
|
|
1162
1234
|
MapDelegate.prototype.addListener = null;
|
|
@@ -1184,6 +1256,7 @@ MapDelegate.prototype.getGeocodeCenter = null;
|
|
|
1184
1256
|
MapDelegate.prototype.modalOn = null;
|
|
1185
1257
|
MapDelegate.prototype.modalOff = null;
|
|
1186
1258
|
MapDelegate.prototype.afterInit = null;
|
|
1259
|
+
MapDelegate.prototype.hasClickSearch = null;
|
|
1187
1260
|
|
|
1188
1261
|
/* @preserve
|
|
1189
1262
|
* Leaflet 1.5.1+Detached: 2e3e0ffbe87f246eb76d86d2633ddd59b262830b.2e3e0ff, a JS library for interactive maps. http://leafletjs.com
|