@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 CHANGED
@@ -14556,7 +14556,7 @@ this["hbs_Crouton"]["templates"]["mapMenu"] = Handlebars.template({"1":function(
14556
14556
  + alias1((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias3).call(alias2,"Show meetings near...",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":40,"column":28},"end":{"line":40,"column":63}}}))
14557
14557
  + "</span><span id=\"close_search\" class=\"modal-close\">x</span>\n <p></p>\n <div class=\"modal-search\">\n "
14558
14558
  + alias1((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias3).call(alias2,"Enter a city or zip code",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":43,"column":12},"end":{"line":43,"column":50}}}))
14559
- + "\n <input id=\"goto-text\" type=\"text\">\n <p>\n <button id=\"goto-button\" class=\"filter-button\">Los</button>\n </p>\n </div>\n </div> \n</div>\n\n";
14559
+ + "\n <input id=\"goto-text\" type=\"text\">\n <button id=\"goto-button\" class=\"filter-button\">Los</button>\n </div>\n </div> \n</div>\n\n";
14560
14560
  },"usePartial":true,"useData":true,"useDepths":true});
14561
14561
  this["hbs_Crouton"]["templates"]["mapSearch"] = Handlebars.template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
14562
14562
  var alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) {
@@ -14568,17 +14568,17 @@ this["hbs_Crouton"]["templates"]["mapSearch"] = Handlebars.template({"compiler":
14568
14568
 
14569
14569
  return "<button id=\"map-search-button\" class=\"menu-button\" title=\"Erweiterte Suche\">\n <span class=\"menu-button-label\" style=\"position:initial;\">"
14570
14570
  + 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}}}))
14571
- + "</span>\n</button>\n<div id=\"bmltsearch_modal\" class=\"modal\" style=\"display: none;\">\n <div id=\"bmltsearch_content\" class=\"modal-content\">\n <span class=\"modal-title\">"
14572
- + alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"Search for meetings",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":6,"column":28},"end":{"line":6,"column":61}}}))
14573
- + "</span><span id=\"close_search\" class=\"modal-close\">x</span>\n <table>\n <tr><td><div class=\"modal-search\">\n <input id=\"bmltsearch-goto-text\" type=\"text\" placeholder=\""
14574
- + 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":9,"column":70},"end":{"line":9,"column":108}}}))
14571
+ + "</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\">"
14572
+ + 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}}}))
14573
+ + "</span>\n <table>\n <tr><td><div class=\"modal-search\">\n <input id=\"bmltsearch-goto-text\" type=\"text\" placeholder=\""
14574
+ + 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}}}))
14575
14575
  + "\" style=\"margin-bottom:5px;\">\n <button id=\"bmltsearch-text-button\" class=\"filter-button\">"
14576
- + alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"text_search",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":10,"column":70},"end":{"line":10,"column":95}}}))
14577
- + "</button>\n </div></td></tr>\n <tr><td><div class=\"modal-search\">\n <p>\n <button id=\"bmltsearch-nearbyMeetings\" class=\"filter-button\">"
14576
+ + 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}}}))
14577
+ + "</button>\n </div></td></tr>\n <tr><td><div class=\"modal-search\">\n <button id=\"bmltsearch-nearbyMeetings\" class=\"filter-button\">"
14578
14578
  + 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}}}))
14579
- + "</button>\n </p>\n </div></td></tr>\n <tr><td><div class=\"modal-search\">\n <p>\n <button id=\"bmltsearch-clicksearch\" class=\"filter-button\">"
14580
- + alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"click_search",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":19,"column":74},"end":{"line":19,"column":100}}}))
14581
- + "</button>\n </p>\n </div></td></tr></table>\n </div> \n</div>";
14579
+ + "</button>\n </div></td></tr>\n <tr><td><div class=\"modal-search\">\n <button id=\"bmltsearch-clicksearch\" class=\"filter-button\">"
14580
+ + 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}}}))
14581
+ + "</button>\n </div></td></tr></table>\n </div> \n</div>";
14582
14582
  },"useData":true});
