@bmlt-enabled/croutonjs 3.22.2 → 3.22.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.
@@ -13410,6 +13410,7 @@ function CroutonLocalization(language) {
13410
13410
  "google_maps_desc_mobile": "In Google Maps App öffnen",
13411
13411
  "waze": "Waze",
13412
13412
  "waze_desc": "In Waze App öffnen",
13413
+ "remember my choice": "Auswahl speichern",
13413
13414
  },
13414
13415
  "en-AU": {
13415
13416
  "days_of_the_week" : ["", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
@@ -14413,6 +14414,22 @@ this["hbs_Crouton"]["templates"]["byfield"] = Handlebars.template({"1":function(
14413
14414
  + ((stack1 = lookupProperty(helpers,"each").call(depth0 != null ? depth0 : (container.nullContext || {}),depth0,{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":2,"column":8},"end":{"line":13,"column":17}}})) != null ? stack1 : "")
14414
14415
  + " </table>\n</div>";
14415
14416
  },"usePartial":true,"useData":true});
14417
+ this["hbs_Crouton"]["templates"]["directionsButton"] = Handlebars.template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
14418
+ var alias1=container.lambda, alias2=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) {
14419
+ if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
14420
+ return parent[propertyName];
14421
+ }
14422
+ return undefined
14423
+ };
14424
+
14425
+ return " <div class=\"bootstrap-bmlt\">\n <button data-latitude=\""
14426
+ + alias2(alias1((depth0 != null ? lookupProperty(depth0,"latitude") : depth0), depth0))
14427
+ + "\" data-longitude=\""
14428
+ + alias2(alias1((depth0 != null ? lookupProperty(depth0,"longitude") : depth0), depth0))
14429
+ + "\" class=\"btn btn-primary bmlt-xs get-directions-modal\">\n <span class=\"glyphicon glyphicon-road\"></span> "
14430
+ + alias2((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||container.hooks.helperMissing).call(depth0 != null ? depth0 : (container.nullContext || {}),"get_directions",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":3,"column":67},"end":{"line":3,"column":95}}}))
14431
+ + "\n </button>\n </div>\n";
14432
+ },"useData":true});
14416
14433
  this["hbs_Crouton"]["templates"]["formatPopup"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
14417
14434
  var helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) {
14418
14435
  if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
@@ -14829,6 +14846,20 @@ this["hbs_Crouton"]["templates"]["mapSearch"] = Handlebars.template({"1":functio
14829
14846
  + 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}}}))
14830
14847
  + "</button>\n </div>\n </div>\n</div>";
14831
14848
  },"useData":true});
