@bmlt-enabled/croutonjs 4.1.2 → 4.1.4

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.
@@ -15280,7 +15280,7 @@ function Crouton(config) {
15280
15280
  self.currentView = "weekday";
15281
15281
  self.distanceTabAllowed = false;
15282
15282
  self.config = {
15283
- version: '4.1.2', // CroutonJS version for debugging
15283
+ version: '4.1.4', // CroutonJS version for debugging
15284
15284
  on_complete: null, // Javascript function to callback when data querying is completed.
15285
15285
  root_server: null, // The root server to use.
15286
15286
  placeholder_id: "bmlt-tabs", // The DOM id that will be used for rendering
@@ -16097,8 +16097,12 @@ function Crouton(config) {
16097
16097
  });
16098
16098
  }
16099
16099
  const sorted = parent.children().sort(function (a, b) {
16100
- const distanceA =parseFloat( jQuery(a).data('distance'));
16101
- const distanceB =parseFloat( jQuery(b).data('distance'));
16100
+ const idA =parseFloat( jQuery(a).data('meetingid').replace("meeting-data-row-", ""));
16101
+ const idB =parseFloat( jQuery(b).data('meetingid').replace("meeting-data-row-", ""));
16102
+ const dataA = self.meetingData.find((m) => m.id_bigint==idA);
16103
+ const dataB = self.meetingData.find((m) => m.id_bigint==idB);
16104
+ const distanceA = dataA ? parseFloat(dataA['distance_in_km']) : Number.POSITIVE_INFINITY;
16105
+ const distanceB = dataB ? parseFloat(dataB['distance_in_km']) : Number.POSITIVE_INFINITY;
16102
16106
  return (distanceA < distanceB) ? -1 : (distanceA > distanceB) ? 1 : 0;
16103
16107
  });
16104
16108
  parent.html(sorted);
@@ -17186,7 +17190,9 @@ function MeetingMap(inConfig) {
17186
17190
  }
17187
17191
  });
17188
17192
  }
17189
-
17193
+ function isFilterVisible() {
17194
+ return config.filter_visible && config.filter_visible == 1;
17195
+ }
17190
17196
  /************************************************************************************//**
17191
17197
  * \brief Load the map and set it up. *
17192
17198
  ****************************************************************************************/
@@ -17213,7 +17219,7 @@ function MeetingMap(inConfig) {
17213
17219
  if (handlebarMapOptions) loc = {latitude: handlebarMapOptions.lat, longitude: handlebarMapOptions.lng};
17214
17220
  if (gDelegate.createMap(inDiv, loc, hide)) {
17215
17221
  // crouton_map and filter_visible triggers a query, Otherwise, redraw markers
17216
- if (config.map_search && config.filter_visible) {
17222
+ if (config.map_search && isFilterVisible()) {
17217
17223
  gDelegate.addListener('idle', triggerCroutonMapNewQuery, false);
17218
17224
  } else {
17219
17225
  gDelegate.addListener('zoomend', function (ev) {
@@ -17511,7 +17517,7 @@ function MeetingMap(inConfig) {
17511
17517
  let lat_lngs = gAllMeetings.reduce(function(a,m) {a.push([m.latitude, m.longitude]); return a;},[]);
17512
17518
  const maxRadius = config.maxTomatoWidth/2.0;
17513
17519
  if (gSearchPoint) lat_lngs.push([gSearchPoint.lat, gSearchPoint.lng]);
17514
- if (config.map_search && config.filter_visible) {
17520
+ if (config.map_search && isFilterVisible()) {
17515
17521
  lat_lngs.sort((a,b) => getDistance({"lat":a[0],"lng":a[1]},gSearchPoint) - getDistance({"lat":b[0],"lng":b[1]},gSearchPoint));
17516
17522
  while (getLatLngRadius(lat_lngs) > maxRadius && lat_lngs.length > 3) {
17517
17523
  lat_lngs = lat_lngs.slice(0, lat_lngs.length/2);
@@ -17523,7 +17529,7 @@ function MeetingMap(inConfig) {
17523
17529
  }
17524
17530
  searchResponseCallback();
17525
17531
  hideThrobber();
17526
- if (config.filter_visible || config.centerMe || config.goto) crouton.forceShowMap();
17532
+ if (isFilterVisible() || config.centerMe || config.goto) crouton.forceShowMap();
17527
17533
  if (config.centerMe) {
17528
17534
  if (navigator.geolocation) {
17529
17535
  navigator.geolocation.getCurrentPosition(
@@ -17532,7 +17538,7 @@ function MeetingMap(inConfig) {
17532
17538
  filterVisible(false);
17533
17539
  if (config.zoom) gDelegate.setZoom(false, config.zoom);
17534
17540
  gDelegate.setViewToPosition(coords, filterMeetingsAndBounds, () => {
17535
- filterVisible(config.filter_visible == 1);
17541
+ filterVisible(isFilterVisible());
17536
17542
  });
17537
17543
  gSearchPoint = {"lat": position.coords.latitude, "lng": position.coords.longitude};
17538
17544
  crouton.updateDistances();
@@ -17543,10 +17549,10 @@ function MeetingMap(inConfig) {
17543
17549
  showGeocodingDialog();
17544
17550
  }
17545
17551
  } else {
17546
- if ((!config.centerMe && !config.goto) && !(config.map_search && config.filter_visible)) {
17547
- gDelegate.afterInit(()=>filterVisible(config.filter_visible));
17552
+ if ((!config.centerMe && !config.goto) && !(config.map_search && isFilterVisible())) {
17553
+ gDelegate.afterInit(()=>filterVisible(isFilterVisible()));
17548
17554
  }
17549
- if (config.goto) gDelegate.callGeocoder(config.goto, config.filter_visible == 1 ? resetVisibleThenFilterMeetingsAndBounds : setVisibleThenFilterMeetingsAndBounds);
17555
+ if (config.goto) gDelegate.callGeocoder(config.goto, isFilterVisible() ? resetVisibleThenFilterMeetingsAndBounds : setVisibleThenFilterMeetingsAndBounds);
17550
17556
  }
17551
17557
  }
17552
17558
  function createCityHash(allMeetings) {
@@ -17855,7 +17861,7 @@ function MeetingMap(inConfig) {
17855
17861
  function onDragEnd() {
17856
17862
  isMouseDown = false;
17857
17863
  // if no [crouton_map], then turn filter visible back on.
17858
- if (config.map_search && config.filter_visible) triggerCroutonMapNewQuery(null);
17864
+ if (config.map_search && isFilterVisible()) triggerCroutonMapNewQuery(null);
17859
17865
  else filterVisible(true);
17860
17866
  }
17861
17867
  function triggerCroutonMapNewQuery(ev) {