14583
14583
  this["hbs_Crouton"]["templates"]["meetings"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
14584
14584
  var stack1, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3=container.escapeExpression, alias4=container.lambda, lookupProperty = container.lookupProperty || function(parent, propertyName) {
@@ -15993,6 +15993,27 @@ crouton_Handlebars.registerHelper("startup", () => '');
15993
15993
  crouton_Handlebars.registerHelper("enrich", () => '');
15994
15994
  crouton_Handlebars.registerHelper('selectFormatPopup', () => "formatPopup");
15995
15995
  crouton_Handlebars.registerHelper('selectObserver', () => "observerTemplate");
15996
+
15997
+ const retrieveGeolocation = () => {
15998
+ return new Promise((resolve, reject) => {
15999
+ if (window.storedGeolocation) {
16000
+ resolve(window.storedGeolocation);
16001
+ } else if (navigator.geolocation) {
16002
+ navigator.geolocation.getCurrentPosition((position) => {
16003
+ window.storedGeolocation = {
16004
+ latitude: position.coords.latitude,
16005
+ longitude: position.coords.longitude
16006
+ };
16007
+ resolve(window.storedGeolocation);
16008
+ }, (error) => {
16009
+ reject(new Error('Error getting geolocation: ' + error.message));
16010
+ });
16011
+ } else {
16012
+ reject(new Error('Geolocation is not supported by this browser.'));
16013
+ }
16014
+ });
16015
+ };
16016
+
15996
16017
  function Crouton(config) {
15997
16018
  var self = this;
15998
16019
  self.mutex = false;
@@ -16239,18 +16260,14 @@ function Crouton(config) {
16239
16260
  }
16240
16261
 
16241
16262
  if (self.config['distance_search'] !== 0) {
16242
- if (navigator.geolocation) {
16243
- return new Promise(function (resolve, reject) {
16244
- navigator.geolocation.getCurrentPosition(resolve, reject);
16245
- }).then(function(position) {
16246
- url += '&lat_val=' + position.coords.latitude
16247
- + '&long_val=' + position.coords.longitude
16248
- + '&sort_results_by_distance=1';
16249
-
16250
- url += (self.config['distance_units'] === "km" ? '&geo_width_km=' : '&geo_width=') + self.config['distance_search'];
16251
- return self.getMeetings(url);
16252
- });
16253
- }
16263
+ return retrieveGeolocation().then((position) => {
16264
+ url += '&lat_val=' + position.latitude + '&long_val=' + position.longitude + '&sort_results_by_distance=1';
16265
+ url += (self.config['distance_units'] === "km" ? '&geo_width_km=' : '&geo_width=') + self.config['distance_search'];
16266
+ return self.getMeetings(url);
16267
+ }).catch((error) => {
16268
+ console.error(error.message);
16269
+ return self.getMeetings(url); // Proceed without geolocation if error occurs
16270
+ });
16254
16271
  } else if (self.config['custom_query'] != null) {
16255
16272
  url += self.config['custom_query'] + '&sort_keys=' + self.config['sort_keys'];
16256
16273
  return self.getMeetings(url);
@@ -16468,11 +16485,11 @@ function Crouton(config) {
16468
16485
  croutonMap.initialize(self.createBmltMapElement(),self.meetingData,context,null,fitBounds,callback);
16469
16486
  }
16470
16487
  self.getCurrentLocation = function(callback) {
16471
- if (navigator.geolocation) {
16472
- navigator.geolocation.getCurrentPosition(callback, self.errorHandler);
16473
- } else {
16474
- $('.geo').removeClass("hide").addClass("show").html('<p>Geolocation is not supported by your browser</p>');
16475
- }
16488
+ retrieveGeolocation().then(position => {
16489
+ callback(position);
16490
+ }).catch(error => {
16491
+ jQuery('.geo').removeClass("hide").addClass("show").html(`<p>${error.message}</p>`);
16492
+ });
16476
16493
  };
16477
16494
  self.renderView = function (selector, context, callback, fitBounds) {
16478
16495
  hbs_Crouton['localization'] = self.localization;
@@ -16550,8 +16567,8 @@ function Crouton(config) {
16550
16567
  }
16551
16568
 
16552
16569
  self.showLocation = function(position) {
16553
- var latitude = position.coords.latitude;
16554
- var longitude = position.coords.longitude;
16570
+ var latitude = position.latitude;
16571
+ var longitude = position.longitude;
16555
16572
  var distanceUnit;
16556
16573
  var distanceCalculation;
16557
16574