add-to-calendar-button 2.5.1 → 2.5.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.
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * Style: 3D
7
7
  *
8
- * Version: 2.5.1
8
+ * Version: 2.5.2
9
9
  * Creator: Jens Kuerschner (https://jenskuerschner.de)
10
10
  * Project: https://github.com/add2cal/add-to-calendar-button
11
11
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * Style: Date
7
7
  *
8
- * Version: 2.5.1
8
+ * Version: 2.5.2
9
9
  * Creator: Jens Kuerschner (https://jenskuerschner.de)
10
10
  * Project: https://github.com/add2cal/add-to-calendar-button
11
11
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * Style: Flat
7
7
  *
8
- * Version: 2.5.1
8
+ * Version: 2.5.2
9
9
  * Creator: Jens Kuerschner (https://jenskuerschner.de)
10
10
  * Project: https://github.com/add2cal/add-to-calendar-button
11
11
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * Style: Neumorphism
7
7
  *
8
- * Version: 2.5.1
8
+ * Version: 2.5.2
9
9
  * Creator: Jens Kuerschner (https://jenskuerschner.de)
10
10
  * Project: https://github.com/add2cal/add-to-calendar-button
11
11
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * Style: Round
7
7
  *
8
- * Version: 2.5.1
8
+ * Version: 2.5.2
9
9
  * Creator: Jens Kuerschner (https://jenskuerschner.de)
10
10
  * Project: https://github.com/add2cal/add-to-calendar-button
11
11
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * Style: Text
7
7
  *
8
- * Version: 2.5.1
8
+ * Version: 2.5.2
9
9
  * Creator: Jens Kuerschner (https://jenskuerschner.de)
10
10
  * Project: https://github.com/add2cal/add-to-calendar-button
11
11
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * Style: Default
7
7
  *
8
- * Version: 2.5.1
8
+ * Version: 2.5.2
9
9
  * Creator: Jens Kuerschner (https://jenskuerschner.de)
10
10
  * Project: https://github.com/add2cal/add-to-calendar-button
11
11
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
@@ -977,14 +977,14 @@ function tzlib_get_timezones(jsonType = false) {
977
977
  * Add to Calendar Button
978
978
  * ++++++++++++++++++++++
979
979
  *
980
- * Version: 2.5.1
980
+ * Version: 2.5.2
981
981
  * Creator: Jens Kuerschner (https://jenskuerschner.de)
982
982
  * Project: https://github.com/add2cal/add-to-calendar-button
983
983
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
984
984
  * Note: DO NOT REMOVE THE COPYRIGHT NOTICE ABOVE!
985
985
  *
986
986
  */
987
- const atcbVersion = '2.5.1';
987
+ const atcbVersion = '2.5.2';
988
988
  const atcbCssTemplate = {};
989
989
  const atcbIsBrowser = () => {
990
990
  if (typeof window === 'undefined') {
@@ -1998,7 +1998,7 @@ function atcb_toggle(host, action, data = '', button = null, keyboardTrigger = f
1998
1998
  atcb_open(host, data, button, keyboardTrigger, generatedButton);
1999
1999
  }
2000
2000
  }
2001
- function atcb_open(host, data, button = null, keyboardTrigger = false, generatedButton = false) {
2001
+ async function atcb_open(host, data, button = null, keyboardTrigger = false, generatedButton = false) {
2002
2002
  if (host.querySelector('.atcb-list') || host.querySelector('.atcb-modal')) return;
2003
2003
  atcb_log_event('openList', data.identifier, data.identifier);
2004
2004
  atcbStates['active'] = data.identifier;
@@ -2029,7 +2029,7 @@ function atcb_open(host, data, button = null, keyboardTrigger = false, generated
2029
2029
  }
2030
2030
  const bgOverlay = atcb_generate_bg_overlay(host, data.trigger, data.listStyle === 'modal', !data.hideBackground);
2031
2031
  if (data.listStyle === 'modal') {
2032
- const modalHost = atcb_generate_modal_host(host, data);
2032
+ const modalHost = await atcb_generate_modal_host(host, data);
2033
2033
  modalHost.querySelector('.atcb-modal-host-initialized').append(bgOverlay);
2034
2034
  bgOverlay.append(list);
2035
2035
  if (!data.hideBranding) {
@@ -2481,9 +2481,9 @@ function atcb_create_atcbl(host, atList = true, returnEl = false) {
2481
2481
  }
2482
2482
  }
2483
2483
  }
2484
- function atcb_create_modal(host, data, icon = '', headline, content = '', buttons = [], subEvents = [], keyboardTrigger = false, goto = {}, closable = true) {
2484
+ async function atcb_create_modal(host, data, icon = '', headline, content = '', buttons = [], subEvents = [], keyboardTrigger = false, goto = {}, closable = true) {
2485
2485
  atcbStates['active'] = data.identifier;
2486
- const modalHost = atcb_generate_modal_host(host, data, false);
2486
+ const modalHost = await atcb_generate_modal_host(host, data, false);
2487
2487
  const bgOverlay = (function () {
2488
2488
  const el = modalHost.getElementById('atcb-bgoverlay');
2489
2489
  if (!el) {
@@ -2659,7 +2659,7 @@ function atcb_create_modal(host, data, icon = '', headline, content = '', button
2659
2659
  });
2660
2660
  if (modalCount > 1) {
2661
2661
  const prevModal = modalHost.querySelector('.atcb-modal[data-modal-nr="' + (modalCount - 1) + '"]');
2662
- prevModal.style.display = 'none';
2662
+ prevModal.classList.add('atcb-hidden');
2663
2663
  }
2664
2664
  atcb_manage_body_scroll(modalHost, modalWrapper);
2665
2665
  }
@@ -2814,7 +2814,7 @@ function atcb_generate_date_button(data, parent, subEvent = 'all') {
2814
2814
  parent.append(btnCheck);
2815
2815
  }
2816
2816
  }
2817
- function atcb_generate_modal_host(host, data, reset = true) {
2817
+ async function atcb_generate_modal_host(host, data, reset = true) {
2818
2818
  const existingModalHost = document.getElementById(data.identifier + '-modal-host');
2819
2819
  if (!reset && existingModalHost) {
2820
2820
  return existingModalHost.shadowRoot;
@@ -2824,12 +2824,6 @@ function atcb_generate_modal_host(host, data, reset = true) {
2824
2824
  }
2825
2825
  let newModalHost = document.createElement('div');
2826
2826
  newModalHost.id = data.identifier + '-modal-host';
2827
- if (data.styleLight) {
2828
- newModalHost.setAttribute('styleLight', data.styleLight);
2829
- }
2830
- if (data.styleDark) {
2831
- newModalHost.setAttribute('styleDark', data.styleDark);
2832
- }
2833
2827
  if (host.host.hasAttribute('cspnonce')) {
2834
2828
  newModalHost.setAttribute('cspnonce', host.host.getAttribute('cspnonce'));
2835
2829
  }
@@ -2838,14 +2832,14 @@ function atcb_generate_modal_host(host, data, reset = true) {
2838
2832
  document.body.append(newModalHost);
2839
2833
  newModalHost.attachShadow({ mode: 'open', delegateFocus: true });
2840
2834
  const elem = document.createElement('template');
2841
- elem.innerHTML = '<div class="atcb-modal-host-initialized" style="translate3D(0, 0, 0);visibility:visible;opacity:1;position:fixed;top:0;left:0;width:100%;height:100%;display:flex;z-index:13999999;"></div>';
2835
+ elem.innerHTML = '<div class="atcb-modal-host-initialized" style="transform:translate3D(0, 0, 0);visibility:visible;opacity:1;position:fixed;top:0;left:0;width:100%;height:100%;display:flex;z-index:13999999;"></div>';
2842
2836
  newModalHost.shadowRoot.append(elem.content.cloneNode(true));
2843
2837
  atcb_set_light_mode(newModalHost.shadowRoot, data);
2844
- atcb_load_css(newModalHost.shadowRoot, null, data);
2838
+ await atcb_load_css(newModalHost.shadowRoot, null, data);
2845
2839
  return newModalHost.shadowRoot;
2846
2840
  }
2847
- function atcb_generate_overlay_dom(host, data) {
2848
- const newHost = atcb_generate_modal_host(host, data);
2841
+ async function atcb_generate_overlay_dom(host, data) {
2842
+ const newHost = await atcb_generate_modal_host(host, data);
2849
2843
  atcb_set_fullsize(newHost.querySelector('.atcb-modal-host-initialized'));
2850
2844
  const nodes = Array.from(host.children);
2851
2845
  nodes.forEach((node) => {
@@ -3634,7 +3628,8 @@ function atcb_format_datetime(datetime, style = 'delimiters', includeTime = true
3634
3628
  }
3635
3629
  function atcb_generate_timestring(dates, language = 'en', subEvent = 'all', decorate = false, browserTimeOverride = false, enforceYear = false, hideTimeZone = false) {
3636
3630
  if (decorate) {
3637
- dates = atcb_decorate_data_dates({ dates: dates }).dates;
3631
+ const tmpRootTZ = atcb_decorate_data_timezone();
3632
+ dates = atcb_decorate_data_dates({ dates: dates, timeZone: tmpRootTZ }).dates;
3638
3633
  }
3639
3634
  let startDateInfo, endDateInfo, timeZoneInfoStart, timeZoneInfoEnd;
3640
3635
  let formattedTimeStart = {};
@@ -5210,7 +5205,7 @@ function atcb_csp_nonce(host) {
5210
5205
  }
5211
5206
  return host.host.getAttribute('cspnonce');
5212
5207
  }
5213
- function atcb_load_css(host, rootObj = null, data) {
5208
+ async function atcb_load_css(host, rootObj = null, data) {
5214
5209
  const nonceVal = atcb_csp_nonce(host);
5215
5210
  if (!document.getElementById('atcb-global-style')) {
5216
5211
  const cssGlobalContent = document.createElement('style');
@@ -5249,9 +5244,8 @@ function atcb_load_css(host, rootObj = null, data) {
5249
5244
  if (nonceVal) {
5250
5245
  cssFile.setAttribute('nonce', nonceVal);
5251
5246
  }
5252
- if (rootObj == null) {
5253
- host.host.style.display = 'none';
5254
- loadExternalCssAsynch(cssFile, host, host.host, nonceVal);
5247
+ if (!rootObj) {
5248
+ await loadExternalCssAsynch(cssFile, host, null, nonceVal, null, false, false, overrideDefaultCss + overrideDarkCss);
5255
5249
  } else {
5256
5250
  const placeholder = document.createElement('div');
5257
5251
  placeholder.classList.add('atcb-placeholder');
@@ -5266,7 +5260,7 @@ function atcb_load_css(host, rootObj = null, data) {
5266
5260
  }
5267
5261
  return;
5268
5262
  }
5269
- if (data.buttonStyle !== 'none' && atcbCssTemplate[`${data.buttonStyle}`] != null) {
5263
+ if (data.buttonStyle !== 'none' && atcbCssTemplate[`${data.buttonStyle}`]) {
5270
5264
  const cssContent = document.createElement('style');
5271
5265
  if (nonceVal) {
5272
5266
  cssContent.setAttribute('nonce', nonceVal);
@@ -5274,7 +5268,7 @@ function atcb_load_css(host, rootObj = null, data) {
5274
5268
  cssContent.innerText = atcbCssTemplate[`${data.buttonStyle}`] + overrideDefaultCss + overrideDarkCss;
5275
5269
  host.prepend(cssContent);
5276
5270
  }
5277
- if (rootObj != null) {
5271
+ if (rootObj) {
5278
5272
  if (data.inline) {
5279
5273
  rootObj.style.display = 'inline-block';
5280
5274
  rootObj.classList.add('atcb-inline');
@@ -5286,7 +5280,7 @@ function atcb_load_css(host, rootObj = null, data) {
5286
5280
  rootObj.classList.remove('atcb-hidden');
5287
5281
  }
5288
5282
  }
5289
- async function loadExternalCssAsynch(cssFile, host, rootObj, nonceVal = null, placeholder = null, inline = false, buttonsList = false, overrideCss = '') {
5283
+ async function loadExternalCssAsynch(cssFile, host, rootObj = null, nonceVal = null, placeholder = null, inline = false, buttonsList = false, overrideCss = '') {
5290
5284
  if (overrideCss !== '') {
5291
5285
  const cssContent = document.createElement('style');
5292
5286
  cssContent.innerText = overrideCss;
@@ -5300,18 +5294,20 @@ async function loadExternalCssAsynch(cssFile, host, rootObj, nonceVal = null, pl
5300
5294
  await new Promise((resolve) => {
5301
5295
  cssFile.onload = resolve;
5302
5296
  });
5303
- if (placeholder) {
5304
- placeholder.remove();
5305
- }
5306
- if (inline) {
5307
- rootObj.style.display = 'inline-block';
5308
- rootObj.classList.add('atcb-inline');
5309
- } else {
5310
- if (buttonsList) {
5311
- rootObj.classList.add('atcb-buttons-list');
5297
+ if (rootObj) {
5298
+ if (placeholder) {
5299
+ placeholder.remove();
5312
5300
  }
5301
+ if (inline) {
5302
+ rootObj.style.display = 'inline-block';
5303
+ rootObj.classList.add('atcb-inline');
5304
+ } else {
5305
+ if (buttonsList) {
5306
+ rootObj.classList.add('atcb-buttons-list');
5307
+ }
5308
+ }
5309
+ rootObj.classList.remove('atcb-hidden');
5313
5310
  }
5314
- rootObj.classList.remove('atcb-hidden');
5315
5311
  } catch (e) {
5316
5312
  console.log(e);
5317
5313
  }
@@ -977,14 +977,14 @@ function tzlib_get_timezones(jsonType = false) {
977
977
  * Add to Calendar Button
978
978
  * ++++++++++++++++++++++
979
979
  *
980
- * Version: 2.5.1
980
+ * Version: 2.5.2
981
981
  * Creator: Jens Kuerschner (https://jenskuerschner.de)
982
982
  * Project: https://github.com/add2cal/add-to-calendar-button
983
983
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
984
984
  * Note: DO NOT REMOVE THE COPYRIGHT NOTICE ABOVE!
985
985
  *
986
986
  */
987
- const atcbVersion = '2.5.1';
987
+ const atcbVersion = '2.5.2';
988
988
  const atcbCssTemplate = {
989
989
  if (typeof window === 'undefined') {
990
990
  return false;
@@ -1997,7 +1997,7 @@ function atcb_toggle(host, action, data = '', button = null, keyboardTrigger = f
1997
1997
  atcb_open(host, data, button, keyboardTrigger, generatedButton);
1998
1998
  }
1999
1999
  }
2000
- function atcb_open(host, data, button = null, keyboardTrigger = false, generatedButton = false) {
2000
+ async function atcb_open(host, data, button = null, keyboardTrigger = false, generatedButton = false) {
2001
2001
  if (host.querySelector('.atcb-list') || host.querySelector('.atcb-modal')) return;
2002
2002
  atcb_log_event('openList', data.identifier, data.identifier);
2003
2003
  atcbStates['active'] = data.identifier;
@@ -2028,7 +2028,7 @@ function atcb_open(host, data, button = null, keyboardTrigger = false, generated
2028
2028
  }
2029
2029
  const bgOverlay = atcb_generate_bg_overlay(host, data.trigger, data.listStyle === 'modal', !data.hideBackground);
2030
2030
  if (data.listStyle === 'modal') {
2031
- const modalHost = atcb_generate_modal_host(host, data);
2031
+ const modalHost = await atcb_generate_modal_host(host, data);
2032
2032
  modalHost.querySelector('.atcb-modal-host-initialized').append(bgOverlay);
2033
2033
  bgOverlay.append(list);
2034
2034
  if (!data.hideBranding) {
@@ -2480,9 +2480,9 @@ function atcb_create_atcbl(host, atList = true, returnEl = false) {
2480
2480
  }
2481
2481
  }
2482
2482
  }
2483
- function atcb_create_modal(host, data, icon = '', headline, content = '', buttons = [], subEvents = [], keyboardTrigger = false, goto = {}, closable = true) {
2483
+ async function atcb_create_modal(host, data, icon = '', headline, content = '', buttons = [], subEvents = [], keyboardTrigger = false, goto = {}, closable = true) {
2484
2484
  atcbStates['active'] = data.identifier;
2485
- const modalHost = atcb_generate_modal_host(host, data, false);
2485
+ const modalHost = await atcb_generate_modal_host(host, data, false);
2486
2486
  const bgOverlay = (function () {
2487
2487
  const el = modalHost.getElementById('atcb-bgoverlay');
2488
2488
  if (!el) {
@@ -2658,7 +2658,7 @@ function atcb_create_modal(host, data, icon = '', headline, content = '', button
2658
2658
  });
2659
2659
  if (modalCount > 1) {
2660
2660
  const prevModal = modalHost.querySelector('.atcb-modal[data-modal-nr="' + (modalCount - 1) + '"]');
2661
- prevModal.style.display = 'none';
2661
+ prevModal.classList.add('atcb-hidden');
2662
2662
  }
2663
2663
  atcb_manage_body_scroll(modalHost, modalWrapper);
2664
2664
  }
@@ -2813,7 +2813,7 @@ function atcb_generate_date_button(data, parent, subEvent = 'all') {
2813
2813
  parent.append(btnCheck);
2814
2814
  }
2815
2815
  }
2816
- function atcb_generate_modal_host(host, data, reset = true) {
2816
+ async function atcb_generate_modal_host(host, data, reset = true) {
2817
2817
  const existingModalHost = document.getElementById(data.identifier + '-modal-host');
2818
2818
  if (!reset && existingModalHost) {
2819
2819
  return existingModalHost.shadowRoot;
@@ -2823,12 +2823,6 @@ function atcb_generate_modal_host(host, data, reset = true) {
2823
2823
  }
2824
2824
  let newModalHost = document.createElement('div');
2825
2825
  newModalHost.id = data.identifier + '-modal-host';
2826
- if (data.styleLight) {
2827
- newModalHost.setAttribute('styleLight', data.styleLight);
2828
- }
2829
- if (data.styleDark) {
2830
- newModalHost.setAttribute('styleDark', data.styleDark);
2831
- }
2832
2826
  if (host.host.hasAttribute('cspnonce')) {
2833
2827
  newModalHost.setAttribute('cspnonce', host.host.getAttribute('cspnonce'));
2834
2828
  }
@@ -2837,14 +2831,14 @@ function atcb_generate_modal_host(host, data, reset = true) {
2837
2831
  document.body.append(newModalHost);
2838
2832
  newModalHost.attachShadow({ mode: 'open', delegateFocus: true });
2839
2833
  const elem = document.createElement('template');
2840
- elem.innerHTML = '<div class="atcb-modal-host-initialized" style="translate3D(0, 0, 0);visibility:visible;opacity:1;position:fixed;top:0;left:0;width:100%;height:100%;display:flex;z-index:13999999;"></div>';
2834
+ elem.innerHTML = '<div class="atcb-modal-host-initialized" style="transform:translate3D(0, 0, 0);visibility:visible;opacity:1;position:fixed;top:0;left:0;width:100%;height:100%;display:flex;z-index:13999999;"></div>';
2841
2835
  newModalHost.shadowRoot.append(elem.content.cloneNode(true));
2842
2836
  atcb_set_light_mode(newModalHost.shadowRoot, data);
2843
- atcb_load_css(newModalHost.shadowRoot, null, data);
2837
+ await atcb_load_css(newModalHost.shadowRoot, null, data);
2844
2838
  return newModalHost.shadowRoot;
2845
2839
  }
2846
- function atcb_generate_overlay_dom(host, data) {
2847
- const newHost = atcb_generate_modal_host(host, data);
2840
+ async function atcb_generate_overlay_dom(host, data) {
2841
+ const newHost = await atcb_generate_modal_host(host, data);
2848
2842
  atcb_set_fullsize(newHost.querySelector('.atcb-modal-host-initialized'));
2849
2843
  const nodes = Array.from(host.children);
2850
2844
  nodes.forEach((node) => {
@@ -3633,7 +3627,8 @@ function atcb_format_datetime(datetime, style = 'delimiters', includeTime = true
3633
3627
  }
3634
3628
  function atcb_generate_timestring(dates, language = 'en', subEvent = 'all', decorate = false, browserTimeOverride = false, enforceYear = false, hideTimeZone = false) {
3635
3629
  if (decorate) {
3636
- dates = atcb_decorate_data_dates({ dates: dates }).dates;
3630
+ const tmpRootTZ = atcb_decorate_data_timezone();
3631
+ dates = atcb_decorate_data_dates({ dates: dates, timeZone: tmpRootTZ }).dates;
3637
3632
  }
3638
3633
  let startDateInfo, endDateInfo, timeZoneInfoStart, timeZoneInfoEnd;
3639
3634
  let formattedTimeStart = {};
@@ -5209,7 +5204,7 @@ function atcb_csp_nonce(host) {
5209
5204
  }
5210
5205
  return host.host.getAttribute('cspnonce');
5211
5206
  }
5212
- function atcb_load_css(host, rootObj = null, data) {
5207
+ async function atcb_load_css(host, rootObj = null, data) {
5213
5208
  const nonceVal = atcb_csp_nonce(host);
5214
5209
  if (!document.getElementById('atcb-global-style')) {
5215
5210
  const cssGlobalContent = document.createElement('style');
@@ -5248,9 +5243,8 @@ function atcb_load_css(host, rootObj = null, data) {
5248
5243
  if (nonceVal) {
5249
5244
  cssFile.setAttribute('nonce', nonceVal);
5250
5245
  }
5251
- if (rootObj == null) {
5252
- host.host.style.display = 'none';
5253
- loadExternalCssAsynch(cssFile, host, host.host, nonceVal);
5246
+ if (!rootObj) {
5247
+ await loadExternalCssAsynch(cssFile, host, null, nonceVal, null, false, false, overrideDefaultCss + overrideDarkCss);
5254
5248
  } else {
5255
5249
  const placeholder = document.createElement('div');
5256
5250
  placeholder.classList.add('atcb-placeholder');
@@ -5265,7 +5259,7 @@ function atcb_load_css(host, rootObj = null, data) {
5265
5259
  }
5266
5260
  return;
5267
5261
  }
5268
- if (data.buttonStyle !== 'none' && atcbCssTemplate[`${data.buttonStyle}`] != null) {
5262
+ if (data.buttonStyle !== 'none' && atcbCssTemplate[`${data.buttonStyle}`]) {
5269
5263
  const cssContent = document.createElement('style');
5270
5264
  if (nonceVal) {
5271
5265
  cssContent.setAttribute('nonce', nonceVal);
@@ -5273,7 +5267,7 @@ function atcb_load_css(host, rootObj = null, data) {
5273
5267
  cssContent.innerText = atcbCssTemplate[`${data.buttonStyle}`] + overrideDefaultCss + overrideDarkCss;
5274
5268
  host.prepend(cssContent);
5275
5269
  }
5276
- if (rootObj != null) {
5270
+ if (rootObj) {
5277
5271
  if (data.inline) {
5278
5272
  rootObj.style.display = 'inline-block';
5279
5273
  rootObj.classList.add('atcb-inline');
@@ -5285,7 +5279,7 @@ function atcb_load_css(host, rootObj = null, data) {
5285
5279
  rootObj.classList.remove('atcb-hidden');
5286
5280
  }
5287
5281
  }
5288
- async function loadExternalCssAsynch(cssFile, host, rootObj, nonceVal = null, placeholder = null, inline = false, buttonsList = false, overrideCss = '') {
5282
+ async function loadExternalCssAsynch(cssFile, host, rootObj = null, nonceVal = null, placeholder = null, inline = false, buttonsList = false, overrideCss = '') {
5289
5283
  if (overrideCss !== '') {
5290
5284
  const cssContent = document.createElement('style');
5291
5285
  cssContent.innerText = overrideCss;
@@ -5299,18 +5293,20 @@ async function loadExternalCssAsynch(cssFile, host, rootObj, nonceVal = null, pl
5299
5293
  await new Promise((resolve) => {
5300
5294
  cssFile.onload = resolve;
5301
5295
  });
5302
- if (placeholder) {
5303
- placeholder.remove();
5304
- }
5305
- if (inline) {
5306
- rootObj.style.display = 'inline-block';
5307
- rootObj.classList.add('atcb-inline');
5308
- } else {
5309
- if (buttonsList) {
5310
- rootObj.classList.add('atcb-buttons-list');
5296
+ if (rootObj) {
5297
+ if (placeholder) {
5298
+ placeholder.remove();
5311
5299
  }
5300
+ if (inline) {
5301
+ rootObj.style.display = 'inline-block';
5302
+ rootObj.classList.add('atcb-inline');
5303
+ } else {
5304
+ if (buttonsList) {
5305
+ rootObj.classList.add('atcb-buttons-list');
5306
+ }
5307
+ }
5308
+ rootObj.classList.remove('atcb-hidden');
5312
5309
  }
5313
- rootObj.classList.remove('atcb-hidden');
5314
5310
  } catch (e) {
5315
5311
  console.log(e);
5316
5312
  }
@@ -977,14 +977,14 @@ function tzlib_get_timezones(jsonType = false) {
977
977
  * Add to Calendar Button
978
978
  * ++++++++++++++++++++++
979
979
  *
980
- * Version: 2.5.1
980
+ * Version: 2.5.2
981
981
  * Creator: Jens Kuerschner (https://jenskuerschner.de)
982
982
  * Project: https://github.com/add2cal/add-to-calendar-button
983
983
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
984
984
  * Note: DO NOT REMOVE THE COPYRIGHT NOTICE ABOVE!
985
985
  *
986
986
  */
987
- const atcbVersion = '2.5.1';
987
+ const atcbVersion = '2.5.2';
988
988
  const atcbCssTemplate = {};
989
989
  const atcbIsBrowser = () => {
990
990
  if (typeof window === 'undefined') {
@@ -1998,7 +1998,7 @@ function atcb_toggle(host, action, data = '', button = null, keyboardTrigger = f
1998
1998
  atcb_open(host, data, button, keyboardTrigger, generatedButton);
1999
1999
  }
2000
2000
  }
2001
- function atcb_open(host, data, button = null, keyboardTrigger = false, generatedButton = false) {
2001
+ async function atcb_open(host, data, button = null, keyboardTrigger = false, generatedButton = false) {
2002
2002
  if (host.querySelector('.atcb-list') || host.querySelector('.atcb-modal')) return;
2003
2003
  atcb_log_event('openList', data.identifier, data.identifier);
2004
2004
  atcbStates['active'] = data.identifier;
@@ -2029,7 +2029,7 @@ function atcb_open(host, data, button = null, keyboardTrigger = false, generated
2029
2029
  }
2030
2030
  const bgOverlay = atcb_generate_bg_overlay(host, data.trigger, data.listStyle === 'modal', !data.hideBackground);
2031
2031
  if (data.listStyle === 'modal') {
2032
- const modalHost = atcb_generate_modal_host(host, data);
2032
+ const modalHost = await atcb_generate_modal_host(host, data);
2033
2033
  modalHost.querySelector('.atcb-modal-host-initialized').append(bgOverlay);
2034
2034
  bgOverlay.append(list);
2035
2035
  if (!data.hideBranding) {
@@ -2481,9 +2481,9 @@ function atcb_create_atcbl(host, atList = true, returnEl = false) {
2481
2481
  }
2482
2482
  }
2483
2483
  }
2484
- function atcb_create_modal(host, data, icon = '', headline, content = '', buttons = [], subEvents = [], keyboardTrigger = false, goto = {}, closable = true) {
2484
+ async function atcb_create_modal(host, data, icon = '', headline, content = '', buttons = [], subEvents = [], keyboardTrigger = false, goto = {}, closable = true) {
2485
2485
  atcbStates['active'] = data.identifier;
2486
- const modalHost = atcb_generate_modal_host(host, data, false);
2486
+ const modalHost = await atcb_generate_modal_host(host, data, false);
2487
2487
  const bgOverlay = (function () {
2488
2488
  const el = modalHost.getElementById('atcb-bgoverlay');
2489
2489
  if (!el) {
@@ -2659,7 +2659,7 @@ function atcb_create_modal(host, data, icon = '', headline, content = '', button
2659
2659
  });
2660
2660
  if (modalCount > 1) {
2661
2661
  const prevModal = modalHost.querySelector('.atcb-modal[data-modal-nr="' + (modalCount - 1) + '"]');
2662
- prevModal.style.display = 'none';
2662
+ prevModal.classList.add('atcb-hidden');
2663
2663
  }
2664
2664
  atcb_manage_body_scroll(modalHost, modalWrapper);
2665
2665
  }
@@ -2814,7 +2814,7 @@ function atcb_generate_date_button(data, parent, subEvent = 'all') {
2814
2814
  parent.append(btnCheck);
2815
2815
  }
2816
2816
  }
2817
- function atcb_generate_modal_host(host, data, reset = true) {
2817
+ async function atcb_generate_modal_host(host, data, reset = true) {
2818
2818
  const existingModalHost = document.getElementById(data.identifier + '-modal-host');
2819
2819
  if (!reset && existingModalHost) {
2820
2820
  return existingModalHost.shadowRoot;
@@ -2824,12 +2824,6 @@ function atcb_generate_modal_host(host, data, reset = true) {
2824
2824
  }
2825
2825
  let newModalHost = document.createElement('div');
2826
2826
  newModalHost.id = data.identifier + '-modal-host';
2827
- if (data.styleLight) {
2828
- newModalHost.setAttribute('styleLight', data.styleLight);
2829
- }
2830
- if (data.styleDark) {
2831
- newModalHost.setAttribute('styleDark', data.styleDark);
2832
- }
2833
2827
  if (host.host.hasAttribute('cspnonce')) {
2834
2828
  newModalHost.setAttribute('cspnonce', host.host.getAttribute('cspnonce'));
2835
2829
  }
@@ -2838,14 +2832,14 @@ function atcb_generate_modal_host(host, data, reset = true) {
2838
2832
  document.body.append(newModalHost);
2839
2833
  newModalHost.attachShadow({ mode: 'open', delegateFocus: true });
2840
2834
  const elem = document.createElement('template');
2841
- elem.innerHTML = '<div class="atcb-modal-host-initialized" style="translate3D(0, 0, 0);visibility:visible;opacity:1;position:fixed;top:0;left:0;width:100%;height:100%;display:flex;z-index:13999999;"></div>';
2835
+ elem.innerHTML = '<div class="atcb-modal-host-initialized" style="transform:translate3D(0, 0, 0);visibility:visible;opacity:1;position:fixed;top:0;left:0;width:100%;height:100%;display:flex;z-index:13999999;"></div>';
2842
2836
  newModalHost.shadowRoot.append(elem.content.cloneNode(true));
2843
2837
  atcb_set_light_mode(newModalHost.shadowRoot, data);
2844
- atcb_load_css(newModalHost.shadowRoot, null, data);
2838
+ await atcb_load_css(newModalHost.shadowRoot, null, data);
2845
2839
  return newModalHost.shadowRoot;
2846
2840
  }
2847
- function atcb_generate_overlay_dom(host, data) {
2848
- const newHost = atcb_generate_modal_host(host, data);
2841
+ async function atcb_generate_overlay_dom(host, data) {
2842
+ const newHost = await atcb_generate_modal_host(host, data);
2849
2843
  atcb_set_fullsize(newHost.querySelector('.atcb-modal-host-initialized'));
2850
2844
  const nodes = Array.from(host.children);
2851
2845
  nodes.forEach((node) => {
@@ -2996,7 +2990,7 @@ function atcb_generate_rich_data_recurrence(data, formattedDate) {
2996
2990
  }
2997
2991
 
2998
2992
 
2999
- function atcb_generate_ty(host, data) {
2993
+ async function atcb_generate_ty(host, data) {
3000
2994
  if (!host.host) {
3001
2995
  host = host.shadowRoot;
3002
2996
  data = atcb_decorate_data(data);
@@ -3014,7 +3008,7 @@ function atcb_generate_ty(host, data) {
3014
3008
  if ((!data.proKey || data.proKey === '') && !window.location.hostname.match(/^(localhost|.*\.add-to-calendar-pro.com)$/)) {
3015
3009
  return;
3016
3010
  }
3017
- const tyHost = atcb_generate_modal_host(host, data);
3011
+ const tyHost = await atcb_generate_modal_host(host, data);
3018
3012
  atcb_set_fullsize(tyHost.querySelector('.atcb-modal-host-initialized'));
3019
3013
  const tyData = data.ty;
3020
3014
  if ((tyData.type === 'link' || tyData.type === 'form') && (!tyData.url || tyData.url === '' || !tyData.url.startsWith('http'))) {
@@ -3322,9 +3316,9 @@ async function atcb_generate_rsvp(host, data, keyboardTrigger = false, inline =
3322
3316
  '</button><span id="pro-form-submitting" class="pro-waiting"><span>.</span><span>.</span><span>.</span></span></p>';
3323
3317
  rsvpContent += '</form>';
3324
3318
  rsvpContent += '</div></div>';
3325
- const rsvpHost = (function () {
3319
+ const rsvpHost = (async function () {
3326
3320
  if (!inline || directModal) {
3327
- return atcb_generate_modal_host(host, data);
3321
+ return await atcb_generate_modal_host(host, data);
3328
3322
  }
3329
3323
  return host;
3330
3324
  })();
@@ -4337,7 +4331,8 @@ function atcb_format_datetime(datetime, style = 'delimiters', includeTime = true
4337
4331
  }
4338
4332
  function atcb_generate_timestring(dates, language = 'en', subEvent = 'all', decorate = false, browserTimeOverride = false, enforceYear = false, hideTimeZone = false) {
4339
4333
  if (decorate) {
4340
- dates = atcb_decorate_data_dates({ dates: dates }).dates;
4334
+ const tmpRootTZ = atcb_decorate_data_timezone();
4335
+ dates = atcb_decorate_data_dates({ dates: dates, timeZone: tmpRootTZ }).dates;
4341
4336
  }
4342
4337
  let startDateInfo, endDateInfo, timeZoneInfoStart, timeZoneInfoEnd;
4343
4338
  let formattedTimeStart = {};
@@ -5913,7 +5908,7 @@ function atcb_csp_nonce(host) {
5913
5908
  }
5914
5909
  return host.host.getAttribute('cspnonce');
5915
5910
  }
5916
- function atcb_load_css(host, rootObj = null, data) {
5911
+ async function atcb_load_css(host, rootObj = null, data) {
5917
5912
  const nonceVal = atcb_csp_nonce(host);
5918
5913
  if (!document.getElementById('atcb-global-style')) {
5919
5914
  const cssGlobalContent = document.createElement('style');
@@ -5952,9 +5947,8 @@ function atcb_load_css(host, rootObj = null, data) {
5952
5947
  if (nonceVal) {
5953
5948
  cssFile.setAttribute('nonce', nonceVal);
5954
5949
  }
5955
- if (rootObj == null) {
5956
- host.host.style.display = 'none';
5957
- loadExternalCssAsynch(cssFile, host, host.host, nonceVal);
5950
+ if (!rootObj) {
5951
+ await loadExternalCssAsynch(cssFile, host, null, nonceVal, null, false, false, overrideDefaultCss + overrideDarkCss);
5958
5952
  } else {
5959
5953
  const placeholder = document.createElement('div');
5960
5954
  placeholder.classList.add('atcb-placeholder');
@@ -5969,7 +5963,7 @@ function atcb_load_css(host, rootObj = null, data) {
5969
5963
  }
5970
5964
  return;
5971
5965
  }
5972
- if (data.buttonStyle !== 'none' && atcbCssTemplate[`${data.buttonStyle}`] != null) {
5966
+ if (data.buttonStyle !== 'none' && atcbCssTemplate[`${data.buttonStyle}`]) {
5973
5967
  const cssContent = document.createElement('style');
5974
5968
  if (nonceVal) {
5975
5969
  cssContent.setAttribute('nonce', nonceVal);
@@ -5977,7 +5971,7 @@ function atcb_load_css(host, rootObj = null, data) {
5977
5971
  cssContent.innerText = atcbCssTemplate[`${data.buttonStyle}`] + overrideDefaultCss + overrideDarkCss;
5978
5972
  host.prepend(cssContent);
5979
5973
  }
5980
- if (rootObj != null) {
5974
+ if (rootObj) {
5981
5975
  if (data.inline) {
5982
5976
  rootObj.style.display = 'inline-block';
5983
5977
  rootObj.classList.add('atcb-inline');
@@ -5989,7 +5983,7 @@ function atcb_load_css(host, rootObj = null, data) {
5989
5983
  rootObj.classList.remove('atcb-hidden');
5990
5984
  }
5991
5985
  }
5992
- async function loadExternalCssAsynch(cssFile, host, rootObj, nonceVal = null, placeholder = null, inline = false, buttonsList = false, overrideCss = '') {
5986
+ async function loadExternalCssAsynch(cssFile, host, rootObj = null, nonceVal = null, placeholder = null, inline = false, buttonsList = false, overrideCss = '') {
5993
5987
  if (overrideCss !== '') {
5994
5988
  const cssContent = document.createElement('style');
5995
5989
  cssContent.innerText = overrideCss;
@@ -6003,18 +5997,20 @@ async function loadExternalCssAsynch(cssFile, host, rootObj, nonceVal = null, pl
6003
5997
  await new Promise((resolve) => {
6004
5998
  cssFile.onload = resolve;
6005
5999
  });
6006
- if (placeholder) {
6007
- placeholder.remove();
6008
- }
6009
- if (inline) {
6010
- rootObj.style.display = 'inline-block';
6011
- rootObj.classList.add('atcb-inline');
6012
- } else {
6013
- if (buttonsList) {
6014
- rootObj.classList.add('atcb-buttons-list');
6000
+ if (rootObj) {
6001
+ if (placeholder) {
6002
+ placeholder.remove();
6015
6003
  }
6004
+ if (inline) {
6005
+ rootObj.style.display = 'inline-block';
6006
+ rootObj.classList.add('atcb-inline');
6007
+ } else {
6008
+ if (buttonsList) {
6009
+ rootObj.classList.add('atcb-buttons-list');
6010
+ }
6011
+ }
6012
+ rootObj.classList.remove('atcb-hidden');
6016
6013
  }
6017
- rootObj.classList.remove('atcb-hidden');
6018
6014
  } catch (e) {
6019
6015
  console.log(e);
6020
6016
  }