@bmlt-enabled/croutonjs 4.3.2 → 4.3.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.
@@ -12979,7 +12979,7 @@ function CroutonHandlebarsExtensions() {
12979
12979
  crouton_Handlebars.registerPartial('header', hbs_Crouton.templates['header']);
12980
12980
  crouton_Handlebars.registerPartial('byfields', hbs_Crouton.templates['byfield']);
12981
12981
  crouton_Handlebars.registerPartial('formatPopup', hbs_Crouton.templates['formatPopup']);
12982
- crouton_Handlebars.registerPartial('meetingModal', "<a tabindex='0' href='#' onclick='crouton.meetingModal({{this.id_bigint}})'><span class='glyphicon glyphicon-search' aria-hidden='true'></span>{{this.meeting_name}}</a>");
12982
+ crouton_Handlebars.registerPartial('meetingModal', "<a tabindex='0' onclick='crouton.meetingModal({{this.id_bigint}})'><span class='glyphicon glyphicon-search' aria-hidden='true'></span>{{this.meeting_name}}</a>");
12983
12983
  crouton_Handlebars.registerPartial('meetingLink', `
12984
12984
  {{#if this.meeting_details_url}}
12985
12985
  <a href='{{{this.meeting_details_url}}}'><span class='glyphicon glyphicon-search' aria-hidden='true'></span>{{this.meeting_name}}</a>
@@ -13385,7 +13385,7 @@ this["hbs_Crouton"]["templates"]["group3ColumnRow"] = Handlebars.template({"0":f
13385
13385
 
13386
13386
  return "<td class=\"bmlt-column1\" "
13387
13387
  + ((stack1 = (lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"css-textAlign",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":54}}})) != null ? stack1 : "")
13388
- + ">\n <div class='meeting-name'>\n <a tabindex='0' href='#' onclick='crouton.meetingModal("
13388
+ + ">\n <div class='meeting-name'>\n <a tabindex='0' onclick='crouton.meetingModal("
13389
13389
  + alias4(alias3((depth0 != null ? lookupProperty(depth0,"id_bigint") : depth0), depth0))
13390
13390
  + ")'><span class='glyphicon glyphicon-search' aria-hidden='true'></span>"
13391
13391
  + alias4(alias3((depth0 != null ? lookupProperty(depth0,"meeting_name") : depth0), depth0))
@@ -13619,10 +13619,10 @@ this["hbs_Crouton"]["templates"]["header"] = Handlebars.template({"0":function(c
13619
13619
  return undefined
13620
13620
  };
13621
13621
 
13622
- return " <li><a href=\"#tab"
13622
+ return " <li><a href=\"./#tab"
13623
13623
  + alias1(container.lambda(depth0, depth0))
13624
13624
  + "\" data-toggle=\"tab\">"
13625
- + alias1((lookupProperty(helpers,"getDayOfTheWeek")||(depth0 && lookupProperty(depth0,"getDayOfTheWeek"))||container.hooks.helperMissing).call(depth0 != null ? depth0 : (container.nullContext || {}),depth0,{"name":"getDayOfTheWeek","hash":{},"data":data,"loc":{"start":{"line":38,"column":61},"end":{"line":38,"column":85}}}))
13625
+ + alias1((lookupProperty(helpers,"getDayOfTheWeek")||(depth0 && lookupProperty(depth0,"getDayOfTheWeek"))||container.hooks.helperMissing).call(depth0 != null ? depth0 : (container.nullContext || {}),depth0,{"name":"getDayOfTheWeek","hash":{},"data":data,"loc":{"start":{"line":38,"column":63},"end":{"line":38,"column":87}}}))
13626
13626
  + "</a></li>\n";
13627
13627
  },"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data,blockParams,depths) {
13628
13628
  var stack1, alias1=depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty = container.lookupProperty || function(parent, propertyName) {
@@ -14089,7 +14089,7 @@ this["hbs_Crouton"]["templates"]["meetingDetailsButton"] = Handlebars.template({
14089
14089
 
14090
14090
  return " <div>\n <a onclick='crouton.meetingModal("
14091
14091
  + alias1(container.lambda((depth0 != null ? lookupProperty(depth0,"id_bigint") : depth0), depth0))
14092
- + ")' tabindex='0' href='#' class='map-button btn btn-primary btn-xs'>\n <span class='glyphicon glyphicon-search' aria-hidden='true'></span>\n "
14092
+ + ")' tabindex='0' class='map-button btn btn-primary btn-xs'>\n <span class='glyphicon glyphicon-search' aria-hidden='true'></span>\n "
14093
14093
  + alias1((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||container.hooks.helperMissing).call(depth0 != null ? depth0 : (container.nullContext || {}),"meeting details",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":4,"column":5},"end":{"line":4,"column":34}}}))
14094
14094
  + "\n </a>\n </div>\n";
14095
14095
  },"useData":true});
@@ -15465,7 +15465,7 @@ function Crouton(config) {
15465
15465
  self.distanceTabAllowed = false;
15466
15466
  self.favoritesOn = false;
15467
15467
  self.config = {
15468
- version: '4.3.2', // CroutonJS version for debugging
15468
+ version: '4.3.4', // CroutonJS version for debugging
15469
15469
  on_complete: null, // Javascript function to callback when data querying is completed.
15470
15470
  root_server: null, // The root server to use.
15471
15471
  placeholder_id: "bmlt-tabs", // The DOM id that will be used for rendering
@@ -15723,7 +15723,7 @@ function Crouton(config) {
15723
15723
  self.dayTabFromId = function(id) {
15724
15724
  const day_id = self.meetingData.find((m)=>m.id_bigint == id).weekday_tinyint;
15725
15725
  self.hideAllPages();
15726
- jQuery('.nav-tabs a[href="#tab' + day_id + '"]').tab('show');
15726
+ jQuery('.nav-tabs a[href="./#tab' + day_id + '"]').tab('show');
15727
15727
  jQuery("#" + day_id).removeClass("hide").addClass("show");
15728
15728
  };
15729
15729
  /**
@@ -17056,7 +17056,7 @@ Crouton.prototype.render = function(doMeetingMap = false, fitBounds=true) {
17056
17056
  const d = new Date();
17057
17057
  let n = d.getDay();
17058
17058
  n++;
17059
- jQuery('.nav-tabs a[href="#tab' + n + '"]').tab('show');
17059
+ jQuery('.nav-tabs a[href="./#tab' + n + '"]').tab('show');
17060
17060
  jQuery('#tab' + n).show();
17061
17061
  }
17062
17062
 
@@ -17744,7 +17744,7 @@ function MeetingMap(inConfig) {
17744
17744
  filterVisible(false);
17745
17745
  gSearchPoint = {"lat": position.lat, "lng": position.lng};
17746
17746
  crouton.updateDistances();
17747
- const locationSearchResult = gDelegate.getZoomAdjustedBounds(gSearchPoint, filterMeetingsAndBounds, config.locationSearchZoom ?? 12);
17747
+ const locationSearchResult = gDelegate.getZoomAdjustedBounds(gSearchPoint, filterMeetingsAndBounds, config.locationSearchZoom ?? 12, findClosestMeetingLatLng(gSearchPoint));
17748
17748
  gDelegate.flyToFixedZoom(position, locationSearchResult.zoom, filterVisible);
17749
17749
  filterVisible(true);
17750
17750
  setLocationSearchButtonLabel(crouton.localization.getWord('closest meetings'));
@@ -17908,7 +17908,7 @@ function MeetingMap(inConfig) {
17908
17908
  const centerAndBounds = gDelegate.getGeocodeCenterAndBounds(resp, i);
17909
17909
  if (!centerAndBounds) return;
17910
17910
  const zoom = calcZoomThatContainsBoundingBox(centerAndBounds);
17911
- const locationSearchResult = gDelegate.getZoomAdjustedBounds(gSearchPoint, filterMeetingsAndBounds, zoom);
17911
+ const locationSearchResult = gDelegate.getZoomAdjustedBounds(gSearchPoint, filterMeetingsAndBounds, zoom, findClosestMeetingLatLng(gSearchPoint));
17912
17912
  gDelegate.flyToFixedZoom(gSearchPoint, locationSearchResult.zoom, filterVisible);
17913
17913
  searchResponseCallback();
17914
17914
  })
@@ -17972,6 +17972,16 @@ function MeetingMap(inConfig) {
17972
17972
  function locationSearchGeocodeInitial(resp) {
17973
17973
  locationSearchGeocode(resp, true);
17974
17974
  }
17975
+ function findClosestMeetingLatLng(center) {
17976
+ return filterMeetings(gAllMeetings).reduce((closest, meeting) => {
17977
+ const meetingLocation = {lat: meeting.latitude, lng: meeting.longitude};
17978
+ const distance = getDistance(center, meetingLocation);
17979
+ if (distance < closest.distance) {
17980
+ return {meetingLocation: meetingLocation, distance: distance};
17981
+ }
17982
+ return closest;
17983
+ }, {meetingLocation: null, distance: Infinity}).meetingLocation;
17984
+ }
17975
17985
  function locationSearchGeocode(resp, initial=false) {
17976
17986
  chooseResponse('bmlt_location_search_modal', resp, function(resp, i) {
17977
17987
  closeModalWindow(gLocationSearchModal);
@@ -17980,7 +17990,8 @@ function MeetingMap(inConfig) {
17980
17990
  let center = centerAndBounds.center;
17981
17991
  filterVisible(false);
17982
17992
  let zoom = calcZoomThatContainsBoundingBox(centerAndBounds);
17983
- gLocationSearchResult = gDelegate.getZoomAdjustedBounds(center, filterMeetingsAndBounds, zoom);
17993
+
17994
+ gLocationSearchResult = gDelegate.getZoomAdjustedBounds(center, filterMeetingsAndBounds, zoom, findClosestMeetingLatLng(center));
17984
17995
  gSearchPoint = {"lat": gLocationSearchResult.center.lat, "lng": gLocationSearchResult.center.lng};
17985
17996
  filterVisible(true, gLocationSearchResult.bounds);
17986
17997
  crouton.updateDistances(initial);
@@ -18045,13 +18056,13 @@ function MeetingMap(inConfig) {
18045
18056
  retrieveGeolocation().then(function(coords) {
18046
18057
  filterVisible(false);
18047
18058
  if (isMapVisible() || !makeFilterVisible) {
18048
- const locationSearchResult = gDelegate.getZoomAdjustedBounds(coords, filterMeetingsAndBounds, config.locationSearchZoom ?? 12);
18059
+ const locationSearchResult = gDelegate.getZoomAdjustedBounds(coords, filterMeetingsAndBounds, config.locationSearchZoom ?? 12, findClosestMeetingLatLng(coords));
18049
18060
  gDelegate.flyToFixedZoom(coords, locationSearchResult.zoom, () => {
18050
18061
  filterVisible(makeFilterVisible);
18051
18062
  if (makeFilterVisible) setLocationSearchButtonLabel(crouton.localization.getWord('closest meetings'));
18052
18063
  });
18053
18064
  } else {
18054
- gLocationSearchResult = gDelegate.getZoomAdjustedBounds(coords, filterMeetingsAndBounds, config.locationSearchZoom ?? 12);
18065
+ gLocationSearchResult = gDelegate.getZoomAdjustedBounds(coords, filterMeetingsAndBounds, config.locationSearchZoom ?? 12, findClosestMeetingLatLng(coords));
18055
18066
  filterVisible(true, gLocationSearchResult.bounds);
18056
18067
  setLocationSearchButtonLabel(crouton.localization.getWord('closest meetings'));
18057
18068
  }