@bmlt-enabled/croutonjs 3.20.12 → 3.21.0

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.js CHANGED
@@ -13294,9 +13294,9 @@ function CroutonLocalization(language) {
13294
13294
  "formats": "Struktur",
13295
13295
  "map": "Kort",
13296
13296
  "neighborhood": "Neighborhood",
13297
- "near_me": "Near Me",
13298
- "text_search": "Text Search",
13299
- "click_search": "Click Search",
13297
+ "near_me": "Find nearby meetings",
13298
+ "text_search": "Find meetings there",
13299
+ "click_search": "Find meetings near to a point on the map",
13300
13300
  "pan_and_zoom": "Pan + Zoom",
13301
13301
  "languages": "Languages",
13302
13302
  "common_needs": "Common Needs",
@@ -13390,7 +13390,7 @@ function CroutonLocalization(language) {
13390
13390
  'filter by visibility': "Zeige nur Meetings, die gerade auf dem Karte stehen",
13391
13391
  'go': "Los!"
13392
13392
  },
13393
- "en-AU": {
13393
+ "en-AU": {
13394
13394
  "days_of_the_week" : ["", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
13395
13395
  "weekday" : "Weekday",
13396
13396
  "city" : "City",
@@ -13404,10 +13404,10 @@ function CroutonLocalization(language) {
13404
13404
  "postal_codes" : "Postcodes",
13405
13405
  "formats" : "Formats",
13406
13406
  "map" : "Map",
13407
- "neighborhood": "Neighborhood",
13408
- "near_me": "Near Me",
13409
- "text_search": "Text Search",
13410
- "click_search": "Click Search",
13407
+ "neighborhood": "Neighbourhood",
13408
+ "near_me": "Find nearby meetings",
13409
+ "text_search": "Find meetings there",
13410
+ "click_search": "Find meetings near to a point on the map",
13411
13411
  "languages": "Languages",
13412
13412
  "common_needs": "Common Needs",
13413
13413
  "meeting_count": "Weekly Meetings:",
@@ -13437,7 +13437,7 @@ function CroutonLocalization(language) {
13437
13437
  'show meetings near...': 'Show meetings near...',
13438
13438
  'filter meetings': 'Filter meetings',
13439
13439
  'visible meeting list': 'Visible meetings as list',
13440
- 'enter a city or zip code': 'Enter a city or zip code',
13440
+ 'enter a city or zip code': 'Enter a city and state',
13441
13441
  'toggle fullscreen mode': 'Toggle fullscreen mode',
13442
13442
  'close': "Close",
13443
13443
  'meeting page': "Meeting Page",
@@ -13462,9 +13462,9 @@ function CroutonLocalization(language) {
13462
13462
  "formats" : "Formats",
13463
13463
  "map" : "Map",
13464
13464
  "neighborhood": "Neighborhood",
13465
- "near_me": "Near Me",
13466
- "text_search": "Text Search",
13467
- "click_search": "Click Search",
13465
+ "near_me": "Find nearby meetings",
13466
+ "text_search": "Find meetings there",
13467
+ "click_search": "Find meetings near to a point on the map",
13468
13468
  "pan_and_zoom": "Pan + Zoom",
13469
13469
  "languages": "Languages",
13470
13470
  "common_needs": "Common Needs",
@@ -13520,9 +13520,9 @@ function CroutonLocalization(language) {
13520
13520
  "formats" : "Formats",
13521
13521
  "map" : "Map",
13522
13522
  "neighborhood": "Neighborhood",
13523
- "near_me": "Near Me",
13524
- "text_search": "Text Search",
13525
- "click_search": "Click Search",
13523
+ "near_me": "Find nearby meetings",
13524
+ "text_search": "Find meetings there",
13525
+ "click_search": "Find meetings near to a point on the map",
13526
13526
  "pan_and_zoom": "Pan + Zoom",
13527
13527
  "languages": "Languages",
13528
13528
  "common_needs": "Common Needs",
@@ -13578,9 +13578,9 @@ function CroutonLocalization(language) {
13578
13578
  "formats" : "Formats",
13579
13579
  "map" : "Map",
13580
13580
  "neighborhood": "Neighborhood",
13581
- "near_me": "Near Me",
13582
- "text_search": "Text Search",
13583
- "click_search": "Click Search",
13581
+ "near_me": "Find nearby meetings",
13582
+ "text_search": "Find meetings there",
13583
+ "click_search": "Find meetings near to a point on the map",
13584
13584
  "pan_and_zoom": "Pan + Zoom",
13585
13585
  "languages": "Languages",
13586
13586
  "common_needs": "Common Needs",
@@ -13636,9 +13636,9 @@ function CroutonLocalization(language) {
13636
13636
  "formats" : "Formats",
13637
13637
  "map" : "Map",
13638
13638
  "neighborhood": "Neighborhood",
13639
- "near_me": "Near Me",
13640
- "text_search": "Text Search",
13641
- "click_search": "Click Search",
13639
+ "near_me": "Find nearby meetings",
13640
+ "text_search": "Find meetings there",
13641
+ "click_search": "Find meetings near to a point on the map",
13642
13642
  "pan_and_zoom": "Pan + Zoom",
13643
13643
  "languages": "Languages",
13644
13644
  "common_needs": "Common Needs",
@@ -13752,9 +13752,9 @@ function CroutonLocalization(language) {
13752
13752
  "formats" : "فورمت ها",
13753
13753
  "map" : "نقشه",
13754
13754
  "neighborhood": "Neighborhood",
13755
- "near_me": "Near Me",
13756
- "text_search": "Text Search",
13757
- "click_search": "Click Search",
13755
+ "near_me": "Find nearby meetings",
13756
+ "text_search": "Find meetings there",
13757
+ "click_search": "Find meetings near to a point on the map",
13758
13758
  "pan_and_zoom": "Pan + Zoom",
13759
13759
  "languages": "Languages",
13760
13760
  "common_needs": "Common Needs",
@@ -14670,8 +14670,19 @@ this["hbs_Crouton"]["templates"]["mapMenu"] = Handlebars.template({"1":function(
14670
14670
  + alias1((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias3).call(alias2,"go",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":49,"column":59},"end":{"line":49,"column":75}}}))
14671
14671
  + "</button>\n </div>\n </div>\n</div>\n\n";
14672
14672
  },"usePartial":true,"useData":true,"useDepths":true});
14673
- this["hbs_Crouton"]["templates"]["mapSearch"] = Handlebars.template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
14674
- var alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) {
14673
+ this["hbs_Crouton"]["templates"]["mapSearch"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
14674
+ var lookupProperty = container.lookupProperty || function(parent, propertyName) {
14675
+ if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
14676
+ return parent[propertyName];
14677
+ }
14678
+ return undefined
14679
+ };
14680
+
14681
+ return " <div class=\"modal-search\">\n <button id=\"bmltsearch-clicksearch\" class=\"filter-button\">"
14682
+ + container.escapeExpression((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||container.hooks.helperMissing).call(depth0 != null ? depth0 : (container.nullContext || {}),"click_search",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":19,"column":86},"end":{"line":20,"column":48}}}))
14683
+ + "</button>\n </div>\n";
14684
+ },"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
14685
+ var stack1, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) {
14675
14686
  if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
14676
14687
  return parent[propertyName];
14677
14688
  }
@@ -14682,17 +14693,27 @@ this["hbs_Crouton"]["templates"]["mapSearch"] = Handlebars.template({"compiler":
14682
14693
  + alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"Open Search Dialog",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":1,"column":58},"end":{"line":1,"column":90}}}))
14683
14694
  + "\">\n <span class=\"menu-button-label\" style=\"position:initial;\">"
14684
14695
  + alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"Search for meetings",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":2,"column":62},"end":{"line":2,"column":95}}}))
14685
- + "</span>\n</button>\n<div id=\"bmltsearch_modal\" class=\"modal\" style=\"display: none;\">\n <div id=\"bmltsearch_content\" class=\"modal-content\">\n <span id=\"close_search\" class=\"modal-close\">x</span>\n <span class=\"modal-title\">"
14686
- + alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"Search for meetings",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":7,"column":34},"end":{"line":7,"column":67}}}))
14687
- + "</span>\n <table>\n <tr><td><div class=\"modal-search\">\n <input id=\"bmltsearch-goto-text\" type=\"text\" placeholder=\""
14688
- + alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"Enter a city or zip code",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":10,"column":70},"end":{"line":10,"column":108}}}))
14689
- + "\" style=\"margin-bottom:5px;\">\n <button id=\"bmltsearch-text-button\" class=\"filter-button\">"
14690
- + alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"text_search",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":11,"column":70},"end":{"line":11,"column":95}}}))
14691
- + "</button>\n </div></td></tr>\n <tr><td><div class=\"modal-search\">\n <button id=\"bmltsearch-nearbyMeetings\" class=\"filter-button\">"
14692
- + alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"near_me",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":14,"column":77},"end":{"line":14,"column":98}}}))
14693
- + "</button>\n </div></td></tr>\n <tr><td><div class=\"modal-search\">\n <button id=\"bmltsearch-clicksearch\" class=\"filter-button\">"
14694
- + alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"click_search",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":17,"column":74},"end":{"line":17,"column":100}}}))
14695
- + "</button>\n </div></td></tr></table>\n </div>\n</div>";
14696
+ + "</span>\n</button>\n<div id=\"bmltsearch_modal\" class=\"modal\" style=\"display: none;\">\n <div id=\"bmltsearch_content\" class=\"modal-content\">\n <span id=\"close_search\" class=\"modal-close\">x</span>\n <div id=\"modal-search-page\">\n <div class=\"modal-title\">"
14697
+ + alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"Search for meetings",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":8,"column":37},"end":{"line":8,"column":70}}}))
14698
+ + "</div>\n <div id=\"modal-search-box\" class=\"modal-search\">\n <input id=\"bmltsearch-goto-text\" type=\"text\"\n placeholder=\""
14699
+ + alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"Enter a city or zip code",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":11,"column":45},"end":{"line":11,"column":83}}}))
14700
+ + "\" style=\"margin-bottom:5px;\">\n <button id=\"bmltsearch-text-button\" class=\"filter-button\">"
14701
+ + alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"text_search",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":12,"column":86},"end":{"line":12,"column":111}}}))
14702
+ + "</button>\n </div>\n <div class=\"modal-search\">\n <button id=\"bmltsearch-nearbyMeetings\" class=\"filter-button\">"
14703
+ + alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"near_me",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":15,"column":89},"end":{"line":15,"column":110}}}))
14704
+ + "</button>\n </div>\n"
14705
+ + ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"hasClickSearch") : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":17,"column":16},"end":{"line":22,"column":23}}})) != null ? stack1 : "")
14706
+ + " <button id=\"show-search-parameters\" class=\"advanced-search-button\">"
14707
+ + alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"Adjust Search",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":23,"column":79},"end":{"line":23,"column":106}}}))
14708
+ + "</button>\n </div>\n <div id=\"modal-seach-parameters\">\n <div class=\"modal-title\">"
14709
+ + alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"Configure Search",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":26,"column":37},"end":{"line":26,"column":67}}}))
14710
+ + "</div>\n <input type=\"number\" id=\"search_parameter\" name=\"search_parameter\" maxlength=\"3\" size=\"3\">\n <p>"
14711
+ + alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"This number represents:",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":28,"column":15},"end":{"line":28,"column":52}}}))
14712
+ + "</p>\n <input type=\"radio\" id=\"search_radius\" name=\"map_search_type\" value=\"radius\">\n <label id=\"search_radius_label\" for=\"search_radius\"></label><br>\n <input type=\"radio\" id=\"search_count\" name=\"map_search_type\" value=\"count\">\n <label for=\"search_count\">"
14713
+ + alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"Approx. number of meetings in result",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":32,"column":38},"end":{"line":32,"column":88}}}))
14714
+ + "</label><br>\n <button id=\"show-search-page\" class=\"advanced-search-button\">"
14715
+ + alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"Back",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":33,"column":73},"end":{"line":33,"column":91}}}))
14716
+ + "</button>\n </div>\n </div>\n</div>";
14696
14717
  },"useData":true});
14697
14718
  this["hbs_Crouton"]["templates"]["meetings"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
14698
14719
  var stack1, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3=container.escapeExpression, alias4=container.lambda, lookupProperty = container.lookupProperty || function(parent, propertyName) {
@@ -14956,6 +14977,9 @@ var croutonDefaultTemplates = {
14956
14977
  "<div class='location-information'>{{this.formatted_location_info}}</div>",
14957
14978
  "{{#if this.virtual_meeting_additional_info}}",
14958
14979
  " <div class='meeting-additional-info'>{{this.virtual_meeting_additional_info}}</div>",
14980
+ "{{/if}}",
14981
+ "{{#if this.distance}}",
14982
+ " <div class='meeting-distance'>{{getWord 'Distance'}}: {{this.distance}}</div>",
14959
14983
  "{{/if}}"
14960
14984
  ].join('\n'),
14961
14985
 
@@ -14987,7 +15011,6 @@ var croutonDefaultTemplates = {
14987
15011
  " {{getWord 'meeting details'}}",
14988
15012
  " </a>",
14989
15013
  " </div>",
14990
- " <div class='geo hide'>{{this.latitude}},{{this.longitude}}</div>",
14991
15014
  " {{/unless}}",
14992
15015
  "{{/isNotTemporarilyClosed}}"
14993
15016
  ].join('\n'),
@@ -15094,7 +15117,7 @@ var croutonDefaultTemplates = {
15094
15117
  This meeting is in <a href="{{serviceBodyUrl}}">{{serviceBodyName}}</a><br/>
15095
15118
  {{> offerIcsButton}}
15096
15119
  </td>`,
15097
- marker_contents_template:
15120
+ marker_contents_template:
15098
15121
  `<h4>{{meeting_name}}</h4>
15099
15122
  <div class="active">
15100
15123
  <div class="marker_div_location_text">{{{this.location_text}}}</div>
@@ -16171,6 +16194,7 @@ function Crouton(config) {
16171
16194
  int_include_unpublished: 0, // Includes unpublished meeting
16172
16195
  button_filters: [
16173
16196
  {'title': 'City', 'field': 'location_municipality'},
16197
+ {'title': 'Distance', 'field': 'distance_in_km'},
16174
16198
  ],
16175
16199
  button_format_filters: [],
16176
16200
  default_filter_dropdown: "", // Sets the default format for the dropdowns, the names will match the `has_` fields dropdowns without `has_. Example: `formats=closed`.
@@ -16191,8 +16215,6 @@ function Crouton(config) {
16191
16215
  has_common_needs: false, // Shows the Common Needs dropdown
16192
16216
  has_venues: true, // Shows the venue types dropdown
16193
16217
  has_meeting_count: false, // Shows the meeting count
16194
- show_distance: false, // Determines distance on page load
16195
- distance_search: 0, // Makes a distance based search with results either number of / or distance from coordinates
16196
16218
  recurse_service_bodies: false,// Recurses service bodies when making service bodies request
16197
16219
  service_body: [], // Array of service bodies to return data for.
16198
16220
  formats: '', // Return only meetings with these formats (format shared-id, not key-string)
@@ -16236,7 +16258,9 @@ function Crouton(config) {
16236
16258
  maxZoom: 18
16237
16259
  },
16238
16260
  minZoom: 6,
16239
- maxZoom: 17
16261
+ maxZoom: 17,
16262
+ distance_units: 'miles',
16263
+ noMap: false
16240
16264
  };
16241
16265
 
16242
16266
  self.setConfig(config);
@@ -16369,6 +16393,10 @@ function Crouton(config) {
16369
16393
  }
16370
16394
  }
16371
16395
 
16396
+ if (self.config.map_search) {
16397
+ self.queryable_data_keys.push('distance_in_km');
16398
+ self.queryable_data_keys.push('distance_in_miles');
16399
+ }
16372
16400
  self.collectDataKeys(self.config['meeting_data_template']);
16373
16401
  self.collectDataKeys(self.config['metadata_template']);
16374
16402
  self.collectDataKeys(self.config['observer_template']);
@@ -16387,6 +16415,9 @@ function Crouton(config) {
16387
16415
  return prev +'&formats[]='+id;
16388
16416
  }, '');
16389
16417
  }
16418
+ if (self.config.map_search && self.config['venue_types'].length === 0) {
16419
+ self.config['venue_types'].push('-2');
16420
+ }
16390
16421
  if (self.config['venue_types']) {
16391
16422
  url += self.config['venue_types'].reduce(function(prev,id) {
16392
16423
  return prev +'&venue_types[]='+id;
@@ -16398,16 +16429,7 @@ function Crouton(config) {
16398
16429
  url += "&advanced_published=-1"
16399
16430
  }
16400
16431
 
16401
- if (self.config['distance_search'] !== 0) {
16402
- return retrieveGeolocation().then((position) => {
16403
- url += '&lat_val=' + position.latitude + '&long_val=' + position.longitude + '&sort_results_by_distance=1';
16404
- url += (self.config['distance_units'] === "km" ? '&geo_width_km=' : '&geo_width=') + self.config['distance_search'];
16405
- return self.getMeetings(url);
16406
- }).catch((error) => {
16407
- console.error(error.message);
16408
- return self.getMeetings(url); // Proceed without geolocation if error occurs
16409
- });
16410
- } else if (self.config['custom_query'] != null) {
16432
+ if (self.config['custom_query'] != null) {
16411
16433
  url += self.config['custom_query'] + '&sort_keys=' + self.config['sort_keys'];
16412
16434
  return self.getMeetings(url);
16413
16435
  } else if (self.config['service_body'].length > 0) {
@@ -16462,6 +16484,8 @@ function Crouton(config) {
16462
16484
  self.dayView();
16463
16485
  } else if (viewName === "city") {
16464
16486
  self.filteredView("location_municipality");
16487
+ } else if (viewName === "distance") {
16488
+ self.filteredView("distance_in_km");
16465
16489
  } else {
16466
16490
  self.filteredView(viewName);
16467
16491
  }
@@ -16618,7 +16642,7 @@ function Crouton(config) {
16618
16642
  crouton_Handlebars.registerPartial('bydays', hbs_Crouton.templates['byday']);
16619
16643
  crouton_Handlebars.registerPartial('formatPopup', hbs_Crouton.templates['formatPopup']);
16620
16644
  window.crouton = self;
16621
- croutonMap.initialize(self.createBmltMapElement(),self.meetingData,context,null,fitBounds,callback);
16645
+ croutonMap.initialize(self.createBmltMapElement(),self.meetingData,context,null,fitBounds,callback,self.config['noMap']);
16622
16646
  }
16623
16647
  self.getCurrentLocation = function(callback) {
16624
16648
  retrieveGeolocation().then(position => {
@@ -16701,31 +16725,6 @@ function Crouton(config) {
16701
16725
  });
16702
16726
  }
16703
16727
 
16704
- self.showLocation = function(position) {
16705
- var latitude = position.latitude;
16706
- var longitude = position.longitude;
16707
- var distanceUnit;
16708
- var distanceCalculation;
16709
-
16710
- if (self.config['distance_units'] === "km") {
16711
- distanceUnit = "km";
16712
- distanceCalculation = "K";
16713
- } else if (self.config['distance_units'] === "nm") {
16714
- distanceUnit = "nm";
16715
- distanceCalculation = "N";
16716
- } else {
16717
- distanceUnit = "mi";
16718
- distanceCalculation = "M";
16719
- }
16720
-
16721
- jQuery( ".geo" ).each(function() {
16722
- var target = jQuery( this ).html();
16723
- var arr = target.split(',');
16724
- var distance_result = self.distance(latitude, longitude, arr[0], arr[1], distanceCalculation);
16725
- jQuery( this ).removeClass("hide").addClass("show").html(distance_result.toFixed(1) + ' ' + distanceUnit);
16726
- });
16727
- };
16728
-
16729
16728
  self.errorHandler = function(msg) {
16730
16729
  jQuery('.geo').removeClass("hide").addClass("show").html('');
16731
16730
  };
@@ -16982,6 +16981,22 @@ function Crouton(config) {
16982
16981
  );
16983
16982
  }
16984
16983
 
16984
+ meetingData[m]['distance'] = '';
16985
+ if (self.config['distance_units'] === "km") {
16986
+ if (meetingData[m]['distance_in_km']) {
16987
+ const d = meetingData[m]['distance_in_km'];
16988
+ if (d < 1) {
16989
+ meetingData[m]['distance'] = Math.round( d * 1000) + 'm';
16990
+ }
16991
+ else {
16992
+ meetingData[m]['distance'] = (Math.round(d * 10) / 10).toFixed(1) + 'km';
16993
+ }
16994
+ }
16995
+ } else if (meetingData[m]['distance_in_miles']) {
16996
+ const d = meetingData[m]['distance_in_miles'];
16997
+ meetingData[m]['distance'] = (Math.round(d * 100) / 100).toFixed(2) + ' miles';
16998
+ }
16999
+
16985
17000
  meetings.push(meetingData[m])
16986
17001
  }
16987
17002
 
@@ -17046,7 +17061,6 @@ Crouton.prototype.setConfig = function(config) {
17046
17061
  self.config.show_map = false;
17047
17062
  self.config.map_page = true;
17048
17063
  }
17049
- self.config["distance_search"] = parseInt(self.config["distance_search"] || 0);
17050
17064
  self.config["day_sequence"] = [];
17051
17065
  self.config.day_sequence.push(self.config.int_start_day_id);
17052
17066
  for (var i = 1; i < 7; i++) {
@@ -17297,6 +17311,7 @@ Crouton.prototype.render = function(doMeetingMap = false) {
17297
17311
 
17298
17312
  for (var f = 0; f < self.config.button_filters.length; f++) {
17299
17313
  var groupByName = self.config.button_filters[f]['field'];
17314
+ if (groupByName.startsWith('distance')) continue;
17300
17315
  var groupByData = getUniqueValuesOfKey(daysOfTheWeekMeetings, groupByName).sort();
17301
17316
  for (var i = 0; i < groupByData.length; i++) {
17302
17317
  var groupByMeetings = daysOfTheWeekMeetings.filterByObjectKeyValue(groupByName, groupByData[i]);
@@ -17335,15 +17350,20 @@ Crouton.prototype.render = function(doMeetingMap = false) {
17335
17350
 
17336
17351
  var buttonFiltersDataSorted = {};
17337
17352
  for (var b = 0; b < self.config.button_filters.length; b++) {
17338
- var sortKey = [];
17339
17353
  var groupByName = self.config.button_filters[b]['field'];
17354
+ buttonFiltersDataSorted[groupByName] = {};
17355
+ if (groupByName.startsWith('distance')) {
17356
+ buttonFiltersDataSorted[groupByName]['Sorted by Distance'] = [...self.meetingData].sort((a,b) => a['distance_in_km'] - b['distance_in_km']);
17357
+ continue;
17358
+ }
17359
+ var sortKey = [];
17360
+
17340
17361
  for (var buttonFiltersDataItem in buttonFiltersData[groupByName]) {
17341
17362
  sortKey.push(buttonFiltersDataItem);
17342
17363
  }
17343
17364
 
17344
17365
  sortKey.sort();
17345
17366
 
17346
- buttonFiltersDataSorted[groupByName] = {};
17347
17367
  for (var s = 0; s < sortKey.length; s++) {
17348
17368
  buttonFiltersDataSorted[groupByName][sortKey[s]] = buttonFiltersData[groupByName][sortKey[s]]
17349
17369
  }
@@ -17533,10 +17553,6 @@ Crouton.prototype.render = function(doMeetingMap = false) {
17533
17553
  jQuery("#filter-dropdown-" + filter[0]).val('a-' + filter[1]).trigger('change').trigger('select2:select');
17534
17554
  }
17535
17555
 
17536
- if (self.config['show_distance']) {
17537
- self.getCurrentLocation(self.showLocation);
17538
- }
17539
-
17540
17556
  if (self.config['show_map'] && !self.config['refresh_map'] && !doMeetingMap) {
17541
17557
  croutonMap.initialize(self.createBmltMapElement(), self.meetingData);
17542
17558
  jQuery("#bmlt-map").removeClass("hide");
@@ -18073,7 +18089,7 @@ function MeetingMap(inConfig) {
18073
18089
  * \brief Load the map and set it up. *
18074
18090
  ****************************************************************************************/
18075
18091
 
18076
- function loadMap(inDiv, menuContext, handlebarMapOptions=null,cb=null) {
18092
+ function loadMap(inDiv, menuContext, handlebarMapOptions=null,cb=null,hide=false) {
18077
18093
  if (inDiv) {
18078
18094
  crouton_Handlebars.registerPartial("markerContentsTemplate", config['marker_contents_template']);
18079
18095
  gInDiv = inDiv;
@@ -18093,7 +18109,7 @@ function MeetingMap(inConfig) {
18093
18109
  }
18094
18110
  let loc = {latitude: config.lat, longitude: config.lng, zoom: config.zoom};
18095
18111
  if (handlebarMapOptions) loc = {latitude: handlebarMapOptions.lat, longitude: handlebarMapOptions.lng};
18096
- if (gDelegate.createMap(inDiv, loc)) {
18112
+ if (gDelegate.createMap(inDiv, loc, hide)) {
18097
18113
  gDelegate.addListener('zoomend', function (ev) {
18098
18114
  if (shouldRedrawMarkers() && gAllMeetings) {
18099
18115
  if (listOnlyVisible) {
@@ -18119,12 +18135,19 @@ function MeetingMap(inConfig) {
18119
18135
  };
18120
18136
  };
18121
18137
  var gSearchModal;
18122
- function createSearchButton(menuContext) {
18123
- var template = hbs_Crouton.templates['mapSearch'];
18124
- var controlDiv = document.createElement('div');
18125
- controlDiv.innerHTML = template();
18138
+ function createSearchButton() {
18139
+ const template = hbs_Crouton.templates['mapSearch'];
18140
+ const controlDiv = document.createElement('div');
18141
+ const params = {'hasClickSearch': gDelegate.hasClickSearch()}
18142
+ controlDiv.innerHTML = template(params);
18126
18143
  controlDiv.querySelector("#map-search-button").addEventListener('click', showBmltSearchDialog);
18127
18144
  controlDiv.querySelector("#bmltsearch-nearbyMeetings").addEventListener('click', nearMeSearch);
18145
+ controlDiv.querySelector("#bmltsearch-goto-text").addEventListener('keypress', function (event) {
18146
+ if (event.key === "Enter") {
18147
+ event.preventDefault();
18148
+ document.getElementById("bmltsearch-text-button").click();
18149
+ }
18150
+ });
18128
18151
  controlDiv.querySelector("#bmltsearch-text-button").addEventListener('click', function () {
18129
18152
  let text = document.getElementById("bmltsearch-goto-text").value.trim();
18130
18153
  if (text === "") return;
@@ -18132,7 +18155,35 @@ function MeetingMap(inConfig) {
18132
18155
  gDelegate.callGeocoder(text, null, mapSearchGeocode);
18133
18156
  closeModalWindow(gSearchModal);
18134
18157
  });
18135
- controlDiv.querySelector("#bmltsearch-clicksearch").addEventListener('click', clickSearch);
18158
+ controlDiv.querySelector("#modal-seach-parameters").style.display = 'none';
18159
+ controlDiv.querySelector("#show-search-parameters").addEventListener('click', function (e) {
18160
+ const controlDiv = e.target.parentElement.parentElement;
18161
+ let w = config.map_search.width;
18162
+ let checked = '#search_radius';
18163
+ if (w < 0) {
18164
+ w = -w;
18165
+ checked = '#search_count';
18166
+ }
18167
+ controlDiv.querySelector(checked).checked = true;
18168
+ controlDiv.querySelector('#search_parameter').value = w;
18169
+ controlDiv.querySelector("#modal-seach-parameters").style.display = 'block';
18170
+ controlDiv.querySelector("#modal-search-page").style.display = 'none';
18171
+ controlDiv.querySelector("#search_radius_label").innerHTML = crouton.localization.getWord('Radius of search in $$').replace('$$', crouton.config.distance_units);
18172
+ });
18173
+ controlDiv.querySelector("#show-search-page").addEventListener('click', function (e) {
18174
+ const controlDiv = e.target.parentElement.parentElement;
18175
+ let w = controlDiv.querySelector('#search_parameter').value;
18176
+ if (controlDiv.querySelector('#search_count')) {
18177
+ w = -Math.round(w);
18178
+ if (w == 0) w = -1;
18179
+ }
18180
+ config.map_search.width = w;
18181
+ controlDiv.querySelector("#modal-seach-parameters").style.display = 'none';
18182
+ controlDiv.querySelector("#modal-search-page").style.display = 'block';
18183
+ });
18184
+
18185
+
18186
+ if (gDelegate.hasClickSearch()) controlDiv.querySelector("#bmltsearch-clicksearch").addEventListener('click', clickSearch);
18136
18187
  [...controlDiv.getElementsByClassName('modal-close')].forEach((elem)=>elem.addEventListener('click', (e)=>closeModalWindow(e.target)));
18137
18188
  gSearchModal = controlDiv.querySelector("#bmltsearch_modal");
18138
18189
  gSearchModal.parentElement.removeChild(gSearchModal);
@@ -18227,14 +18278,14 @@ function MeetingMap(inConfig) {
18227
18278
  function hasMapSearch() {
18228
18279
  return 'map_search' in config;
18229
18280
  }
18230
- function loadFromCrouton(inDiv_id, meetings_responseObject, menuContext = null, handlebarMapOptions = null, fitBounds = true, callback) {
18281
+ function loadFromCrouton(inDiv_id, meetings_responseObject, menuContext = null, handlebarMapOptions = null, fitBounds = true, callback, hide) {
18231
18282
  if (!gDelegate.isApiLoaded()) {
18232
- preloadApiLoadedCallback(loadFromCrouton, [inDiv_id, meetings_responseObject, menuContext, handlebarMapOptions, fitBounds, callback]);
18283
+ preloadApiLoadedCallback(loadFromCrouton, [inDiv_id, meetings_responseObject, menuContext, handlebarMapOptions, fitBounds, callback, hide]);
18233
18284
  gDelegate.loadApi();
18234
18285
  return;
18235
18286
  }
18236
18287
  let inDiv = document.getElementById(inDiv_id);
18237
- loadMap(inDiv, menuContext, handlebarMapOptions,callback);
18288
+ loadMap(inDiv, menuContext, handlebarMapOptions, callback, hide);
18238
18289
  loadAllMeetings(meetings_responseObject, fitBounds, true);
18239
18290
  };
18240
18291
  function loadPopupMap(inDiv_id, meeting, handlebarMapOptions = null) {
@@ -18309,10 +18360,14 @@ function MeetingMap(inConfig) {
18309
18360
  };
18310
18361
  };
18311
18362
  function mapSearchGeocode(resp) {
18312
- let latlng = gDelegate.getGeocodeCenter(resp);
18363
+ showThrobber();
18313
18364
  if (document.getElementById("bmltsearch-goto-text"))
18314
18365
  document.getElementById("bmltsearch-goto-text").value = "";
18315
- showThrobber();
18366
+ let latlng = gDelegate.getGeocodeCenter(resp);
18367
+ if (!latlng) {
18368
+ hideThrobber();
18369
+ return;
18370
+ }
18316
18371
  crouton.searchByCoordinates(latlng.lat, latlng.lng, config.map_search.width);
18317
18372
  }
18318
18373
  function loadAllMeetings(meetings_responseObject, fitBounds=true, fitAll=false) {
@@ -18800,8 +18855,15 @@ function MapDelegate(config) {
18800
18855
  var gMainMap;
18801
18856
  var gTileLayer;
18802
18857
  var gClusterLayer = null;
18803
- function createMap(inDiv, inCenter) {
18858
+ function createMap(inDiv, inCenter, inHidden = false) {
18804
18859
  if (! inCenter ) return null;
18860
+ if ( inHidden ) {
18861
+ gDiv = inDiv;
18862
+ gDiv.style.height = 'auto';
18863
+ gDiv.style.marginBottom = '10px';
18864
+ gMainMap = null;
18865
+ return gDiv;
18866
+ }
18805
18867
  myOptions = {
18806
18868
  'minZoom': config.minZoom,
18807
18869
  'maxZoom': config.maxZoom,
@@ -18831,6 +18893,7 @@ function MapDelegate(config) {
18831
18893
  return gMainMap;
18832
18894
  }
18833
18895
  function addListener(ev,f,once) {
18896
+ if (!gMainMap) return;
18834
18897
  if (ev=='idle') {
18835
18898
  ev = 'moveend';
18836
18899
  }
@@ -18848,9 +18911,11 @@ function MapDelegate(config) {
18848
18911
  return {'event': ev, 'f': f};
18849
18912
  }
18850
18913
  function removeListener(o) {
18914
+ if (!gMainMap) return;
18851
18915
  gMainMap.off(o.event, o.f);
18852
18916
  }
18853
18917
  function setViewToPosition(position, filterMeetings, extra=null) {
18918
+ if (!gMainMap) return;
18854
18919
  var latlng = L.latLng(position.latitude, position.longitude);
18855
18920
  gMainMap.flyTo(latlng);
18856
18921
  gMainMap.once('moveend', function(ev) {
@@ -18872,10 +18937,12 @@ function MapDelegate(config) {
18872
18937
  }
18873
18938
  function clearAllMarkers ( )
18874
18939
  {
18940
+ if (!gMainMap) return;
18875
18941
  gAllMarkers && gAllMarkers.forEach((m) => {m.marker.closePopup(); gMainMap.removeLayer(m.marker)});
18876
18942
  gAllMarkers = [];
18877
18943
  };
18878
18944
  function getZoom() {
18945
+ if (!gMainMap) return null;
18879
18946
  return gMainMap.getZoom();
18880
18947
  }
18881
18948
  function getZoomAdjust(only_out,filterMeetings) {
@@ -18918,12 +18985,15 @@ function MapDelegate(config) {
18918
18985
  return ret;
18919
18986
  }
18920
18987
  function setZoom(filterMeetings, force=0) {
18988
+ if (!gMainMap) return;
18921
18989
  (force > 0) ? gMainMap.setZoom(force) : gMainMap.setZoom(getZoomAdjust(false,filterMeetings));
18922
18990
  }
18923
18991
  function zoomOut(filterMeetings) {
18992
+ if (!gMainMap) return;
18924
18993
  gMainMap.setZoom(getZoomAdjust(true,filterMeetings));
18925
18994
  }
18926
18995
  function fromLatLngToPoint(lat, lng) {
18996
+ if (!gMainMap) return null;
18927
18997
  return gMainMap.latLngToLayerPoint(L.latLng(lat,lng));
18928
18998
  }
18929
18999
  function createMarker ( inCoords, ///< The long/lat for the marker.
@@ -18933,6 +19003,7 @@ function MapDelegate(config) {
18933
19003
  in_ids
18934
19004
  )
18935
19005
  {
19006
+ if (!gMainMap) return;
18936
19007
  var in_main_icon = (multi ? g_icon_image_multi : g_icon_image_single);
18937
19008
 
18938
19009
  let highlightRow = function(target) {
@@ -18964,6 +19035,7 @@ function MapDelegate(config) {
18964
19035
  gAllMarkers.push( {ids: in_ids, marker: marker} );
18965
19036
  }
18966
19037
  function openMarker(id) {
19038
+ if (!gMainMap) return;
18967
19039
  marker = gAllMarkers.find((m) => m.ids.includes(id));
18968
19040
  if (marker) {
18969
19041
  marker.marker.openPopup();
@@ -18974,6 +19046,10 @@ function openMarker(id) {
18974
19046
  jQuery("#meeting-data-row-" + id + " > td").addClass("rowHighlight");
18975
19047
  }
18976
19048
  function addControl(div,pos,cb) {
19049
+ if (!gMainMap) {
19050
+ gDiv.appendChild(div);
19051
+ return;
19052
+ }
18977
19053
  var ControlClass = L.Control.extend({
18978
19054
  onAdd: function (map) {
18979
19055
  return div;
@@ -19117,25 +19193,32 @@ function addControl(div,pos,cb) {
19117
19193
  geocode(in_loc, geoCodeParams, callback, filterMeetings);
19118
19194
  }
19119
19195
  function contains(bounds, lat, lng) {
19196
+ if (!gMainMap) return true;
19120
19197
  return bounds.contains(L.latLng ( lat, lng ));
19121
19198
  }
19122
19199
  function getBounds() {
19200
+ if (!gMainMap) return null;
19123
19201
  return gMainMap.getBounds();
19124
19202
  }
19125
19203
  function invalidateSize() {
19204
+ if (!gMainMap) return;
19126
19205
  gMainMap.invalidateSize();
19127
19206
  }
19128
19207
  function fitBounds(locations) {
19208
+ if (!gMainMap) return;
19129
19209
  const bounds = locations.reduce(function(b,lat_lng) {b.extend(lat_lng); return b;}, L.latLngBounds());
19130
19210
  gMainMap.fitBounds(bounds);
19131
19211
  }
19132
19212
  function createClusterLayer() {
19213
+ if (!gMainMap) return;
19133
19214
  gClusterLayer = L.markerClusterGroup();
19134
19215
  }
19135
19216
  function addClusterLayer() {
19217
+ if (!gMainMap) return;
19136
19218
  gClusterLayer && gMainMap.addLayer(gClusterLayer);
19137
19219
  }
19138
19220
  function removeClusterLayer() {
19221
+ if (!gMainMap) return;
19139
19222
  gClusterLayer && gMainMap.removeLayer(gClusterLayer);
19140
19223
  gClusterLayer = null;
19141
19224
  }
@@ -19158,6 +19241,9 @@ function addControl(div,pos,cb) {
19158
19241
  f();
19159
19242
  }
19160
19243
  function returnTrue() {return true;}
19244
+ function hasClickSearch() {
19245
+ return gMainMap != null;
19246
+ }
19161
19247
  this.createMap = createMap;
19162
19248
  this.addListener = addListener;
19163
19249
  this.removeListener = removeListener;
@@ -19184,6 +19270,7 @@ function addControl(div,pos,cb) {
19184
19270
  this.modalOn = modalOn;
19185
19271
  this.modalOff = modalOff;
19186
19272
  this.afterInit = afterInit;
19273
+ this.hasClickSearch = hasClickSearch;
19187
19274
  }
19188
19275
  MapDelegate.prototype.createMap = null;
19189
19276
  MapDelegate.prototype.addListener = null;
@@ -19211,6 +19298,7 @@ MapDelegate.prototype.getGeocodeCenter = null;
19211
19298
  MapDelegate.prototype.modalOn = null;
19212
19299
  MapDelegate.prototype.modalOff = null;
19213
19300
  MapDelegate.prototype.afterInit = null;
19301
+ MapDelegate.prototype.hasClickSearch = null;
19214
19302
 
19215
19303
  /* @preserve
19216
19304
  * Leaflet 1.5.1+Detached: 2e3e0ffbe87f246eb76d86d2633ddd59b262830b.2e3e0ff, a JS library for interactive maps. http://leafletjs.com