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.
- package/README.md +1 -0
- package/dist/atcb.js +2 -2
- package/dist/commonjs/index.js +112 -73
- package/dist/module/index.js +112 -73
- package/package.json +1 -1
package/dist/commonjs/index.js
CHANGED
|
@@ -7,15 +7,15 @@ const tzlibActions = require('timezones-ical-library');
|
|
|
7
7
|
* Add to Calendar Button
|
|
8
8
|
* ++++++++++++++++++++++
|
|
9
9
|
*
|
|
10
|
-
* Version: 2.2.
|
|
10
|
+
* Version: 2.2.3
|
|
11
11
|
* Creator: Jens Kuerschner (https://jenskuerschner.de)
|
|
12
12
|
* Project: https://github.com/add2cal/add-to-calendar-button
|
|
13
13
|
* License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
|
|
14
14
|
* Note: DO NOT REMOVE THE COPYRIGHT NOTICE ABOVE!
|
|
15
15
|
*
|
|
16
16
|
*/
|
|
17
|
-
const atcbVersion = '2.2.
|
|
18
|
-
const atcbCssTemplate = {
|
|
17
|
+
const atcbVersion = '2.2.3';
|
|
18
|
+
const atcbCssTemplate = {
|
|
19
19
|
if (typeof window === 'undefined') {
|
|
20
20
|
return false;
|
|
21
21
|
} else {
|
|
@@ -339,6 +339,9 @@ function atcb_decorate_data_style(data) {
|
|
|
339
339
|
if ((data.buttonStyle == 'default' || data.buttonStyle == '3d' || data.buttonStyle == 'flat') && data.listStyle == 'dropdown' && !data.hideTextLabelList && data.hideTextLabelButton) {
|
|
340
340
|
data.listStyle = 'overlay';
|
|
341
341
|
}
|
|
342
|
+
if (data.buttonsList && data.buttonStyle == 'date') {
|
|
343
|
+
data.buttonsList = false;
|
|
344
|
+
}
|
|
342
345
|
return data;
|
|
343
346
|
}
|
|
344
347
|
function atcb_decorate_sizes(size) {
|
|
@@ -1160,7 +1163,12 @@ function atcb_generate_label(host, data, parent, type, icon = false, text = '',
|
|
|
1160
1163
|
atcb_generate_label_content(data, parent, type, icon, text, oneOption);
|
|
1161
1164
|
}
|
|
1162
1165
|
function atcb_generate_label_content(data, parent, type, icon, text, oneOption) {
|
|
1163
|
-
const defaultTriggerText =
|
|
1166
|
+
const defaultTriggerText = (function () {
|
|
1167
|
+
if (data.dates[0].overdue && data.pastDateHandling != 'none') {
|
|
1168
|
+
return atcb_translate_hook('expired', data);
|
|
1169
|
+
}
|
|
1170
|
+
return atcb_translate_hook('label.addtocalendar', data);
|
|
1171
|
+
})();
|
|
1164
1172
|
if (oneOption && text == '') {
|
|
1165
1173
|
text = defaultTriggerText;
|
|
1166
1174
|
}
|
|
@@ -1211,6 +1219,10 @@ function atcb_generate_button(host, button, data, debug = false) {
|
|
|
1211
1219
|
atcb_set_sizes(buttonTriggerWrapper, data.sizes);
|
|
1212
1220
|
const buttonTrigger = document.createElement('button');
|
|
1213
1221
|
buttonTrigger.classList.add('atcb-button');
|
|
1222
|
+
if (data.disabled) {
|
|
1223
|
+
buttonTrigger.setAttribute('disabled', true);
|
|
1224
|
+
buttonTrigger.style.cssText = 'opacity: .75; cursor: not-allowed; filter: brightness(95%); border-style: dashed;';
|
|
1225
|
+
}
|
|
1214
1226
|
if (data.hideTextLabelButton) {
|
|
1215
1227
|
buttonTrigger.classList.add('atcb-no-text');
|
|
1216
1228
|
}
|
|
@@ -1238,7 +1250,7 @@ function atcb_generate_button(host, button, data, debug = false) {
|
|
|
1238
1250
|
buttonDropdownAnchor.classList.add('atcb-dropdown-anchor');
|
|
1239
1251
|
buttonTrigger.append(buttonDropdownAnchor);
|
|
1240
1252
|
}
|
|
1241
|
-
if (!data.hideCheckmark && !data.hideTextLabelButton && !data.buttonsList) {
|
|
1253
|
+
if (!data.hideCheckmark && !data.hideTextLabelButton && !data.buttonsList && !data.disabled) {
|
|
1242
1254
|
const btnCheck = document.createElement('div');
|
|
1243
1255
|
btnCheck.classList.add('atcb-checkmark');
|
|
1244
1256
|
btnCheck.innerHTML = atcbIcon['checkmark'];
|
|
@@ -1577,6 +1589,9 @@ function atcb_generate_date_button(data, parent, subEvent = 'all') {
|
|
|
1577
1589
|
if (subEvent != 'all' && data.dates[`${subEvent}`].status == 'CANCELLED') {
|
|
1578
1590
|
return atcb_translate_hook('date.status.cancelled', data) + '<br>' + atcb_translate_hook('date.status.cancelled.cta', data);
|
|
1579
1591
|
}
|
|
1592
|
+
if (data.dates[`${subEvent}`].overdue && data.pastDateHandling != 'none') {
|
|
1593
|
+
return atcb_translate_hook('expired', data);
|
|
1594
|
+
}
|
|
1580
1595
|
return '+ ' + atcb_translate_hook('label.addtocalendar', data);
|
|
1581
1596
|
})();
|
|
1582
1597
|
const cancelledInfo = (function () {
|
|
@@ -2698,6 +2713,7 @@ const i18nStrings = {
|
|
|
2698
2713
|
'modal.subscribe.yahoo.h': 'Add Calendar to Yahoo',
|
|
2699
2714
|
'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>',
|
|
2700
2715
|
cancel: 'Cancel',
|
|
2716
|
+
expired: 'Expired',
|
|
2701
2717
|
},
|
|
2702
2718
|
de: {
|
|
2703
2719
|
'label.addtocalendar': 'Im Kalender speichern',
|
|
@@ -2718,6 +2734,7 @@ const i18nStrings = {
|
|
|
2718
2734
|
'modal.subscribe.yahoo.h': 'Kalender zu Yahoo hinzufügen',
|
|
2719
2735
|
'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>',
|
|
2720
2736
|
cancel: 'Abbrechen',
|
|
2737
|
+
expired: 'Abgelaufen',
|
|
2721
2738
|
},
|
|
2722
2739
|
es: {
|
|
2723
2740
|
'label.addtocalendar': 'Añadir al Calendario',
|
|
@@ -2738,6 +2755,7 @@ const i18nStrings = {
|
|
|
2738
2755
|
'modal.subscribe.yahoo.h': 'Añadir calendario a Yahoo',
|
|
2739
2756
|
'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>',
|
|
2740
2757
|
cancel: 'Cancelar',
|
|
2758
|
+
expired: 'Caducada',
|
|
2741
2759
|
},
|
|
2742
2760
|
pt: {
|
|
2743
2761
|
'label.addtocalendar': 'Incluir no Calendário',
|
|
@@ -2758,6 +2776,7 @@ const i18nStrings = {
|
|
|
2758
2776
|
'modal.subscribe.yahoo.h': 'Adicionar calendário ao Yahoo',
|
|
2759
2777
|
'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>',
|
|
2760
2778
|
cancel: 'Cancelar',
|
|
2779
|
+
expired: 'Expirada',
|
|
2761
2780
|
},
|
|
2762
2781
|
fr: {
|
|
2763
2782
|
'label.addtocalendar': "Ajouter à l'Agenda",
|
|
@@ -2778,6 +2797,7 @@ const i18nStrings = {
|
|
|
2778
2797
|
'modal.subscribe.yahoo.h': 'Ajouter un agenda à Yahoo',
|
|
2779
2798
|
'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>',
|
|
2780
2799
|
cancel: 'Annuler',
|
|
2800
|
+
expired: 'Expiré',
|
|
2781
2801
|
},
|
|
2782
2802
|
nl: {
|
|
2783
2803
|
'label.addtocalendar': 'Opslaan in Agenda',
|
|
@@ -2798,6 +2818,7 @@ const i18nStrings = {
|
|
|
2798
2818
|
'modal.subscribe.yahoo.h': 'Toevoegen aan Yahoo',
|
|
2799
2819
|
'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>',
|
|
2800
2820
|
cancel: 'Annuleren',
|
|
2821
|
+
expired: 'Verlopen',
|
|
2801
2822
|
},
|
|
2802
2823
|
tr: {
|
|
2803
2824
|
'label.addtocalendar': 'Takvime Ekle',
|
|
@@ -2818,6 +2839,7 @@ const i18nStrings = {
|
|
|
2818
2839
|
'modal.subscribe.yahoo.h': "Yahoo'ya takvim ekleme",
|
|
2819
2840
|
'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>',
|
|
2820
2841
|
cancel: 'İptal',
|
|
2842
|
+
expired: 'Günü geçmiş',
|
|
2821
2843
|
},
|
|
2822
2844
|
zh: {
|
|
2823
2845
|
'label.addtocalendar': '添加到日历',
|
|
@@ -2838,6 +2860,7 @@ const i18nStrings = {
|
|
|
2838
2860
|
'modal.subscribe.yahoo.h': '将日历添加到 Yahoo',
|
|
2839
2861
|
'modal.subscribe.yahoo.text': '<ol><li>打开 Yahoo 日历。</li><li>点击“操作”标签。</li><li>选择“关注其他日历”。</li><li>选择一个名称并将剪贴板中的 URL 粘贴到 URL 字段中。</li></ol>',
|
|
2840
2862
|
cancel: '中止',
|
|
2863
|
+
expired: '已到期',
|
|
2841
2864
|
},
|
|
2842
2865
|
ar: {
|
|
2843
2866
|
'label.addtocalendar': 'إضافة إلى التقويم',
|
|
@@ -2858,6 +2881,7 @@ const i18nStrings = {
|
|
|
2858
2881
|
'modal.subscribe.yahoo.h': 'أضف التقويم إلى Yahoo',
|
|
2859
2882
|
'modal.subscribe.yahoo.text': '<ol><li>افتح تقويم Yahoo.</li><li>انقر فوق علامة التبويب "الإجراءات".</li><li>حدد "متابعة تقويمات أخرى".</li><li>اختر اسمًا والصق عنوان URL من الحافظة الخاصة بك في حقل URL.</li></ol>',
|
|
2860
2883
|
cancel: 'إحباط',
|
|
2884
|
+
expired: 'منتهي الصلاحية',
|
|
2861
2885
|
},
|
|
2862
2886
|
hi: {
|
|
2863
2887
|
'label.addtocalendar': 'कैलेंडर में जोड़ें',
|
|
@@ -2878,6 +2902,7 @@ const i18nStrings = {
|
|
|
2878
2902
|
'modal.subscribe.yahoo.h': 'Yahoo . में कैलेंडर जोड़ें',
|
|
2879
2903
|
'modal.subscribe.yahoo.text': '<ol><li>Yahoo कैलेंडर खोलें।</li><li>"कृती" टैब पर क्लिक करें।</li><li>"इतर कॅलेंडर्सचे अनुसरण करा" चुनें।</li><li>एक नाम चुनें और अपने क्लिपबोर्ड से URL को URL फ़ील्ड में पेस्ट करें।</li></ol>',
|
|
2880
2904
|
cancel: 'रद्द करना',
|
|
2905
|
+
expired: 'खत्म हो चुका',
|
|
2881
2906
|
},
|
|
2882
2907
|
pl: {
|
|
2883
2908
|
'label.addtocalendar': 'Dodaj do kalendarza',
|
|
@@ -2898,6 +2923,7 @@ const i18nStrings = {
|
|
|
2898
2923
|
'modal.subscribe.yahoo.h': 'Dodaj kalendarz do Yahoo',
|
|
2899
2924
|
'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>',
|
|
2900
2925
|
cancel: 'Anuluj',
|
|
2926
|
+
expired: 'Wygasły',
|
|
2901
2927
|
},
|
|
2902
2928
|
id: {
|
|
2903
2929
|
'label.addtocalendar': 'Tambahkan ke Kalender',
|
|
@@ -2918,6 +2944,7 @@ const i18nStrings = {
|
|
|
2918
2944
|
'modal.subscribe.yahoo.h': 'Tambahkan kalender ke Yahoo',
|
|
2919
2945
|
'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>',
|
|
2920
2946
|
cancel: 'Batal',
|
|
2947
|
+
expired: 'Kedaluwarsa',
|
|
2921
2948
|
},
|
|
2922
2949
|
no: {
|
|
2923
2950
|
'label.addtocalendar': 'Legg til i kalenderen',
|
|
@@ -2938,6 +2965,7 @@ const i18nStrings = {
|
|
|
2938
2965
|
'modal.subscribe.yahoo.h': 'Legg til kalender til Yahoo',
|
|
2939
2966
|
'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>',
|
|
2940
2967
|
cancel: 'Avbryt',
|
|
2968
|
+
expired: 'Utløpt',
|
|
2941
2969
|
},
|
|
2942
2970
|
fi: {
|
|
2943
2971
|
'label.addtocalendar': 'Lisää kalenteriin',
|
|
@@ -2958,6 +2986,7 @@ const i18nStrings = {
|
|
|
2958
2986
|
'modal.subscribe.yahoo.h': 'Lisää kalenteri Yahoo',
|
|
2959
2987
|
'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>',
|
|
2960
2988
|
cancel: 'Peruuta',
|
|
2989
|
+
expired: 'Vanhentunut',
|
|
2961
2990
|
},
|
|
2962
2991
|
sv: {
|
|
2963
2992
|
'label.addtocalendar': 'Lägg till i kalender',
|
|
@@ -2978,6 +3007,7 @@ const i18nStrings = {
|
|
|
2978
3007
|
'modal.subscribe.yahoo.h': 'Lägg till kalender i Yahoo',
|
|
2979
3008
|
'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>',
|
|
2980
3009
|
cancel: 'Avbryt',
|
|
3010
|
+
expired: 'Utgånget',
|
|
2981
3011
|
},
|
|
2982
3012
|
cs: {
|
|
2983
3013
|
'label.addtocalendar': 'Přidat do kalendáře',
|
|
@@ -2998,6 +3028,7 @@ const i18nStrings = {
|
|
|
2998
3028
|
'modal.subscribe.yahoo.h': 'Přidat kalendář do Yahoo',
|
|
2999
3029
|
'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>',
|
|
3000
3030
|
cancel: 'Storno',
|
|
3031
|
+
expired: 'Platnost vypršela',
|
|
3001
3032
|
},
|
|
3002
3033
|
ja: {
|
|
3003
3034
|
'label.addtocalendar': 'カレンダーに追加',
|
|
@@ -3018,6 +3049,7 @@ const i18nStrings = {
|
|
|
3018
3049
|
'modal.subscribe.yahoo.h': 'Yahooにカレンダーを追加する',
|
|
3019
3050
|
'modal.subscribe.yahoo.text': '<ol><li>Yahooカレンダーを開く。</li><li>[実行] タブをクリックします。</li><li>[その他のカレンダーのフォロー] を選択します。</li><li>名前を決めて、クリップボードにあるURLをURL欄に貼り付けます。</li></ol>',
|
|
3020
3051
|
cancel: 'キャンセル',
|
|
3052
|
+
expired: '期限切れ',
|
|
3021
3053
|
},
|
|
3022
3054
|
it: {
|
|
3023
3055
|
'label.addtocalendar': 'Aggiungi al calendario',
|
|
@@ -3038,6 +3070,7 @@ const i18nStrings = {
|
|
|
3038
3070
|
'modal.subscribe.yahoo.h': 'Aggiungi il calendario a Yahoo',
|
|
3039
3071
|
'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>',
|
|
3040
3072
|
cancel: 'Annulla',
|
|
3073
|
+
expired: 'Scaduta',
|
|
3041
3074
|
},
|
|
3042
3075
|
ko: {
|
|
3043
3076
|
'label.addtocalendar': '캘린더에 추가',
|
|
@@ -3058,6 +3091,7 @@ const i18nStrings = {
|
|
|
3058
3091
|
'modal.subscribe.yahoo.h': 'Yahoo에 캘린더 추가',
|
|
3059
3092
|
'modal.subscribe.yahoo.text': '<ol><li>Yahoo 캘린더를 엽니다.</li><li>"동작" 탭을 클릭합니다.</li><li>"다른 일정관리 팔로우"를 선택합니다.</li><li>이름을 선택하고 클립보드의 URL을 URL 필드에 붙여넣습니다.</li></ol>',
|
|
3060
3093
|
cancel: '취소',
|
|
3094
|
+
expired: '만료됨',
|
|
3061
3095
|
},
|
|
3062
3096
|
vi: {
|
|
3063
3097
|
'label.addtocalendar': 'Thêm vào Lịch',
|
|
@@ -3078,6 +3112,7 @@ const i18nStrings = {
|
|
|
3078
3112
|
'modal.subscribe.yahoo.h': 'Thêm lịch vào Yahoo',
|
|
3079
3113
|
'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>',
|
|
3080
3114
|
cancel: 'Hủy bỏ',
|
|
3115
|
+
expired: 'Hết hạn',
|
|
3081
3116
|
},
|
|
3082
3117
|
ro: {
|
|
3083
3118
|
'label.addtocalendar': 'Adauga In Calendar',
|
|
@@ -3098,6 +3133,7 @@ const i18nStrings = {
|
|
|
3098
3133
|
'modal.subscribe.yahoo.h': 'Adauga Calendar in Yahoo',
|
|
3099
3134
|
'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>',
|
|
3100
3135
|
cancel: 'Anuleaza',
|
|
3136
|
+
expired: 'Expirat',
|
|
3101
3137
|
},
|
|
3102
3138
|
};
|
|
3103
3139
|
const availableLanguages = Object.keys(i18nStrings);
|
|
@@ -3131,6 +3167,7 @@ if (isBrowser()) {
|
|
|
3131
3167
|
elem.innerHTML = template;
|
|
3132
3168
|
this.attachShadow({ mode: 'open', delegateFocus: true });
|
|
3133
3169
|
this.shadowRoot.append(elem.content.cloneNode(true));
|
|
3170
|
+
this.loaded = false;
|
|
3134
3171
|
this.initialized = false;
|
|
3135
3172
|
this.data = {};
|
|
3136
3173
|
this.error = false;
|
|
@@ -3143,43 +3180,17 @@ if (isBrowser()) {
|
|
|
3143
3180
|
if (this.data.name == null || this.data.name == '') {
|
|
3144
3181
|
try {
|
|
3145
3182
|
this.data = atcb_read_attributes(this);
|
|
3183
|
+
this.loaded = true;
|
|
3146
3184
|
} catch (e) {
|
|
3147
3185
|
if (this.debug) {
|
|
3148
3186
|
atcb_render_debug_msg(this.shadowRoot, e);
|
|
3149
3187
|
}
|
|
3188
|
+
this.loaded = true;
|
|
3150
3189
|
return;
|
|
3151
3190
|
}
|
|
3152
3191
|
this.data.proKey = '';
|
|
3153
3192
|
}
|
|
3154
|
-
|
|
3155
|
-
if (this.identifier && this.identifier != '') {
|
|
3156
|
-
this.data.identifier = this.identifier;
|
|
3157
|
-
} else {
|
|
3158
|
-
if (this.data.identifier && this.data.identifier != '') {
|
|
3159
|
-
if (!/^[\w\-_]+$/.test(this.data.identifier)) {
|
|
3160
|
-
this.data.identifier = '';
|
|
3161
|
-
if (this.debug) {
|
|
3162
|
-
console.warn('Add to Calendar Button generation: identifier invalid - using auto numbers instead');
|
|
3163
|
-
}
|
|
3164
|
-
} else {
|
|
3165
|
-
this.data.identifier = 'atcb-btn-' + this.data.identifier;
|
|
3166
|
-
}
|
|
3167
|
-
}
|
|
3168
|
-
if (this.data.identifier == null || this.data.identifier == '') {
|
|
3169
|
-
this.data.identifier = 'atcb-btn-' + atcbBtnCount;
|
|
3170
|
-
}
|
|
3171
|
-
this.identifier = this.data.identifier;
|
|
3172
|
-
}
|
|
3173
|
-
this.setAttribute('atcb-button-id', this.data.identifier);
|
|
3174
|
-
this.initialized = true;
|
|
3175
|
-
try {
|
|
3176
|
-
atcb_build_button(this.shadowRoot, this.data, this.debug);
|
|
3177
|
-
} catch (e) {
|
|
3178
|
-
if (this.debug) {
|
|
3179
|
-
atcb_render_debug_msg(this.shadowRoot, e);
|
|
3180
|
-
}
|
|
3181
|
-
return;
|
|
3182
|
-
}
|
|
3193
|
+
this.initButton();
|
|
3183
3194
|
}
|
|
3184
3195
|
disconnectedCallback() {
|
|
3185
3196
|
atcb_cleanup(this.shadowRoot, this.data);
|
|
@@ -3202,10 +3213,10 @@ if (isBrowser()) {
|
|
|
3202
3213
|
if (this.data.proKey != null && this.data.proKey != '') {
|
|
3203
3214
|
return;
|
|
3204
3215
|
}
|
|
3205
|
-
if (!this.
|
|
3216
|
+
if (!this.loaded) {
|
|
3206
3217
|
return;
|
|
3207
3218
|
}
|
|
3208
|
-
if (this.debug) {
|
|
3219
|
+
if (this.debug && this.initialized) {
|
|
3209
3220
|
console.log(`${name}'s value has been changed from ${oldValue} to ${newValue}`);
|
|
3210
3221
|
}
|
|
3211
3222
|
atcb_cleanup(this.shadowRoot, this.data);
|
|
@@ -3222,7 +3233,32 @@ if (isBrowser()) {
|
|
|
3222
3233
|
}
|
|
3223
3234
|
return;
|
|
3224
3235
|
}
|
|
3225
|
-
this.
|
|
3236
|
+
this.initButton();
|
|
3237
|
+
}
|
|
3238
|
+
initButton() {
|
|
3239
|
+
if (!this.initialized) {
|
|
3240
|
+
this.initialized = true;
|
|
3241
|
+
atcbBtnCount = atcbBtnCount + 1;
|
|
3242
|
+
}
|
|
3243
|
+
if (this.identifier && this.identifier != '') {
|
|
3244
|
+
this.data.identifier = this.identifier;
|
|
3245
|
+
} else {
|
|
3246
|
+
if (this.data.identifier && this.data.identifier != '') {
|
|
3247
|
+
if (!/^[\w\-_]+$/.test(this.data.identifier)) {
|
|
3248
|
+
this.data.identifier = '';
|
|
3249
|
+
if (this.debug) {
|
|
3250
|
+
console.warn('Add to Calendar Button generation: identifier invalid - using auto numbers instead');
|
|
3251
|
+
}
|
|
3252
|
+
} else {
|
|
3253
|
+
this.data.identifier = 'atcb-btn-' + this.data.identifier;
|
|
3254
|
+
}
|
|
3255
|
+
}
|
|
3256
|
+
if (this.data.identifier == null || this.data.identifier == '') {
|
|
3257
|
+
this.data.identifier = 'atcb-btn-' + atcbBtnCount;
|
|
3258
|
+
}
|
|
3259
|
+
this.identifier = this.data.identifier;
|
|
3260
|
+
}
|
|
3261
|
+
this.setAttribute('atcb-button-id', this.data.identifier);
|
|
3226
3262
|
try {
|
|
3227
3263
|
atcb_build_button(this.shadowRoot, this.data, this.debug);
|
|
3228
3264
|
} catch (e) {
|
|
@@ -3321,10 +3357,12 @@ function atcb_build_button(host, data, debug = false) {
|
|
|
3321
3357
|
atcb_setup_state_management(data);
|
|
3322
3358
|
atcb_set_global_event_listener(host, data);
|
|
3323
3359
|
atcb_init_log(data.proKey, debug);
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3360
|
+
if (!data.hidden) {
|
|
3361
|
+
atcb_generate_button(host, rootObj, data, debug);
|
|
3362
|
+
if (!data.hideRichData && data.name && data.dates[0].location && data.dates[0].startDate) {
|
|
3363
|
+
atcb_generate_rich_data(data, host.host);
|
|
3364
|
+
data.schemaEl = host.host.previousSibling;
|
|
3365
|
+
}
|
|
3328
3366
|
}
|
|
3329
3367
|
atcb_log_event('initialization', data.identifier, data.identifier);
|
|
3330
3368
|
} else if (debug) {
|
|
@@ -3498,36 +3536,38 @@ function atcb_action(data, triggerElement, keyboardTrigger = false) {
|
|
|
3498
3536
|
}
|
|
3499
3537
|
potentialExistingHost.remove();
|
|
3500
3538
|
}
|
|
3501
|
-
let host = document.createElement('div');
|
|
3502
|
-
host.id = 'atcb-customTrigger-' + data.identifier + '-host';
|
|
3503
|
-
if (root == document.body) {
|
|
3504
|
-
document.body.append(host);
|
|
3505
|
-
} else {
|
|
3506
|
-
root.after(host);
|
|
3507
|
-
}
|
|
3508
|
-
if (triggerElement) {
|
|
3509
|
-
const btnDim = triggerElement.getBoundingClientRect();
|
|
3510
|
-
host.style.position = 'relative';
|
|
3511
|
-
host.style.left = -btnDim.width + 'px';
|
|
3512
|
-
host.style.top = btnDim.height + 'px';
|
|
3513
|
-
}
|
|
3514
|
-
host.setAttribute('atcb-button-id', data.identifier);
|
|
3515
|
-
host.attachShadow({ mode: 'open', delegateFocus: true });
|
|
3516
|
-
const elem = document.createElement('template');
|
|
3517
|
-
elem.innerHTML = template;
|
|
3518
|
-
host.shadowRoot.append(elem.content.cloneNode(true));
|
|
3519
|
-
const rootObj = host.shadowRoot.querySelector('.atcb-initialized');
|
|
3520
|
-
atcb_setup_state_management(data);
|
|
3521
|
-
atcb_set_light_mode(host.shadowRoot, data);
|
|
3522
|
-
host.shadowRoot.querySelector('.atcb-initialized').setAttribute('lang', data.language);
|
|
3523
|
-
atcb_load_css(host.shadowRoot, rootObj, data.buttonStyle, false, false, data.customCss);
|
|
3524
|
-
atcb_set_global_event_listener(host.shadowRoot, data);
|
|
3525
3539
|
atcb_log_event('initialization', data.identifier, data.identifier);
|
|
3526
|
-
if (
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3540
|
+
if (!data.blockInteraction) {
|
|
3541
|
+
let host = document.createElement('div');
|
|
3542
|
+
host.id = 'atcb-customTrigger-' + data.identifier + '-host';
|
|
3543
|
+
if (root == document.body) {
|
|
3544
|
+
document.body.append(host);
|
|
3545
|
+
} else {
|
|
3546
|
+
root.after(host);
|
|
3547
|
+
}
|
|
3548
|
+
if (triggerElement) {
|
|
3549
|
+
const btnDim = triggerElement.getBoundingClientRect();
|
|
3550
|
+
host.style.position = 'relative';
|
|
3551
|
+
host.style.left = -btnDim.width + 'px';
|
|
3552
|
+
host.style.top = btnDim.height + 'px';
|
|
3553
|
+
}
|
|
3554
|
+
host.setAttribute('atcb-button-id', data.identifier);
|
|
3555
|
+
host.attachShadow({ mode: 'open', delegateFocus: true });
|
|
3556
|
+
const elem = document.createElement('template');
|
|
3557
|
+
elem.innerHTML = template;
|
|
3558
|
+
host.shadowRoot.append(elem.content.cloneNode(true));
|
|
3559
|
+
const rootObj = host.shadowRoot.querySelector('.atcb-initialized');
|
|
3560
|
+
atcb_setup_state_management(data);
|
|
3561
|
+
atcb_set_light_mode(host.shadowRoot, data);
|
|
3562
|
+
host.shadowRoot.querySelector('.atcb-initialized').setAttribute('lang', data.language);
|
|
3563
|
+
atcb_load_css(host.shadowRoot, rootObj, data.buttonStyle, false, false, data.customCss);
|
|
3564
|
+
atcb_set_global_event_listener(host.shadowRoot, data);
|
|
3565
|
+
if (oneOption) {
|
|
3566
|
+
atcb_generate_links(host.shadowRoot, data.options[0], data, 'all', keyboardTrigger);
|
|
3567
|
+
atcb_log_event('openSingletonLink', data.identifier, data.identifier);
|
|
3568
|
+
} else {
|
|
3569
|
+
atcb_toggle(host.shadowRoot, 'open', data, triggerElement, keyboardTrigger);
|
|
3570
|
+
}
|
|
3531
3571
|
}
|
|
3532
3572
|
atcb_init_log(data.proKey, data.debug);
|
|
3533
3573
|
if (data.debug) {
|
|
@@ -3556,8 +3596,7 @@ function atcb_init_log(pro = '', debug = false) {
|
|
|
3556
3596
|
if (pro != '') {
|
|
3557
3597
|
console.log('Add to Calendar PRO script initialized' + versionOutput + ' | https://add-to-calendar-pro.com');
|
|
3558
3598
|
} else {
|
|
3559
|
-
console.log('%
|
|
3560
|
-
console.log('see https://add-to-calendar-button.com for details');
|
|
3599
|
+
console.log('%c\nAdd to Calendar Button script initialized' + versionOutput + '\n' + 'see https://add-to-calendar-button.com for details.\n', 'font-weight: bold;');
|
|
3561
3600
|
}
|
|
3562
3601
|
atcbInitialGlobalInit = true;
|
|
3563
3602
|
}
|
|
@@ -3586,7 +3625,7 @@ function atcb_set_global_event_listener(host, data) {
|
|
|
3586
3625
|
lightModeMutationObserver[data.identifier].observe(document.documentElement, { attributes: true });
|
|
3587
3626
|
lightModeMutationObserver[data.identifier].observe(document.body, { attributes: true });
|
|
3588
3627
|
}
|
|
3589
|
-
if (!atcbInitialGlobalInit
|
|
3628
|
+
if (!atcbInitialGlobalInit) {
|
|
3590
3629
|
document.addEventListener('keyup', atcb_global_listener_keyup);
|
|
3591
3630
|
document.addEventListener('keydown', atcb_global_listener_keydown);
|
|
3592
3631
|
window.addEventListener('resize', atcb_global_listener_resize);
|