@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.
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)) {
@@ -14832,6 +14849,20 @@ this["hbs_Crouton"]["templates"]["mapSearch"] = Handlebars.template({"1":functio
14832
14849
  + 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}}}))
14833
14850
  + "</button>\n </div>\n </div>\n</div>";
14834
14851
  },"useData":true});
14852
+ this["hbs_Crouton"]["templates"]["meetingDetailsButton"] = Handlebars.template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
14853
+ var alias1=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) {
14854
+ if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
14855
+ return parent[propertyName];
14856
+ }
14857
+ return undefined
14858
+ };
14859
+
14860
+ return " <div>\n <a onclick='crouton.meetingModal("
14861
+ + alias1(container.lambda((depth0 != null ? lookupProperty(depth0,"id_bigint") : depth0), depth0))
14862
+ + ")' tabindex='0' href='#' id='map-button' class='btn btn-primary btn-xs'>\n <span class='glyphicon glyphicon-search' aria-hidden='true'></span>\n "
14863
+ + 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}}}))
14864
+ + "\n </a>\n </div>\n";
14865
+ },"useData":true});
14835
14866
  this["hbs_Crouton"]["templates"]["meetings"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
14836
14867
  var stack1, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3=container.escapeExpression, alias4=container.lambda, lookupProperty = container.lookupProperty || function(parent, propertyName) {
14837
14868
  if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
@@ -15147,12 +15178,7 @@ var croutonDefaultTemplates = {
15147
15178
  "{{/isVirtualOrHybrid}}",
15148
15179
  "{{#isNotTemporarilyClosed this}}",
15149
15180
  " {{#unless (hasFormats 'VM' this)}}",
15150
- " <div>",
15151
- " <a onclick='crouton.meetingModal({{this.id_bigint}})' tabindex='0' href='#' id='map-button' class='btn btn-primary btn-xs'>",
15152
- " <span class='glyphicon glyphicon-search' aria-hidden='true'></span>",
15153
- " {{getWord 'meeting details'}}",
15154
- " </a>",
15155
- " </div>",
15181
+ " {{> meetingDetailsButton this}}",
15156
15182
  " {{/unless}}",
15157
15183
  "{{/isNotTemporarilyClosed}}"
15158
15184
  ].join('\n'),
@@ -15223,18 +15249,7 @@ var croutonDefaultTemplates = {
15223
15249
  <div class="location-text">{{{this.location_text}}}</div>
15224
15250
  <div class="meeting-address">{{this.formatted_address}}</div>
15225
15251
  <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>
15252
+ {{> directionsButton this}}
15238
15253
  <br/>
15239
15254
  {{/isInPersonOrHybrid}}
15240
15255
  {{#isVirtualOrHybrid this}}
@@ -17158,21 +17173,6 @@ function Crouton(config) {
17158
17173
  else self.meetingSearch();
17159
17174
  }
17160
17175
  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
17176
  }
17177
17177
 
17178
17178
  Crouton.prototype.setConfig = function(config) {
@@ -17286,10 +17286,10 @@ Crouton.prototype.doHandlebars = function() {
17286
17286
  var customEnrichTemplate = crouton_Handlebars.compile('{{enrich this}}');
17287
17287
  customEnrichTemplate(enrichedMeetingData[0]);
17288
17288
 
17289
- self.handlebars(enrichedMeetingData[0], elements)
17289
+ self.handlebars(enrichedMeetingData[0], elements);
17290
+ jQuery('.get-directions-modal').on('click', openDirectionsModal);
17290
17291
  });
17291
17292
  });
17292
-
17293
17293
  };
17294
17294
 
17295
17295
  Crouton.prototype.meetingModal = function(meetingId) {
@@ -17303,10 +17303,10 @@ Crouton.prototype.meetingModal = function(meetingId) {
17303
17303
  span.textContent = self.config.meetingpage_frame_template;
17304
17304
  let meeting = self.meetingData.find((m) => m.id_bigint == meetingId);
17305
17305
  self.handlebars(meeting, tabs.getElementsByTagName('bmlt-handlebar'));
17306
-
17307
17306
  [...tabs.getElementsByClassName('modal-close')].forEach((elem)=>elem.addEventListener('click', (e)=>{croutonMap.closeModalWindow(e.target); document.getElementById('meeting_modal').remove()}));
17308
17307
  let mm = document.getElementById('meeting_modal');
17309
17308
  document.body.appendChild(mm);
17309
+ jQuery('#meeting_modal .get-directions-modal').on('click', openDirectionsModal);
17310
17310
  croutonMap.openModalWindow(mm, true);
17311
17311
  croutonMap.showMap(true);
17312
17312
  let visibleMeetings = jQuery('.bmlt-data-row:visible');
@@ -17667,7 +17667,12 @@ Crouton.prototype.render = function(doMeetingMap = false) {
17667
17667
  });
17668
17668
  jQuery('.meeting-group:not(.non-collapsable) .group-header').on('click', function(e) {
17669
17669
  jQuery(e.target.parentElement).toggleClass('closed');
17670
- })
17670
+ });
17671
+ jQuery('.get-directions-modal').on('click', openDirectionsModal);
17672
+
17673
+ jQuery('.directions-map-modal-close').on('click', function (e) {
17674
+ closeDirectionsMapModal()
17675
+ });
17671
17676
  /****
17672
17677
  jQuery('.custom-ul').on('click', 'a', function (event) {
17673
17678
  jQuery('.bmlt-page').each(function (index) {
@@ -17824,9 +17829,8 @@ function isMobileDevice() {
17824
17829
  return isIOSDevice() || isAndroidDevice() || /Mobi|Android/i.test(navigator.userAgent);
17825
17830
  }
17826
17831
 
17827
- function createMapOptions(latitude, longitude) {
17832
+ function createDirectionsOptions() {
17828
17833
  const options = [];
17829
- const isMobile = isMobileDevice();
17830
17834
  const isIOS = isIOSDevice();
17831
17835
 
17832
17836
  // Apple Maps (iOS only)
@@ -17835,7 +17839,7 @@ function createMapOptions(latitude, longitude) {
17835
17839
  name: crouton.localization.getWord('apple_maps'),
17836
17840
  description: crouton.localization.getWord('apple_maps_desc'),
17837
17841
  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}`
17842
+ url: 'https://maps.apple.com/?daddr=${latitude},${longitude}'
17839
17843
  });
17840
17844
  }
17841
17845
 
@@ -17844,18 +17848,16 @@ function createMapOptions(latitude, longitude) {
17844
17848
  name: crouton.localization.getWord('google_maps'),
17845
17849
  description: crouton.localization.getWord('google_maps_desc_mobile'),
17846
17850
  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}`
17851
+ url: 'https://www.google.com/maps/dir/?api=1&destination=${latitude},${longitude}'
17848
17852
  });
17849
17853
 
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
- }
17854
+ // Waze (always available)
17855
+ options.push({
17856
+ name: crouton.localization.getWord('waze'),
17857
+ description: crouton.localization.getWord('waze_desc'),
17858
+ 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",
17859
+ url: 'https://waze.com/ul?ll=${latitude},${longitude}&navigate=yes'
17860
+ });
17859
17861
 
17860
17862
  return options;
17861
17863
  }
@@ -18034,6 +18036,8 @@ crouton_Handlebars.registerPartial('icsButton',
18034
18036
  '<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>');
18035
18037
  crouton_Handlebars.registerPartial('offerIcsButton',
18036
18038
  "{{#if (hasBMLT2ics)}}{{> icsButton}}<br/>{{/if}}");
18039
+ crouton_Handlebars.registerPartial('directionsButton', hbs_Crouton.templates['directionsButton']);
18040
+ crouton_Handlebars.registerPartial('meetingDetailsButton', hbs_Crouton.templates['meetingDetailsButton']);
18037
18041
  function convertToPunyCode(str) {
18038
18042
  return str !== undefined ? punycode.toASCII(str.toLowerCase()).replace(/\W|_/g, "-") : "";
18039
18043
  }
@@ -18249,15 +18253,27 @@ function swipedetect(el, callback){
18249
18253
  }
18250
18254
  }, false)
18251
18255
  }
18256
+ function openDirectionsModal(e) {
18257
+ const latitude = jQuery(this).data('latitude');
18258
+ const longitude = jQuery(this).data('longitude');
18252
18259
 
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');
18260
+ const savedUrl = localStorage.getItem("croutonDirectionsURL");
18261
+ if (savedUrl && savedUrl != null) {
18262
+ openDirections(savedUrl, latitude, longitude, false);
18257
18263
  return;
18258
18264
  }
18259
-
18260
- // For mobile users, show the map selection modal
18265
+ if (!document.getElementById('directionsMapModal')) {
18266
+ const word = crouton.localization.getWord("select_map_app");
18267
+ e.target.insertAdjacentHTML("afterend",
18268
+ `<div id="directionsMapModal" class="directions-map-modal remove-after-use">
18269
+ <div class="directions-map-modal-content">
18270
+ <span class="directions-map-modal-close">×</span>
18271
+ <h3>`+word+`</h3>
18272
+ <div id="directionsMapOptions"></div>
18273
+ </div>
18274
+ </div>`
18275
+ );
18276
+ }
18261
18277
  const modal = document.getElementById('directionsMapModal');
18262
18278
  const optionsContainer = document.getElementById('directionsMapOptions');
18263
18279
 
@@ -18268,12 +18284,12 @@ function showMapSelector(latitude, longitude) {
18268
18284
 
18269
18285
  optionsContainer.innerHTML = '';
18270
18286
 
18271
- const options = createMapOptions(latitude, longitude);
18287
+ const options = createDirectionsOptions();
18272
18288
 
18273
18289
  options.forEach(option => {
18274
18290
  const optionElement = document.createElement('div');
18275
18291
  optionElement.className = 'directions-map-option';
18276
- optionElement.onclick = () => openMap(option.url);
18292
+ optionElement.onclick = () => openDirections(option.url, latitude, longitude);
18277
18293
 
18278
18294
  optionElement.innerHTML = `
18279
18295
  <img src="${option.icon}" alt="${option.name}" class="directions-map-option-icon">
@@ -18285,18 +18301,32 @@ function showMapSelector(latitude, longitude) {
18285
18301
 
18286
18302
  optionsContainer.appendChild(optionElement);
18287
18303
  });
18288
-
18304
+ const label = crouton.localization.getWord('Remember my choice');
18305
+ const rememberChoiceElement = document.createElement('div');
18306
+ rememberChoiceElement.className = 'directions-remember-choice-div';
18307
+ rememberChoiceElement.innerHTML =
18308
+ `<input type="checkbox" id="rememberDirectionsChoice" name="rememberDirectionsChoice" value="1">
18309
+ <label for="rememberDirectionsChoice">`+label+`</label>`
18310
+ ;
18311
+ optionsContainer.appendChild(rememberChoiceElement);
18312
+ jQuery('html').on('click', '.directions-map-modal-close', closeDirectionsModal);
18289
18313
  // Show modal
18290
18314
  modal.style.display = 'block';
18291
18315
  }
18292
18316
 
18293
- function closeDirectionsMapModal() {
18294
- document.getElementById('directionsMapModal').style.display = 'none';
18317
+ function closeDirectionsModal() {
18318
+ const modal = document.getElementById('directionsMapModal');
18319
+ modal.style.display = 'none';
18320
+ if (modal.className.includes('remove-after-use')) modal.remove();
18295
18321
  }
18296
18322
 
18297
- function openMap(url) {
18323
+ function openDirections(url, latitude, longitude, fromModal = true) {
18324
+ const save = jQuery('#rememberDirectionsChoice');
18325
+ if (fromModal && save.length && save.is(":checked")) localStorage.setItem("croutonDirectionsURL", url);
18326
+ url = url.replaceAll('${latitude}', latitude);
18327
+ url = url.replaceAll('${longitude}', longitude);
18298
18328
  window.open(url, '_blank');
18299
- closeDirectionsMapModal();
18329
+ if (fromModal) closeDirectionsModal();
18300
18330
  }
18301
18331
 
18302
18332
  function MeetingMap(inConfig) {