add-to-calendar-button 2.2.2 → 2.2.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.
@@ -6,15 +6,15 @@ import { tzlib_get_ical_block, tzlib_get_offset, tzlib_get_timezones } from 'tim
6
6
  * Add to Calendar Button
7
7
  * ++++++++++++++++++++++
8
8
  *
9
- * Version: 2.2.2
9
+ * Version: 2.2.3
10
10
  * Creator: Jens Kuerschner (https://jenskuerschner.de)
11
11
  * Project: https://github.com/add2cal/add-to-calendar-button
12
12
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
13
13
  * Note: DO NOT REMOVE THE COPYRIGHT NOTICE ABOVE!
14
14
  *
15
15
  */
16
- const atcbVersion = '2.2.2';
17
- const atcbCssTemplate = {
16
+ const atcbVersion = '2.2.3';
17
+ const atcbCssTemplate = {
18
18
  if (typeof window === 'undefined') {
19
19
  return false;
20
20
  } else {
@@ -338,6 +338,9 @@ function atcb_decorate_data_style(data) {
338
338
  if ((data.buttonStyle == 'default' || data.buttonStyle == '3d' || data.buttonStyle == 'flat') && data.listStyle == 'dropdown' && !data.hideTextLabelList && data.hideTextLabelButton) {
339
339
  data.listStyle = 'overlay';
340
340
  }
341
+ if (data.buttonsList && data.buttonStyle == 'date') {
342
+ data.buttonsList = false;
343
+ }
341
344
  return data;
342
345
  }
343
346
  function atcb_decorate_sizes(size) {
@@ -1159,7 +1162,12 @@ function atcb_generate_label(host, data, parent, type, icon = false, text = '',
1159
1162
  atcb_generate_label_content(data, parent, type, icon, text, oneOption);
1160
1163
  }
1161
1164
  function atcb_generate_label_content(data, parent, type, icon, text, oneOption) {
1162
- const defaultTriggerText = atcb_translate_hook('label.addtocalendar', data);
1165
+ const defaultTriggerText = (function () {
1166
+ if (data.dates[0].overdue && data.pastDateHandling != 'none') {
1167
+ return atcb_translate_hook('expired', data);
1168
+ }
1169
+ return atcb_translate_hook('label.addtocalendar', data);
1170
+ })();
1163
1171
  if (oneOption && text == '') {
1164
1172
  text = defaultTriggerText;
1165
1173
  }
@@ -1210,6 +1218,10 @@ function atcb_generate_button(host, button, data, debug = false) {
1210
1218
  atcb_set_sizes(buttonTriggerWrapper, data.sizes);
1211
1219
  const buttonTrigger = document.createElement('button');
1212
1220
  buttonTrigger.classList.add('atcb-button');
1221
+ if (data.disabled) {
1222
+ buttonTrigger.setAttribute('disabled', true);
1223
+ buttonTrigger.style.cssText = 'opacity: .75; cursor: not-allowed; filter: brightness(95%); border-style: dashed;';
1224
+ }
1213
1225
  if (data.hideTextLabelButton) {
1214
1226
  buttonTrigger.classList.add('atcb-no-text');
1215
1227
  }
@@ -1237,7 +1249,7 @@ function atcb_generate_button(host, button, data, debug = false) {
1237
1249
  buttonDropdownAnchor.classList.add('atcb-dropdown-anchor');
1238
1250
  buttonTrigger.append(buttonDropdownAnchor);
1239
1251
  }
1240
- if (!data.hideCheckmark && !data.hideTextLabelButton && !data.buttonsList) {
1252
+ if (!data.hideCheckmark && !data.hideTextLabelButton && !data.buttonsList && !data.disabled) {
1241
1253
  const btnCheck = document.createElement('div');
1242
1254
  btnCheck.classList.add('atcb-checkmark');
1243
1255
  btnCheck.innerHTML = atcbIcon['checkmark'];
@@ -1576,6 +1588,9 @@ function atcb_generate_date_button(data, parent, subEvent = 'all') {
1576
1588
  if (subEvent != 'all' && data.dates[`${subEvent}`].status == 'CANCELLED') {
1577
1589
  return atcb_translate_hook('date.status.cancelled', data) + '<br>' + atcb_translate_hook('date.status.cancelled.cta', data);
1578
1590
  }
1591
+ if (data.dates[`${subEvent}`].overdue && data.pastDateHandling != 'none') {
1592
+ return atcb_translate_hook('expired', data);
1593
+ }
1579
1594
  return '+ ' + atcb_translate_hook('label.addtocalendar', data);
1580
1595
  })();
1581
1596
  const cancelledInfo = (function () {
@@ -2697,6 +2712,7 @@ const i18nStrings = {
2697
2712
  'modal.subscribe.yahoo.h': 'Add Calendar to Yahoo',
2698
2713
  'modal.subscribe.yahoo.text': '<ol><li>Open now the Yahoo Calendar.</li><li>Click the "Actions" tab.</li><li>Hit "Follow Other Calendars".</li><li>Set a name and past the clipboard content into the url field.</li></ol>',
2699
2714
  cancel: 'Cancel',
2715
+ expired: 'Expired',
2700
2716
  },
2701
2717
  de: {
2702
2718
  'label.addtocalendar': 'Im Kalender speichern',
@@ -2717,6 +2733,7 @@ const i18nStrings = {
2717
2733
  'modal.subscribe.yahoo.h': 'Kalender zu Yahoo hinzufügen',
2718
2734
  'modal.subscribe.yahoo.text': '<ol><li>Öffne den Yahoo Kalender.</li><li>Klicke auf den "Aktionen" Tab.</li><li>Wähle "Weiteren Kalendern folgen".</li><li>Wähle einen Namen und füge die URL aus deiner Zwischenablage in das URL-Feld ein.</li></ol>',
2719
2735
  cancel: 'Abbrechen',
2736
+ expired: 'Abgelaufen',
2720
2737
  },
2721
2738
  es: {
2722
2739
  'label.addtocalendar': 'Añadir al Calendario',
@@ -2737,6 +2754,7 @@ const i18nStrings = {
2737
2754
  'modal.subscribe.yahoo.h': 'Añadir calendario a Yahoo',
2738
2755
  'modal.subscribe.yahoo.text': '<ol><li>Abra el calendario de Yahoo.</li><li>Haga clic en la pestaña "Acciones".</li><li>Seleccione "Seguir otros calendarios".</li><li>Elige un nombre y pega la URL de tu portapapeles en el campo URL.</li></ol>',
2739
2756
  cancel: 'Cancelar',
2757
+ expired: 'Caducada',
2740
2758
  },
2741
2759
  pt: {
2742
2760
  'label.addtocalendar': 'Incluir no Calendário',
@@ -2757,6 +2775,7 @@ const i18nStrings = {
2757
2775
  'modal.subscribe.yahoo.h': 'Adicionar calendário ao Yahoo',
2758
2776
  'modal.subscribe.yahoo.text': '<ol><li>Abrir o calendário do Yahoo.</li><li>Clique no separador "Acções".</li><li>Seleccione "Seguir outros calendários".</li><li>Escolha um nome e cole o URL da sua área de transferência no campo URL.</li></ol>',
2759
2777
  cancel: 'Cancelar',
2778
+ expired: 'Expirada',
2760
2779
  },
2761
2780
  fr: {
2762
2781
  'label.addtocalendar': "Ajouter à l'Agenda",
@@ -2777,6 +2796,7 @@ const i18nStrings = {
2777
2796
  'modal.subscribe.yahoo.h': 'Ajouter un agenda à Yahoo',
2778
2797
  'modal.subscribe.yahoo.text': '<ol><li>Ouvrez l\'Agenda Yahoo.</li><li>Cliquez sur l\'onglet "Actions".</li><li>Sélectionnez "Suivre d\'autres agendas".</li><li>Choisissez un nom et collez le contenu de votre presse-papiers dans le champ URL.</li></ol>',
2779
2798
  cancel: 'Annuler',
2799
+ expired: 'Expiré',
2780
2800
  },
2781
2801
  nl: {
2782
2802
  'label.addtocalendar': 'Opslaan in Agenda',
@@ -2797,6 +2817,7 @@ const i18nStrings = {
2797
2817
  'modal.subscribe.yahoo.h': 'Toevoegen aan Yahoo',
2798
2818
  'modal.subscribe.yahoo.text': '<ol><li>Open de Yahoo calendar.</li><li>Klik op de "Acties" tab.</li><li>Selecteer "Volg Andere Agenda\'s".</li><li>Kies een naam en plak de URL van uw klembord in het URL-veld.</li></ol>',
2799
2819
  cancel: 'Annuleren',
2820
+ expired: 'Verlopen',
2800
2821
  },
2801
2822
  tr: {
2802
2823
  'label.addtocalendar': 'Takvime Ekle',
@@ -2817,6 +2838,7 @@ const i18nStrings = {
2817
2838
  'modal.subscribe.yahoo.h': "Yahoo'ya takvim ekleme",
2818
2839
  'modal.subscribe.yahoo.text': '<ol><li>Yahoo takvimini açın.</li><li>"Eylemler" sekmesine tıklayın.</li><li>"Diğer Takvimleri Takip Et" öğesini seçin.</li><li>Bir ad seçin ve URL\'yi panonuzdan URL alanına yapıştırın.</li></ol>',
2819
2840
  cancel: 'İptal',
2841
+ expired: 'Günü geçmiş',
2820
2842
  },
2821
2843
  zh: {
2822
2844
  'label.addtocalendar': '添加到日历',
@@ -2837,6 +2859,7 @@ const i18nStrings = {
2837
2859
  'modal.subscribe.yahoo.h': '将日历添加到 Yahoo',
2838
2860
  'modal.subscribe.yahoo.text': '<ol><li>打开 Yahoo 日历。</li><li>点击“操作”标签。</li><li>选择“关注其他日历”。</li><li>选择一个名称并将剪贴板中的 URL 粘贴到 URL 字段中。</li></ol>',
2839
2861
  cancel: '中止',
2862
+ expired: '已到期',
2840
2863
  },
2841
2864
  ar: {
2842
2865
  'label.addtocalendar': 'إضافة إلى التقويم',
@@ -2857,6 +2880,7 @@ const i18nStrings = {
2857
2880
  'modal.subscribe.yahoo.h': 'أضف التقويم إلى Yahoo',
2858
2881
  'modal.subscribe.yahoo.text': '<ol><li>افتح تقويم Yahoo.</li><li>انقر فوق علامة التبويب "الإجراءات".</li><li>حدد "متابعة تقويمات أخرى".</li><li>اختر اسمًا والصق عنوان URL من الحافظة الخاصة بك في حقل URL.</li></ol>',
2859
2882
  cancel: 'إحباط',
2883
+ expired: 'منتهي الصلاحية',
2860
2884
  },
2861
2885
  hi: {
2862
2886
  'label.addtocalendar': 'कैलेंडर में जोड़ें',
@@ -2877,6 +2901,7 @@ const i18nStrings = {
2877
2901
  'modal.subscribe.yahoo.h': 'Yahoo . में कैलेंडर जोड़ें',
2878
2902
  'modal.subscribe.yahoo.text': '<ol><li>Yahoo कैलेंडर खोलें।</li><li>"कृती" टैब पर क्लिक करें।</li><li>"इतर कॅलेंडर्सचे अनुसरण करा" चुनें।</li><li>एक नाम चुनें और अपने क्लिपबोर्ड से URL को URL फ़ील्ड में पेस्ट करें।</li></ol>',
2879
2903
  cancel: 'रद्द करना',
2904
+ expired: 'खत्म हो चुका',
2880
2905
  },
2881
2906
  pl: {
2882
2907
  'label.addtocalendar': 'Dodaj do kalendarza',
@@ -2897,6 +2922,7 @@ const i18nStrings = {
2897
2922
  'modal.subscribe.yahoo.h': 'Dodaj kalendarz do Yahoo',
2898
2923
  'modal.subscribe.yahoo.text': '<ol><li>Otwórz kalendarz Yahoo.</li><li>Kliknij na zakładkę "Czynności".</li><li>Wybierz "Obserwuj inne kalendarze".</li><li>Wybierz nazwę i wklej adres URL ze schowka w polu URL.</li></ol>',
2899
2924
  cancel: 'Anuluj',
2925
+ expired: 'Wygasły',
2900
2926
  },
2901
2927
  id: {
2902
2928
  'label.addtocalendar': 'Tambahkan ke Kalender',
@@ -2917,6 +2943,7 @@ const i18nStrings = {
2917
2943
  'modal.subscribe.yahoo.h': 'Tambahkan kalender ke Yahoo',
2918
2944
  'modal.subscribe.yahoo.text': '<ol><li>Buka kalender Yahoo.</li><li>Klik pada tab "Tindakan".</li><li>Pilih "Ikuti Kalender Lain".</li><li>Pilih nama dan tempelkan URL dari clipboard Anda ke bidang URL.</li></ol>',
2919
2945
  cancel: 'Batal',
2946
+ expired: 'Kedaluwarsa',
2920
2947
  },
2921
2948
  no: {
2922
2949
  'label.addtocalendar': 'Legg til i kalenderen',
@@ -2937,6 +2964,7 @@ const i18nStrings = {
2937
2964
  'modal.subscribe.yahoo.h': 'Legg til kalender til Yahoo',
2938
2965
  'modal.subscribe.yahoo.text': '<ol><li>Åpne Yahoo-kalenderen.</li><li>Klikk på «Handlinger»-fanen.</li><li>Velg «Følg andre kalendere».</li><li>Velg et navn og lim inn URL-en fra utklippstavlen i URL-feltet.</li></ol>',
2939
2966
  cancel: 'Avbryt',
2967
+ expired: 'Utløpt',
2940
2968
  },
2941
2969
  fi: {
2942
2970
  'label.addtocalendar': 'Lisää kalenteriin',
@@ -2957,6 +2985,7 @@ const i18nStrings = {
2957
2985
  'modal.subscribe.yahoo.h': 'Lisää kalenteri Yahoo',
2958
2986
  'modal.subscribe.yahoo.text': '<ol><li>Avaa Yahoo-kalenteri.</li><li>Napsauta "Toiminnot"-välilehteä.</li><li>Valitse "Seuraa muiden kalentereita".</li><li>Valitse nimi ja liitä URL-osoite leikepöydältäsi URL-kenttään.</li></ol>',
2959
2987
  cancel: 'Peruuta',
2988
+ expired: 'Vanhentunut',
2960
2989
  },
2961
2990
  sv: {
2962
2991
  'label.addtocalendar': 'Lägg till i kalender',
@@ -2977,6 +3006,7 @@ const i18nStrings = {
2977
3006
  'modal.subscribe.yahoo.h': 'Lägg till kalender i Yahoo',
2978
3007
  'modal.subscribe.yahoo.text': '<ol><li>Öppna Yahoo-kalendern.</li><li>Klicka på fliken "Åtgärder".</li><li>Välj "Följ andra kalendrar".</li><li>Välj ett namn och klistra in URL:en från klippbordet i URL-fältet.</li></ol>',
2979
3008
  cancel: 'Avbryt',
3009
+ expired: 'Utgånget',
2980
3010
  },
2981
3011
  cs: {
2982
3012
  'label.addtocalendar': 'Přidat do kalendáře',
@@ -2997,6 +3027,7 @@ const i18nStrings = {
2997
3027
  'modal.subscribe.yahoo.h': 'Přidat kalendář do Yahoo',
2998
3028
  'modal.subscribe.yahoo.text': '<ol><li>Otevřete kalendář Yahoo.</li><li>Klikněte na kartu "Akce".</li><li>Vyberte možnost "Sledovat další kalendáře".</li><li>Vyberte název a vložte adresu URL ze schránky do pole URL.</li></ol>',
2999
3029
  cancel: 'Storno',
3030
+ expired: 'Platnost vypršela',
3000
3031
  },
3001
3032
  ja: {
3002
3033
  'label.addtocalendar': 'カレンダーに追加',
@@ -3017,6 +3048,7 @@ const i18nStrings = {
3017
3048
  'modal.subscribe.yahoo.h': 'Yahooにカレンダーを追加する',
3018
3049
  'modal.subscribe.yahoo.text': '<ol><li>Yahooカレンダーを開く。</li><li>[実行] タブをクリックします。</li><li>[その他のカレンダーのフォロー] を選択します。</li><li>名前を決めて、クリップボードにあるURLをURL欄に貼り付けます。</li></ol>',
3019
3050
  cancel: 'キャンセル',
3051
+ expired: '期限切れ',
3020
3052
  },
3021
3053
  it: {
3022
3054
  'label.addtocalendar': 'Aggiungi al calendario',
@@ -3037,6 +3069,7 @@ const i18nStrings = {
3037
3069
  'modal.subscribe.yahoo.h': 'Aggiungi il calendario a Yahoo',
3038
3070
  'modal.subscribe.yahoo.text': '<ol><li>Aprire il calendario di Yahoo.</li><li>Fare clic sulla scheda "Azioni".</li><li>Selezionare "Segui altri calendari".</li><li>Scegliere un nome e incollare l\'URL dagli appunti nel campo URL.</li></ol>',
3039
3071
  cancel: 'Annulla',
3072
+ expired: 'Scaduta',
3040
3073
  },
3041
3074
  ko: {
3042
3075
  'label.addtocalendar': '캘린더에 추가',
@@ -3057,6 +3090,7 @@ const i18nStrings = {
3057
3090
  'modal.subscribe.yahoo.h': 'Yahoo에 캘린더 추가',
3058
3091
  'modal.subscribe.yahoo.text': '<ol><li>Yahoo 캘린더를 엽니다.</li><li>"동작" 탭을 클릭합니다.</li><li>"다른 일정관리 팔로우"를 선택합니다.</li><li>이름을 선택하고 클립보드의 URL을 URL 필드에 붙여넣습니다.</li></ol>',
3059
3092
  cancel: '취소',
3093
+ expired: '만료됨',
3060
3094
  },
3061
3095
  vi: {
3062
3096
  'label.addtocalendar': 'Thêm vào Lịch',
@@ -3077,6 +3111,7 @@ const i18nStrings = {
3077
3111
  'modal.subscribe.yahoo.h': 'Thêm lịch vào Yahoo',
3078
3112
  'modal.subscribe.yahoo.text': '<ol><li>Mở Lịch Yahoo.</li><li>Nhấp vào tab "Hành động".</li><li>Chọn "Theo dõi các Lịch khác".</li><li>Chọn tên và dán URL từ khay nhớ tạm của bạn vào trường URL.</li></ol>',
3079
3113
  cancel: 'Hủy bỏ',
3114
+ expired: 'Hết hạn',
3080
3115
  },
3081
3116
  ro: {
3082
3117
  'label.addtocalendar': 'Adauga In Calendar',
@@ -3097,6 +3132,7 @@ const i18nStrings = {
3097
3132
  'modal.subscribe.yahoo.h': 'Adauga Calendar in Yahoo',
3098
3133
  'modal.subscribe.yahoo.text': '<ol><li>Deschide acum calendarul Yahoo.</li><li>Apasa pe tab-ul de "Actiuni".</li><li>Apasa "Urmareste alte calendare".</li><li>Seteaza un nume si lipeste continutul din clipboard in casuta cu url.</li></ol>',
3099
3134
  cancel: 'Anuleaza',
3135
+ expired: 'Expirat',
3100
3136
  },
3101
3137
  };
3102
3138
  const availableLanguages = Object.keys(i18nStrings);
@@ -3130,6 +3166,7 @@ if (isBrowser()) {
3130
3166
  elem.innerHTML = template;
3131
3167
  this.attachShadow({ mode: 'open', delegateFocus: true });
3132
3168
  this.shadowRoot.append(elem.content.cloneNode(true));
3169
+ this.loaded = false;
3133
3170
  this.initialized = false;
3134
3171
  this.data = {};
3135
3172
  this.error = false;
@@ -3142,43 +3179,17 @@ if (isBrowser()) {
3142
3179
  if (this.data.name == null || this.data.name == '') {
3143
3180
  try {
3144
3181
  this.data = atcb_read_attributes(this);
3182
+ this.loaded = true;
3145
3183
  } catch (e) {
3146
3184
  if (this.debug) {
3147
3185
  atcb_render_debug_msg(this.shadowRoot, e);
3148
3186
  }
3187
+ this.loaded = true;
3149
3188
  return;
3150
3189
  }
3151
3190
  this.data.proKey = '';
3152
3191
  }
3153
- atcbBtnCount = atcbBtnCount + 1;
3154
- if (this.identifier && this.identifier != '') {
3155
- this.data.identifier = this.identifier;
3156
- } else {
3157
- if (this.data.identifier && this.data.identifier != '') {
3158
- if (!/^[\w\-_]+$/.test(this.data.identifier)) {
3159
- this.data.identifier = '';
3160
- if (this.debug) {
3161
- console.warn('Add to Calendar Button generation: identifier invalid - using auto numbers instead');
3162
- }
3163
- } else {
3164
- this.data.identifier = 'atcb-btn-' + this.data.identifier;
3165
- }
3166
- }
3167
- if (this.data.identifier == null || this.data.identifier == '') {
3168
- this.data.identifier = 'atcb-btn-' + atcbBtnCount;
3169
- }
3170
- this.identifier = this.data.identifier;
3171
- }
3172
- this.setAttribute('atcb-button-id', this.data.identifier);
3173
- this.initialized = true;
3174
- try {
3175
- atcb_build_button(this.shadowRoot, this.data, this.debug);
3176
- } catch (e) {
3177
- if (this.debug) {
3178
- atcb_render_debug_msg(this.shadowRoot, e);
3179
- }
3180
- return;
3181
- }
3192
+ this.initButton();
3182
3193
  }
3183
3194
  disconnectedCallback() {
3184
3195
  atcb_cleanup(this.shadowRoot, this.data);
@@ -3201,10 +3212,10 @@ if (isBrowser()) {
3201
3212
  if (this.data.proKey != null && this.data.proKey != '') {
3202
3213
  return;
3203
3214
  }
3204
- if (!this.initialized) {
3215
+ if (!this.loaded) {
3205
3216
  return;
3206
3217
  }
3207
- if (this.debug) {
3218
+ if (this.debug && this.initialized) {
3208
3219
  console.log(`${name}'s value has been changed from ${oldValue} to ${newValue}`);
3209
3220
  }
3210
3221
  atcb_cleanup(this.shadowRoot, this.data);
@@ -3221,7 +3232,32 @@ if (isBrowser()) {
3221
3232
  }
3222
3233
  return;
3223
3234
  }
3224
- this.data.identifier = this.identifier;
3235
+ this.initButton();
3236
+ }
3237
+ initButton() {
3238
+ if (!this.initialized) {
3239
+ this.initialized = true;
3240
+ atcbBtnCount = atcbBtnCount + 1;
3241
+ }
3242
+ if (this.identifier && this.identifier != '') {
3243
+ this.data.identifier = this.identifier;
3244
+ } else {
3245
+ if (this.data.identifier && this.data.identifier != '') {
3246
+ if (!/^[\w\-_]+$/.test(this.data.identifier)) {
3247
+ this.data.identifier = '';
3248
+ if (this.debug) {
3249
+ console.warn('Add to Calendar Button generation: identifier invalid - using auto numbers instead');
3250
+ }
3251
+ } else {
3252
+ this.data.identifier = 'atcb-btn-' + this.data.identifier;
3253
+ }
3254
+ }
3255
+ if (this.data.identifier == null || this.data.identifier == '') {
3256
+ this.data.identifier = 'atcb-btn-' + atcbBtnCount;
3257
+ }
3258
+ this.identifier = this.data.identifier;
3259
+ }
3260
+ this.setAttribute('atcb-button-id', this.data.identifier);
3225
3261
  try {
3226
3262
  atcb_build_button(this.shadowRoot, this.data, this.debug);
3227
3263
  } catch (e) {
@@ -3320,10 +3356,12 @@ function atcb_build_button(host, data, debug = false) {
3320
3356
  atcb_setup_state_management(data);
3321
3357
  atcb_set_global_event_listener(host, data);
3322
3358
  atcb_init_log(data.proKey, debug);
3323
- atcb_generate_button(host, rootObj, data, debug);
3324
- if (!data.hideRichData && data.name && data.dates[0].location && data.dates[0].startDate) {
3325
- atcb_generate_rich_data(data, host.host);
3326
- data.schemaEl = host.host.previousSibling;
3359
+ if (!data.hidden) {
3360
+ atcb_generate_button(host, rootObj, data, debug);
3361
+ if (!data.hideRichData && data.name && data.dates[0].location && data.dates[0].startDate) {
3362
+ atcb_generate_rich_data(data, host.host);
3363
+ data.schemaEl = host.host.previousSibling;
3364
+ }
3327
3365
  }
3328
3366
  atcb_log_event('initialization', data.identifier, data.identifier);
3329
3367
  } else if (debug) {
@@ -3497,36 +3535,38 @@ function atcb_action(data, triggerElement, keyboardTrigger = false) {
3497
3535
  }
3498
3536
  potentialExistingHost.remove();
3499
3537
  }
3500
- let host = document.createElement('div');
3501
- host.id = 'atcb-customTrigger-' + data.identifier + '-host';
3502
- if (root == document.body) {
3503
- document.body.append(host);
3504
- } else {
3505
- root.after(host);
3506
- }
3507
- if (triggerElement) {
3508
- const btnDim = triggerElement.getBoundingClientRect();
3509
- host.style.position = 'relative';
3510
- host.style.left = -btnDim.width + 'px';
3511
- host.style.top = btnDim.height + 'px';
3512
- }
3513
- host.setAttribute('atcb-button-id', data.identifier);
3514
- host.attachShadow({ mode: 'open', delegateFocus: true });
3515
- const elem = document.createElement('template');
3516
- elem.innerHTML = template;
3517
- host.shadowRoot.append(elem.content.cloneNode(true));
3518
- const rootObj = host.shadowRoot.querySelector('.atcb-initialized');
3519
- atcb_setup_state_management(data);
3520
- atcb_set_light_mode(host.shadowRoot, data);
3521
- host.shadowRoot.querySelector('.atcb-initialized').setAttribute('lang', data.language);
3522
- atcb_load_css(host.shadowRoot, rootObj, data.buttonStyle, false, false, data.customCss);
3523
- atcb_set_global_event_listener(host.shadowRoot, data);
3524
3538
  atcb_log_event('initialization', data.identifier, data.identifier);
3525
- if (oneOption) {
3526
- atcb_generate_links(host.shadowRoot, data.options[0], data, 'all', keyboardTrigger);
3527
- atcb_log_event('openSingletonLink', data.identifier, data.identifier);
3528
- } else {
3529
- atcb_toggle(host.shadowRoot, 'open', data, triggerElement, keyboardTrigger);
3539
+ if (!data.blockInteraction) {
3540
+ let host = document.createElement('div');
3541
+ host.id = 'atcb-customTrigger-' + data.identifier + '-host';
3542
+ if (root == document.body) {
3543
+ document.body.append(host);
3544
+ } else {
3545
+ root.after(host);
3546
+ }
3547
+ if (triggerElement) {
3548
+ const btnDim = triggerElement.getBoundingClientRect();
3549
+ host.style.position = 'relative';
3550
+ host.style.left = -btnDim.width + 'px';
3551
+ host.style.top = btnDim.height + 'px';
3552
+ }
3553
+ host.setAttribute('atcb-button-id', data.identifier);
3554
+ host.attachShadow({ mode: 'open', delegateFocus: true });
3555
+ const elem = document.createElement('template');
3556
+ elem.innerHTML = template;
3557
+ host.shadowRoot.append(elem.content.cloneNode(true));
3558
+ const rootObj = host.shadowRoot.querySelector('.atcb-initialized');
3559
+ atcb_setup_state_management(data);
3560
+ atcb_set_light_mode(host.shadowRoot, data);
3561
+ host.shadowRoot.querySelector('.atcb-initialized').setAttribute('lang', data.language);
3562
+ atcb_load_css(host.shadowRoot, rootObj, data.buttonStyle, false, false, data.customCss);
3563
+ atcb_set_global_event_listener(host.shadowRoot, data);
3564
+ if (oneOption) {
3565
+ atcb_generate_links(host.shadowRoot, data.options[0], data, 'all', keyboardTrigger);
3566
+ atcb_log_event('openSingletonLink', data.identifier, data.identifier);
3567
+ } else {
3568
+ atcb_toggle(host.shadowRoot, 'open', data, triggerElement, keyboardTrigger);
3569
+ }
3530
3570
  }
3531
3571
  atcb_init_log(data.proKey, data.debug);
3532
3572
  if (data.debug) {
@@ -3555,8 +3595,7 @@ function atcb_init_log(pro = '', debug = false) {
3555
3595
  if (pro != '') {
3556
3596
  console.log('Add to Calendar PRO script initialized' + versionOutput + ' | https://add-to-calendar-pro.com');
3557
3597
  } else {
3558
- console.log('%cAdd to Calendar Button script initialized' + versionOutput, 'font-weight: bold;');
3559
- console.log('see https://add-to-calendar-button.com for details');
3598
+ console.log('%c\nAdd to Calendar Button script initialized' + versionOutput + '\n' + 'see https://add-to-calendar-button.com for details.\n', 'font-weight: bold;');
3560
3599
  }
3561
3600
  atcbInitialGlobalInit = true;
3562
3601
  }
@@ -3585,7 +3624,7 @@ function atcb_set_global_event_listener(host, data) {
3585
3624
  lightModeMutationObserver[data.identifier].observe(document.documentElement, { attributes: true });
3586
3625
  lightModeMutationObserver[data.identifier].observe(document.body, { attributes: true });
3587
3626
  }
3588
- if (!atcbInitialGlobalInit && !data.blockInteraction) {
3627
+ if (!atcbInitialGlobalInit) {
3589
3628
  document.addEventListener('keyup', atcb_global_listener_keyup);
3590
3629
  document.addEventListener('keydown', atcb_global_listener_keydown);
3591
3630
  window.addEventListener('resize', atcb_global_listener_resize);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "add-to-calendar-button",
3
- "version": "2.2.2",
3
+ "version": "2.2.3",
4
4
  "engines": {
5
5
  "node": ">=16.18.1",
6
6
  "npm": ">=8.19.2"