@bmlt-enabled/croutonjs 3.22.2 → 3.22.3

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.css CHANGED
@@ -189,7 +189,7 @@ span.bmlt_tabs_group_count {
189
189
  color: #FFF;
190
190
  }
191
191
 
192
- #bmlt-tabs a#map-button,#bmlt-tabs a#share-button {
192
+ #bmlt-tabs a#map-button,#bmlt-tabs a#share-button,.bmlt-data-row button.get-directions-modal {
193
193
  margin-bottom: 4px;
194
194
  }
195
195
 
@@ -197,7 +197,7 @@ span.bmlt_tabs_group_count {
197
197
  margin: 4px 0;
198
198
  }
199
199
 
200
- #bmlt-formats.btn-xs,#map-button.btn-xs,#share-button.btn-xs {
200
+ #bmlt-formats.btn-xs,#map-button.btn-xs,#share-button.btn-xs,.bmlt-data-row button.get-directions-modal {
201
201
  padding: 3px 5px;
202
202
  font-size: 10px;
203
203
  background-color: #93C3CD;
@@ -205,7 +205,7 @@ span.bmlt_tabs_group_count {
205
205
  border-color: #C5C5C5;
206
206
  }
207
207
 
208
- #bmlt-formats.btn-xs:hover,#map-button.btn-xs:hover,#share-button.btn-xs:hover {
208
+ #bmlt-formats.btn-xs:hover,#map-button.btn-xs:hover,#share-button.btn-xs:hover,.bmlt-data-row button.get-directions-modal:hover {
209
209
  background-color: #F1F1F1;
210
210
  }
211
211
 
@@ -376,7 +376,7 @@ span.bmlt_tabs_group_count {
376
376
  width: 100% !important;
377
377
  }
378
378
 
379
- #bmlt-tabs a#bmlt-formats,#bmlt-tabs a#map-button {
379
+ #bmlt-tabs a#bmlt-formats,#bmlt-tabs a#map-button,.bmlt-data-row button.get-directions-modal {
380
380
  border-radius: 0;
381
381
  }
382
382
 
@@ -434,7 +434,7 @@ span.bmlt_tabs_group_count {
434
434
  font-size: 12px !important;
435
435
  }
436
436
 
437
- #map-button.btn-xs,#share-button.btn-xs {
437
+ #map-button.btn-xs,#share-button.btn-xs,.bmlt-data-row button.get-directions-modal {
438
438
  display: -webkit-inline-box;
439
439
  }
440
440
 
@@ -752,6 +752,9 @@ input#search_radius, input#search_count {
752
752
  font-size: 0.9em;
753
753
  color: #666;
754
754
  }
755
+ .directions-remember-choice-div {
756
+ margin-top: 20px;
757
+ }
755
758
 
756
759
  div.bmlt_map_container_div