14849
+ this["hbs_Crouton"]["templates"]["meetingDetailsButton"] = Handlebars.template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
14850
+ var alias1=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) {
14851
+ if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
14852
+ return parent[propertyName];
14853
+ }
14854
+ return undefined
14855
+ };
14856
+
14857
+ return " <div>\n <a onclick='crouton.meetingModal("
14858
+ + alias1(container.lambda((depth0 != null ? lookupProperty(depth0,"id_bigint") : depth0), depth0))
14859
+ + ")' tabindex='0' href='#' id='map-button' class='btn btn-primary btn-xs'>\n <span class='glyphicon glyphicon-search' aria-hidden='true'></span>\n "
14860
+ + 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}}}))
14861
+ + "\n </a>\n </div>\n";
14862
+ },"useData":true});
14832
14863
  this["hbs_Crouton"]["templates"]["meetings"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
14833
14864
  var stack1, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3=container.escapeExpression, alias4=container.lambda, lookupProperty = container.lookupProperty || function(parent, propertyName) {
14834
14865
  if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
@@ -15144,12 +15175,7 @@ var croutonDefaultTemplates = {
15144
15175
  "{{/isVirtualOrHybrid}}",
15145
15176
  "{{#isNotTemporarilyClosed this}}",
15146
15177
  " {{#unless (hasFormats 'VM' this)}}",
15147
- " <div>",
15148
- " <a onclick='crouton.meetingModal({{this.id_bigint}})' tabindex='0' href='#' id='map-button' class='btn btn-primary btn-xs'>",
15149
- " <span class='glyphicon glyphicon-search' aria-hidden='true'></span>",
15150
- " {{getWord 'meeting details'}}",
15151
- " </a>",
15152
- " </div>",
15178
+ " {{> meetingDetailsButton this}}",
15153
15179
  " {{/unless}}",
15154
15180
  "{{/isNotTemporarilyClosed}}"
15155
15181
  ].join('\n'),
@@ -15220,18 +15246,7 @@ var croutonDefaultTemplates = {
15220
15246
  <div class="location-text">{{{this.location_text}}}</div>
15221
15247
  <div class="meeting-address">{{this.formatted_address}}</div>
15222
15248
  <div class="location-information">{{{this.formatted_location_info}}}</div>
15223
- <div class="bootstrap-bmlt">
15224
- <button data-latitude="{{this.latitude}}" data-longitude="{{this.longitude}}" class="btn btn-primary bmlt-xs get-directions-modal">
15225
- <span class="glyphicon glyphicon-road"></span> {{getWord "get_directions"}}
15226
- </button>
15227
- </div>
15228
- <div id="directionsMapModal" class="directions-map-modal" style="display: none;">
15229
- <div class="directions-map-modal-content">
15230
- <span class="directions-map-modal-close">&times;</span>
15231
- <h3>{{getWord "select_map_app"}}</h3>
15232
- <div id="directionsMapOptions"></div>
15233
- </div>
15234
- </div>
15249
+ {{> directionsButton this}}
15235
15250
  <br/>
15236
15251
  {{/isInPersonOrHybrid}}
15237
15252
  {{#isVirtualOrHybrid this}}
@@ -17155,21 +17170,6 @@ function Crouton(config) {
17155
17170
  else self.meetingSearch();
17156
17171
  }
17157
17172
  else if (!window.croutonMap.hasMapSearch()) self.meetingSearch();
17158
-
17159
- jQuery('html').on('click', '.get-directions-modal', function (e) {
17160
- var lat = jQuery(this).data('latitude');
17161
- var lng = jQuery(this).data('longitude');
17162
-
17163
- if (isMobileDevice()) {
17164
- showMapSelector(lat, lng);
17165
- } else {
17166
- window.open(`https://www.google.com/maps/dir/?api=1&destination=${lat},${lng}`, '_blank');
17167
- }
17168
- });
17169
-
17170
- jQuery('html').on('click', '.directions-map-modal-close', function (e) {
17171
- closeDirectionsMapModal()
17172
- });
17173
17173
  }
17174
17174
 
17175
17175
  Crouton.prototype.setConfig = function(config) {
@@ -17283,10 +17283,10 @@ Crouton.prototype.doHandlebars = function() {
17283
17283
  var customEnrichTemplate = crouton_Handlebars.compile('{{enrich this}}');
17284
17284
  customEnrichTemplate(enrichedMeetingData[0]);
17285
17285
 
17286
- self.handlebars(enrichedMeetingData[0], elements)
17286
+ self.handlebars(enrichedMeetingData[0], elements);
17287
+ jQuery('.get-directions-modal').on('click', openDirectionsModal);
17287
17288
  });
17288
17289
  });
17289
-
17290
17290
  };
17291
17291
 
17292
17292
  Crouton.prototype.meetingModal = function(meetingId) {
@@ -17300,10 +17300,10 @@ Crouton.prototype.meetingModal = function(meetingId) {
17300
17300
  span.textContent = self.config.meetingpage_frame_template;
17301
17301
  let meeting = self.meetingData.find((m) => m.id_bigint == meetingId);
17302
17302
  self.handlebars(meeting, tabs.getElementsByTagName('bmlt-handlebar'));
17303
-
17304
17303
  [...tabs.getElementsByClassName('modal-close')].forEach((elem)=>elem.addEventListener('click', (e)=>{croutonMap.closeModalWindow(e.target); document.getElementById('meeting_modal').remove()}));
17305
17304
  let mm = document.getElementById('meeting_modal');
17306
17305
  document.body.appendChild(mm);
17306
+ jQuery('#meeting_modal .get-directions-modal').on('click', openDirectionsModal);
17307
17307
  croutonMap.openModalWindow(mm, true);
17308
17308
  croutonMap.showMap(true);
17309
17309
  let visibleMeetings = jQuery('.bmlt-data-row:visible');
@@ -17664,7 +17664,12 @@ Crouton.prototype.render = function(doMeetingMap = false) {
17664
17664
  });
17665
17665
  jQuery('.meeting-group:not(.non-collapsable) .group-header').on('click', function(e) {
17666
17666
  jQuery(e.target.parentElement).toggleClass('closed');
17667
- })
17667
+ });
17668
+ jQuery('.get-directions-modal').on('click', openDirectionsModal);
17669
+
17670
+ jQuery('.directions-map-modal-close').on('click', function (e) {
17671
+ closeDirectionsMapModal()
17672
+ });
17668
17673
  /****
17669
17674
  jQuery('.custom-ul').on('click', 'a', function (event) {
17670
17675
  jQuery('.bmlt-page').each(function (index) {
@@ -17821,9 +17826,8 @@ function isMobileDevice() {
17821
17826
  return isIOSDevice() || isAndroidDevice() || /Mobi|Android/i.test(navigator.userAgent);
17822
17827
  }
17823
17828
 
17824
- function createMapOptions(latitude, longitude) {
17829
+ function createDirectionsOptions() {
17825
17830
  const options = [];
17826
- const isMobile = isMobileDevice();
17827
17831
  const isIOS = isIOSDevice();
17828
17832
 
17829
17833
  // Apple Maps (iOS only)
@@ -17832,7 +17836,7 @@ function createMapOptions(latitude, longitude) {
17832
17836
  name: crouton.localization.getWord('apple_maps'),
17833
17837
  description: crouton.localization.getWord('apple_maps_desc'),
17834
17838
  icon: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23007AFF'%3E%3Cpath d='M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z'/%3E%3C/svg%3E",
17835
- url: `https://maps.apple.com/?daddr=${latitude},${longitude}`
17839
+ url: 'https://maps.apple.com/?daddr=${latitude},${longitude}'
17836
17840
  });
17837
17841
  }
17838
17842
 
@@ -17841,18 +17845,16 @@ function createMapOptions(latitude, longitude) {
17841
17845
  name: crouton.localization.getWord('google_maps'),
17842
17846
  description: crouton.localization.getWord('google_maps_desc_mobile'),
17843
17847
  icon: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234285f4'%3E%3Cpath d='M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z'/%3E%3C/svg%3E",
17844
- url: `https://www.google.com/maps/dir/?api=1&destination=${latitude},${longitude}`
17848
+ url: 'https://www.google.com/maps/dir/?api=1&destination=${latitude},${longitude}'
17845
17849
  });
17846
17850
 
17847
- // Waze (mobile devices)
17848
- if (isMobile) {
17849
- options.push({
17850
- name: crouton.localization.getWord('waze'),
17851
- description: crouton.localization.getWord('waze_desc'),
17852
- icon: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2300D4FF'%3E%3Cpath d='M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z'/%3E%3C/svg%3E",
17853
- url: `https://waze.com/ul?ll=${latitude},${longitude}&navigate=yes`
17854
- });
17855
- }
17851
+ // Waze (always available)
17852
+ options.push({
17853
+ name: crouton.localization.getWord('waze'),
17854
+ description: crouton.localization.getWord('waze_desc'),
17855
+ icon: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2300D4FF'%3E%3Cpath d='M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z'/%3E%3C/svg%3E",
17856
+ url: 'https://waze.com/ul?ll=${latitude},${longitude}&navigate=yes'
17857
+ });
17856
17858
 
17857
17859
  return options;
17858
17860
  }
@@ -18031,6 +18033,8 @@ crouton_Handlebars.registerPartial('icsButton',
18031
18033
  '<a href="{{BMLT2ics}}?meeting-id={{id_bigint}}" download="{{meeting_name}}.ics" id="share-button" class="btn btn-primary btn-xs" ><span class="glyphicon glyphicon-download-alt"></span> {{getWord "bmlt2ics"}}</a>');
18032
18034
  crouton_Handlebars.registerPartial('offerIcsButton',
18033
18035
  "{{#if (hasBMLT2ics)}}{{> icsButton}}<br/>{{/if}}");
18036
+ crouton_Handlebars.registerPartial('directionsButton', hbs_Crouton.templates['directionsButton']);
18037
+ crouton_Handlebars.registerPartial('meetingDetailsButton', hbs_Crouton.templates['meetingDetailsButton']);
18034
18038
  function convertToPunyCode(str) {
18035
18039
  return str !== undefined ? punycode.toASCII(str.toLowerCase()).replace(/\W|_/g, "-") : "";
18036
18040
  }
@@ -18246,15 +18250,27 @@ function swipedetect(el, callback){
18246
18250
  }
18247
18251
  }, false)
18248
18252
  }
18253
+ function openDirectionsModal(e) {
18254
+ const latitude = jQuery(this).data('latitude');
18255
+ const longitude = jQuery(this).data('longitude');
18249
18256
 
18250
- function showMapSelector(latitude, longitude) {
18251
- // For desktop users, directly open Google Maps
18252
- if (!isMobileDevice()) {
18253
- window.open(`https://www.google.com/maps/dir/?api=1&destination=${latitude},${longitude}`, '_blank');
18257
+ const savedUrl = localStorage.getItem("croutonDirectionsURL");
18258
+ if (savedUrl && savedUrl != null) {
18259
+ openDirections(savedUrl, latitude, longitude, false);
18254
18260
  return;
18255
18261
  }
18256
-
18257
- // For mobile users, show the map selection modal
18262
+ if (!document.getElementById('directionsMapModal')) {
18263
+ const word = crouton.localization.getWord("select_map_app");
18264
+ e.target.insertAdjacentHTML("afterend",
18265
+ `<div id="directionsMapModal" class="directions-map-modal remove-after-use">
18266
+ <div class="directions-map-modal-content">
18267
+ <span class="directions-map-modal-close">×</span>
18268
+ <h3>`+word+`</h3>
18269
+ <div id="directionsMapOptions"></div>
18270
+ </div>
18271
+ </div>`
18272
+ );
18273
+ }
18258
18274
  const modal = document.getElementById('directionsMapModal');
18259
18275
  const optionsContainer = document.getElementById('directionsMapOptions');
18260
18276
 
@@ -18265,12 +18281,12 @@ function showMapSelector(latitude, longitude) {
18265
18281
 
18266
18282
  optionsContainer.innerHTML = '';
18267
18283
 
18268
- const options = createMapOptions(latitude, longitude);
18284
+ const options = createDirectionsOptions();
18269
18285
 
18270
18286
  options.forEach(option => {
18271
18287
  const optionElement = document.createElement('div');
18272
18288
  optionElement.className = 'directions-map-option';
18273
- optionElement.onclick = () => openMap(option.url);
18289
+ optionElement.onclick = () => openDirections(option.url, latitude, longitude);
18274
18290
 
18275
18291
  optionElement.innerHTML = `
18276
18292
  <img src="${option.icon}" alt="${option.name}" class="directions-map-option-icon">
@@ -18282,18 +18298,32 @@ function showMapSelector(latitude, longitude) {
18282
18298
 
18283
18299
  optionsContainer.appendChild(optionElement);
18284
18300
  });
18285
-
18301
+ const label = crouton.localization.getWord('Remember my choice');
18302
+ const rememberChoiceElement = document.createElement('div');
18303
+ rememberChoiceElement.className = 'directions-remember-choice-div';
18304
+ rememberChoiceElement.innerHTML =
18305
+ `<input type="checkbox" id="rememberDirectionsChoice" name="rememberDirectionsChoice" value="1">
18306
+ <label for="rememberDirectionsChoice">`+label+`</label>`
18307
+ ;
18308
+ optionsContainer.appendChild(rememberChoiceElement);
18309
+ jQuery('html').on('click', '.directions-map-modal-close', closeDirectionsModal);
18286
18310
  // Show modal
18287
18311
  modal.style.display = 'block';
18288
18312
  }
18289
18313
 
18290
- function closeDirectionsMapModal() {
18291
- document.getElementById('directionsMapModal').style.display = 'none';
18314
+ function closeDirectionsModal() {
18315
+ const modal = document.getElementById('directionsMapModal');
18316
+ modal.style.display = 'none';
18317
+ if (modal.className.includes('remove-after-use')) modal.remove();
18292
18318
  }
18293
18319
 
18294
- function openMap(url) {
18320
+ function openDirections(url, latitude, longitude, fromModal = true) {
18321
+ const save = jQuery('#rememberDirectionsChoice');
18322
+ if (fromModal && save.length && save.is(":checked")) localStorage.setItem("croutonDirectionsURL", url);
18323
+ url = url.replaceAll('${latitude}', latitude);
18324
+ url = url.replaceAll('${longitude}', longitude);
18295
18325
  window.open(url, '_blank');
18296
- closeDirectionsMapModal();
18326
+ if (fromModal) closeDirectionsModal();
18297
18327
  }
18298
18328
 
18299
18329
  function MeetingMap(inConfig) {