757
760
  {
package/crouton.js CHANGED
@@ -13413,6 +13413,7 @@ function CroutonLocalization(language) {
13413
13413
  "google_maps_desc_mobile": "In Google Maps App öffnen",
13414
13414
  "waze": "Waze",
13415
13415
  "waze_desc": "In Waze App öffnen",
13416
+ "remember my choice": "Auswahl speichern",
13416
13417
  },
13417
13418
  "en-AU": {
13418
13419
  "days_of_the_week" : ["", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
@@ -14416,6 +14417,22 @@ this["hbs_Crouton"]["templates"]["byfield"] = Handlebars.template({"1":function(
14416
14417
  + ((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 : "")
14417
14418
  + " </table>\n</div>";
14418
14419
  },"usePartial":true,"useData":true});
14420
+ this["hbs_Crouton"]["templates"]["directionsButton"] = Handlebars.template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
14421
+ var alias1=container.lambda, alias2=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) {
14422
+ if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
14423
+ return parent[propertyName];
14424
+ }
14425
+ return undefined
14426
+ };
14427
+
14428
+ return " <div class=\"bootstrap-bmlt\">\n <button data-latitude=\""
14429
+ + alias2(alias1((depth0 != null ? lookupProperty(depth0,"latitude") : depth0), depth0))
14430
+ + "\" data-longitude=\""
14431
+ + alias2(alias1((depth0 != null ? lookupProperty(depth0,"longitude") : depth0), depth0))
14432
+ + "\" class=\"btn btn-primary bmlt-xs get-directions-modal\">\n <span class=\"glyphicon glyphicon-road\"></span> "
14433
+ + 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}}}))
14434
+ + "\n </button>\n </div>\n";
14435
+ },"useData":true});
14419
14436
  this["hbs_Crouton"]["templates"]["formatPopup"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
14420
14437
  var helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) {
14421
14438
  if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
@@ -15223,18 +15240,7 @@ var croutonDefaultTemplates = {
15223
15240
  <div class="location-text">{{{this.location_text}}}</div>
15224
15241
  <div class="meeting-address">{{this.formatted_address}}</div>
15225
15242
  <div class="location-information">{{{this.formatted_location_info}}}</div>
15226
- <div class="bootstrap-bmlt">
15227
- <button data-latitude="{{this.latitude}}" data-longitude="{{this.longitude}}" class="btn btn-primary bmlt-xs get-directions-modal">
15228
- <span class="glyphicon glyphicon-road"></span> {{getWord "get_directions"}}
15229
- </button>
15230
- </div>
15231
- <div id="directionsMapModal" class="directions-map-modal" style="display: none;">
15232
- <div class="directions-map-modal-content">
15233
- <span class="directions-map-modal-close">&times;</span>
15234
- <h3>{{getWord "select_map_app"}}</h3>
15235
- <div id="directionsMapOptions"></div>
15236
- </div>
15237
- </div>
15243
+ {{> directionsButton this}}
15238
15244
  <br/>
15239
15245
  {{/isInPersonOrHybrid}}
15240
15246
  {{#isVirtualOrHybrid this}}
@@ -16766,6 +16772,7 @@ function Crouton(config) {
16766
16772
  crouton_Handlebars.registerPartial('meetings', hbs_Crouton.templates['meetings']);
16767
16773
  crouton_Handlebars.registerPartial('bydays', hbs_Crouton.templates['byday']);
16768
16774
  crouton_Handlebars.registerPartial('formatPopup', hbs_Crouton.templates['formatPopup']);
16775
+ crouton_Handlebars.registerPartial('directionsButton', hbs_Crouton.templates['directionsButton']);
16769
16776
  window.crouton = self;
16770
16777
  croutonMap.initialize(self.createBmltMapElement(),self.meetingData,context,null,fitBounds,callback,self.config['noMap']);
16771
16778
  }
@@ -16803,6 +16810,7 @@ function Crouton(config) {
16803
16810
  crouton_Handlebars.registerPartial('header', hbs_Crouton.templates['header']);
16804
16811
  crouton_Handlebars.registerPartial('byfields', hbs_Crouton.templates['byfield']);
16805
16812
  crouton_Handlebars.registerPartial('formatPopup', hbs_Crouton.templates['formatPopup']);
16813
+ crouton_Handlebars.registerPartial('directionsButton', hbs_Crouton.templates['directionsButton']);
16806
16814
  var template = hbs_Crouton.templates['main'];
16807
16815
  jQuery(selector).html(template(context));
16808
16816
  callback();
@@ -17158,21 +17166,6 @@ function Crouton(config) {
17158
17166
  else self.meetingSearch();
17159
17167
  }
17160
17168
  else if (!window.croutonMap.hasMapSearch()) self.meetingSearch();
17161
-
17162
- jQuery('html').on('click', '.get-directions-modal', function (e) {
17163
- var lat = jQuery(this).data('latitude');
17164
- var lng = jQuery(this).data('longitude');
17165
-
17166
- if (isMobileDevice()) {
17167
- showMapSelector(lat, lng);
17168
- } else {
17169
- window.open(`https://www.google.com/maps/dir/?api=1&destination=${lat},${lng}`, '_blank');
17170
- }
17171
- });
17172
-
17173
- jQuery('html').on('click', '.directions-map-modal-close', function (e) {
17174
- closeDirectionsMapModal()
17175
- });
17176
17169
  }
17177
17170
 
17178
17171
  Crouton.prototype.setConfig = function(config) {
@@ -17289,7 +17282,7 @@ Crouton.prototype.doHandlebars = function() {
17289
17282
  self.handlebars(enrichedMeetingData[0], elements)
17290
17283
  });
17291
17284
  });
17292
-
17285
+ jQuery('.get-directions-modal').on('click', openDirectionsModal);
17293
17286
  };
17294
17287
 
17295
17288
  Crouton.prototype.meetingModal = function(meetingId) {
@@ -17303,10 +17296,10 @@ Crouton.prototype.meetingModal = function(meetingId) {
17303
17296
  span.textContent = self.config.meetingpage_frame_template;
17304
17297
  let meeting = self.meetingData.find((m) => m.id_bigint == meetingId);
17305
17298
  self.handlebars(meeting, tabs.getElementsByTagName('bmlt-handlebar'));
17306
-
17307
17299
  [...tabs.getElementsByClassName('modal-close')].forEach((elem)=>elem.addEventListener('click', (e)=>{croutonMap.closeModalWindow(e.target); document.getElementById('meeting_modal').remove()}));
17308
17300
  let mm = document.getElementById('meeting_modal');
17309
17301
  document.body.appendChild(mm);
17302
+ jQuery('#meeting_modal .get-directions-modal').on('click', openDirectionsModal);
17310
17303
  croutonMap.openModalWindow(mm, true);
17311
17304
  croutonMap.showMap(true);
17312
17305
  let visibleMeetings = jQuery('.bmlt-data-row:visible');
@@ -17667,7 +17660,12 @@ Crouton.prototype.render = function(doMeetingMap = false) {
17667
17660
  });
17668
17661
  jQuery('.meeting-group:not(.non-collapsable) .group-header').on('click', function(e) {
17669
17662
  jQuery(e.target.parentElement).toggleClass('closed');
17670
- })
17663
+ });
17664
+ jQuery('.get-directions-modal').on('click', openDirectionsModal);
17665
+
17666
+ jQuery('.directions-map-modal-close').on('click', function (e) {
17667
+ closeDirectionsMapModal()
17668
+ });
17671
17669
  /****
17672
17670
  jQuery('.custom-ul').on('click', 'a', function (event) {
17673
17671
  jQuery('.bmlt-page').each(function (index) {
@@ -17824,9 +17822,8 @@ function isMobileDevice() {
17824
17822
  return isIOSDevice() || isAndroidDevice() || /Mobi|Android/i.test(navigator.userAgent);
17825
17823
  }
17826
17824
 
17827
- function createMapOptions(latitude, longitude) {
17825
+ function createDirectionsOptions() {
17828
17826
  const options = [];
17829
- const isMobile = isMobileDevice();
17830
17827
  const isIOS = isIOSDevice();
17831
17828
 
17832
17829
  // Apple Maps (iOS only)
@@ -17835,7 +17832,7 @@ function createMapOptions(latitude, longitude) {
17835
17832
  name: crouton.localization.getWord('apple_maps'),
17836
17833
  description: crouton.localization.getWord('apple_maps_desc'),
17837
17834
  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",
17838
- url: `https://maps.apple.com/?daddr=${latitude},${longitude}`
17835
+ url: 'https://maps.apple.com/?daddr=${latitude},${longitude}'
17839
17836
  });
17840
17837
  }
17841
17838
 
@@ -17844,18 +17841,16 @@ function createMapOptions(latitude, longitude) {
17844
17841
  name: crouton.localization.getWord('google_maps'),
17845
17842
  description: crouton.localization.getWord('google_maps_desc_mobile'),
17846
17843
  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",
17847
- url: `https://www.google.com/maps/dir/?api=1&destination=${latitude},${longitude}`
17844
+ url: 'https://www.google.com/maps/dir/?api=1&destination=${latitude},${longitude}'
17848
17845
  });
17849
17846
 
17850
- // Waze (mobile devices)
17851
- if (isMobile) {
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
- });
17858
- }
17847
+ // Waze (always available)
17848
+ options.push({
17849
+ name: crouton.localization.getWord('waze'),
17850
+ description: crouton.localization.getWord('waze_desc'),
17851
+ 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",
17852
+ url: 'https://waze.com/ul?ll=${latitude},${longitude}&navigate=yes'
17853
+ });
17859
17854
 
17860
17855
  return options;
17861
17856
  }
@@ -18249,15 +18244,27 @@ function swipedetect(el, callback){
18249
18244
  }
18250
18245
  }, false)
18251
18246
  }
18247
+ function openDirectionsModal(e) {
18248
+ const latitude = jQuery(this).data('latitude');
18249
+ const longitude = jQuery(this).data('longitude');
18252
18250
 
18253
- function showMapSelector(latitude, longitude) {
18254
- // For desktop users, directly open Google Maps
18255
- if (!isMobileDevice()) {
18256
- window.open(`https://www.google.com/maps/dir/?api=1&destination=${latitude},${longitude}`, '_blank');
18251
+ const savedUrl = localStorage.getItem("croutonDirectionsURL");
18252
+ if (savedUrl && savedUrl != null) {
18253
+ openDirections(savedUrl, latitude, longitude, false);
18257
18254
  return;
18258
18255
  }
18259
-
18260
- // For mobile users, show the map selection modal
18256
+ if (!document.getElementById('directionsMapModal')) {
18257
+ const word = crouton.localization.getWord("select_map_app");
18258
+ e.target.insertAdjacentHTML("afterend",
18259
+ `<div id="directionsMapModal" class="directions-map-modal remove-after-use">
18260
+ <div class="directions-map-modal-content">
18261
+ <span class="directions-map-modal-close">×</span>
18262
+ <h3>`+word+`</h3>
18263
+ <div id="directionsMapOptions"></div>
18264
+ </div>
18265
+ </div>`
18266
+ );
18267
+ }
18261
18268
  const modal = document.getElementById('directionsMapModal');
18262
18269
  const optionsContainer = document.getElementById('directionsMapOptions');
18263
18270
 
@@ -18268,12 +18275,12 @@ function showMapSelector(latitude, longitude) {
18268
18275
 
18269
18276
  optionsContainer.innerHTML = '';
18270
18277
 
18271
- const options = createMapOptions(latitude, longitude);
18278
+ const options = createDirectionsOptions();
18272
18279
 
18273
18280
  options.forEach(option => {
18274
18281
  const optionElement = document.createElement('div');
18275
18282
  optionElement.className = 'directions-map-option';
18276
- optionElement.onclick = () => openMap(option.url);
18283
+ optionElement.onclick = () => openDirections(option.url, latitude, longitude);
18277
18284
 
18278
18285
  optionElement.innerHTML = `
18279
18286
  <img src="${option.icon}" alt="${option.name}" class="directions-map-option-icon">
@@ -18285,18 +18292,32 @@ function showMapSelector(latitude, longitude) {
18285
18292
 
18286
18293
  optionsContainer.appendChild(optionElement);
18287
18294
  });
18288
-
18295
+ const label = crouton.localization.getWord('Remember my choice');
18296
+ const rememberChoiceElement = document.createElement('div');
18297
+ rememberChoiceElement.className = 'directions-remember-choice-div';
18298
+ rememberChoiceElement.innerHTML =
18299
+ `<input type="checkbox" id="rememberDirectionsChoice" name="rememberDirectionsChoice" value="1">
18300
+ <label for="rememberDirectionsChoice">`+label+`</label>`
18301
+ ;
18302
+ optionsContainer.appendChild(rememberChoiceElement);
18303
+ jQuery('html').on('click', '.directions-map-modal-close', closeDirectionsModal);
18289
18304
  // Show modal
18290
18305
  modal.style.display = 'block';
18291
18306
  }
18292
18307
 
18293
- function closeDirectionsMapModal() {
18294
- document.getElementById('directionsMapModal').style.display = 'none';
18308
+ function closeDirectionsModal() {
18309
+ const modal = document.getElementById('directionsMapModal');
18310
+ modal.style.display = 'none';
18311
+ if (modal.className.includes('remove-after-use')) modal.remove();
18295
18312
  }
18296
18313
 
18297
- function openMap(url) {
18314
+ function openDirections(url, latitude, longitude, fromModal = true) {
18315
+ const save = jQuery('#rememberDirectionsChoice');
18316
+ if (fromModal && save.length && save.is(":checked")) localStorage.setItem("croutonDirectionsURL", url);
18317
+ url = url.replaceAll('${latitude}', latitude);
18318
+ url = url.replaceAll('${longitude}', longitude);
18298
18319
  window.open(url, '_blank');
18299
- closeDirectionsMapModal();
18320
+ if (fromModal) closeDirectionsModal();
18300
18321
  }
18301
18322
 
18302
18323
  function MeetingMap(inConfig) {