add-to-calendar-button 2.2.2 → 2.2.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/README.md +1 -0
- package/dist/atcb.js +2 -2
- package/dist/commonjs/index.js +166 -106
- package/dist/module/index.js +166 -106
- package/package.json +9 -10
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.4
|
|
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.4';
|
|
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) {
|
|
@@ -437,11 +440,15 @@ function atcb_decorate_data_meta(data) {
|
|
|
437
440
|
}
|
|
438
441
|
function atcb_decorate_data_description(data, i) {
|
|
439
442
|
if (data.dates[`${i}`].description != null && data.dates[`${i}`].description != '') {
|
|
443
|
+
data.dates[`${i}`].description = data.dates[`${i}`].description.replace(/(\\r\\n|\\n|\\r|<br(\s|\s\/|\/|)>)/g, '');
|
|
440
444
|
data.dates[`${i}`].descriptionHtmlFree = atcb_rewrite_html_elements(data.dates[`${i}`].description, true);
|
|
445
|
+
data.dates[`${i}`].descriptionHtmlFreeICal = atcb_rewrite_html_elements(data.dates[`${i}`].description, true, true);
|
|
441
446
|
data.dates[`${i}`].description = atcb_rewrite_html_elements(data.dates[`${i}`].description);
|
|
442
447
|
} else {
|
|
443
448
|
if (data.dates[`${i}`].description == null && data.description != null && data.description != '') {
|
|
449
|
+
data.description = data.description.replace(/(\\r\\n|\\n|\\r|<br(\s|\s\/|\/|)>)/g, '');
|
|
444
450
|
data.dates[`${i}`].descriptionHtmlFree = atcb_rewrite_html_elements(data.description, true);
|
|
451
|
+
data.dates[`${i}`].descriptionHtmlFreeICal = atcb_rewrite_html_elements(data.description, true, true);
|
|
445
452
|
data.dates[`${i}`].description = atcb_rewrite_html_elements(data.description);
|
|
446
453
|
} else {
|
|
447
454
|
data.dates[`${i}`].descriptionHtmlFree = data.dates[`${i}`].description = '';
|
|
@@ -1160,7 +1167,12 @@ function atcb_generate_label(host, data, parent, type, icon = false, text = '',
|
|
|
1160
1167
|
atcb_generate_label_content(data, parent, type, icon, text, oneOption);
|
|
1161
1168
|
}
|
|
1162
1169
|
function atcb_generate_label_content(data, parent, type, icon, text, oneOption) {
|
|
1163
|
-
const defaultTriggerText =
|
|
1170
|
+
const defaultTriggerText = (function () {
|
|
1171
|
+
if (data.dates[0].overdue && data.pastDateHandling != 'none') {
|
|
1172
|
+
return atcb_translate_hook('expired', data);
|
|
1173
|
+
}
|
|
1174
|
+
return atcb_translate_hook('label.addtocalendar', data);
|
|
1175
|
+
})();
|
|
1164
1176
|
if (oneOption && text == '') {
|
|
1165
1177
|
text = defaultTriggerText;
|
|
1166
1178
|
}
|
|
@@ -1211,6 +1223,10 @@ function atcb_generate_button(host, button, data, debug = false) {
|
|
|
1211
1223
|
atcb_set_sizes(buttonTriggerWrapper, data.sizes);
|
|
1212
1224
|
const buttonTrigger = document.createElement('button');
|
|
1213
1225
|
buttonTrigger.classList.add('atcb-button');
|
|
1226
|
+
if (data.disabled) {
|
|
1227
|
+
buttonTrigger.setAttribute('disabled', true);
|
|
1228
|
+
buttonTrigger.style.cssText = 'opacity: .75; cursor: not-allowed; filter: brightness(95%); border-style: dashed;';
|
|
1229
|
+
}
|
|
1214
1230
|
if (data.hideTextLabelButton) {
|
|
1215
1231
|
buttonTrigger.classList.add('atcb-no-text');
|
|
1216
1232
|
}
|
|
@@ -1238,7 +1254,7 @@ function atcb_generate_button(host, button, data, debug = false) {
|
|
|
1238
1254
|
buttonDropdownAnchor.classList.add('atcb-dropdown-anchor');
|
|
1239
1255
|
buttonTrigger.append(buttonDropdownAnchor);
|
|
1240
1256
|
}
|
|
1241
|
-
if (!data.hideCheckmark && !data.hideTextLabelButton && !data.buttonsList) {
|
|
1257
|
+
if (!data.hideCheckmark && !data.hideTextLabelButton && !data.buttonsList && !data.disabled) {
|
|
1242
1258
|
const btnCheck = document.createElement('div');
|
|
1243
1259
|
btnCheck.classList.add('atcb-checkmark');
|
|
1244
1260
|
btnCheck.innerHTML = atcbIcon['checkmark'];
|
|
@@ -1577,6 +1593,9 @@ function atcb_generate_date_button(data, parent, subEvent = 'all') {
|
|
|
1577
1593
|
if (subEvent != 'all' && data.dates[`${subEvent}`].status == 'CANCELLED') {
|
|
1578
1594
|
return atcb_translate_hook('date.status.cancelled', data) + '<br>' + atcb_translate_hook('date.status.cancelled.cta', data);
|
|
1579
1595
|
}
|
|
1596
|
+
if (data.dates[`${subEvent}`].overdue && data.pastDateHandling != 'none') {
|
|
1597
|
+
return atcb_translate_hook('expired', data);
|
|
1598
|
+
}
|
|
1580
1599
|
return '+ ' + atcb_translate_hook('label.addtocalendar', data);
|
|
1581
1600
|
})();
|
|
1582
1601
|
const cancelledInfo = (function () {
|
|
@@ -1871,25 +1890,28 @@ function atcb_generate_rich_data_recurrence(data, formattedDate) {
|
|
|
1871
1890
|
|
|
1872
1891
|
|
|
1873
1892
|
function atcb_generate_links(host, type, data, subEvent = 'all', keyboardTrigger = false, multiDateModal = false) {
|
|
1893
|
+
let linkType = type;
|
|
1894
|
+
if (type == 'apple') {
|
|
1895
|
+
linkType = 'ical';
|
|
1896
|
+
}
|
|
1897
|
+
if (isMobile() && (type == 'msteams' || type == 'ms365' || type == 'outlookcom')) {
|
|
1898
|
+
linkType = 'ical';
|
|
1899
|
+
}
|
|
1874
1900
|
if (subEvent != 'all') {
|
|
1875
1901
|
subEvent = parseInt(subEvent) - 1;
|
|
1876
1902
|
} else if (data.dates.length == 1) {
|
|
1877
1903
|
subEvent = 0;
|
|
1878
1904
|
}
|
|
1879
1905
|
if (data.subscribe) {
|
|
1880
|
-
atcb_generate_subscribe_links(host,
|
|
1906
|
+
atcb_generate_subscribe_links(host, linkType, data, keyboardTrigger);
|
|
1881
1907
|
return;
|
|
1882
1908
|
}
|
|
1883
|
-
if (isMobile() && (type == 'msteams' || type == 'ms365' || type == 'outlookcom')) {
|
|
1884
|
-
type = 'ical';
|
|
1885
|
-
}
|
|
1886
1909
|
if (subEvent != 'all') {
|
|
1887
|
-
if (data.dates[`${subEvent}`].status == 'CANCELLED' &&
|
|
1910
|
+
if (data.dates[`${subEvent}`].status == 'CANCELLED' && linkType != 'ical') {
|
|
1888
1911
|
atcb_create_modal(host, data, 'warning', atcb_translate_hook('date.status.cancelled', data), atcb_translate_hook('date.status.cancelled.cta', data), [], [], keyboardTrigger);
|
|
1889
1912
|
} else {
|
|
1890
|
-
switch (
|
|
1891
|
-
case '
|
|
1892
|
-
case 'ical':
|
|
1913
|
+
switch (linkType) {
|
|
1914
|
+
case 'ical': // also for apple (see above)
|
|
1893
1915
|
atcb_generate_ical(host, data, subEvent, keyboardTrigger);
|
|
1894
1916
|
break;
|
|
1895
1917
|
case 'google':
|
|
@@ -1925,12 +1947,11 @@ function atcb_generate_links(host, type, data, subEvent = 'all', keyboardTrigger
|
|
|
1925
1947
|
}
|
|
1926
1948
|
return;
|
|
1927
1949
|
}
|
|
1928
|
-
atcb_generate_multidate_links(host, type, data, keyboardTrigger, multiDateModal);
|
|
1950
|
+
atcb_generate_multidate_links(host, type, linkType, data, keyboardTrigger, multiDateModal);
|
|
1929
1951
|
}
|
|
1930
|
-
function atcb_generate_multidate_links(host, type, data, keyboardTrigger, multiDateModal) {
|
|
1952
|
+
function atcb_generate_multidate_links(host, type, linkType, data, keyboardTrigger, multiDateModal) {
|
|
1931
1953
|
if (
|
|
1932
|
-
(
|
|
1933
|
-
data.dates.every(function (theSubEvent) {
|
|
1954
|
+
(linkType == 'ical') && data.dates.every(function (theSubEvent) {
|
|
1934
1955
|
if (theSubEvent.status == 'CANCELLED' || (theSubEvent.organizer != null && theSubEvent.organizer != '')) {
|
|
1935
1956
|
return false;
|
|
1936
1957
|
}
|
|
@@ -1952,11 +1973,10 @@ function atcb_generate_multidate_links(host, type, data, keyboardTrigger, multiD
|
|
|
1952
1973
|
atcb_create_modal(host, data, type, atcb_translate_hook('modal.multidate.h', data), atcb_translate_hook('modal.multidate.text', data), [], individualButtons, keyboardTrigger);
|
|
1953
1974
|
}
|
|
1954
1975
|
}
|
|
1955
|
-
function atcb_generate_subscribe_links(host,
|
|
1976
|
+
function atcb_generate_subscribe_links(host, linkType, data, keyboardTrigger) {
|
|
1956
1977
|
const adjustedFileUrl = data.icsFile.replace('https://', 'webcal://');
|
|
1957
|
-
switch (
|
|
1958
|
-
case '
|
|
1959
|
-
case 'ical':
|
|
1978
|
+
switch (linkType) {
|
|
1979
|
+
case 'ical': // also for apple (see above)
|
|
1960
1980
|
atcb_subscribe_ical(adjustedFileUrl);
|
|
1961
1981
|
break;
|
|
1962
1982
|
case 'google':
|
|
@@ -2133,7 +2153,7 @@ function atcb_generate_microsoft(data, type = '365') {
|
|
|
2133
2153
|
urlParts.push('location=' + encodeURIComponent(data.location));
|
|
2134
2154
|
}
|
|
2135
2155
|
if (data.description != null && data.description != '') {
|
|
2136
|
-
urlParts.push('body=' + encodeURIComponent(data.description
|
|
2156
|
+
urlParts.push('body=' + encodeURIComponent(data.description));
|
|
2137
2157
|
}
|
|
2138
2158
|
urlParts.push('uid=' + encodeURIComponent(data.uid));
|
|
2139
2159
|
atcb_open_cal_url(urlParts.join('&'));
|
|
@@ -2236,25 +2256,25 @@ function atcb_generate_ical(host, data, subEvent = 'all', keyboardTrigger = fals
|
|
|
2236
2256
|
ics_lines.push('DTSTAMP:' + atcb_format_datetime(now, 'clean', true));
|
|
2237
2257
|
ics_lines.push('DTSTART' + timeAddon + ':' + formattedDate.start);
|
|
2238
2258
|
ics_lines.push('DTEND' + timeAddon + ':' + formattedDate.end);
|
|
2239
|
-
ics_lines.push('SUMMARY:' + data.dates[`${i}`].name
|
|
2240
|
-
if (data.dates[`${i}`].
|
|
2259
|
+
ics_lines.push('SUMMARY:' + atcb_rewrite_ical_text(data.dates[`${i}`].name, true));
|
|
2260
|
+
if (data.dates[`${i}`].descriptionHtmlFreeICal != null && data.dates[`${i}`].descriptionHtmlFreeICal != '') {
|
|
2241
2261
|
ics_lines.push(
|
|
2242
|
-
'DESCRIPTION:' + data.dates[`${i}`].
|
|
2262
|
+
'DESCRIPTION:' + atcb_rewrite_ical_text(data.dates[`${i}`].descriptionHtmlFreeICal, true)
|
|
2243
2263
|
);
|
|
2244
2264
|
}
|
|
2245
2265
|
if (data.dates[`${i}`].description != null && data.dates[`${i}`].description != '') {
|
|
2246
|
-
ics_lines.push('X-ALT-DESC;FMTTYPE=text/html:\r\n <!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 3.2//EN"">\r\n <HTML><BODY>\r\n ' + data.dates[`${i}`].description
|
|
2266
|
+
ics_lines.push('X-ALT-DESC;FMTTYPE=text/html:\r\n <!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 3.2//EN"">\r\n <HTML><BODY>\r\n ' + atcb_rewrite_ical_text(data.dates[`${i}`].description, true) + '\r\n </BODY></HTML>');
|
|
2247
2267
|
}
|
|
2248
2268
|
if (data.dates[`${i}`].location != null && data.dates[`${i}`].location != '') {
|
|
2249
|
-
ics_lines.push('LOCATION:' + data.dates[`${i}`].location);
|
|
2269
|
+
ics_lines.push('LOCATION:' + atcb_rewrite_ical_text(data.dates[`${i}`].location, true));
|
|
2250
2270
|
}
|
|
2251
2271
|
if (data.dates[`${i}`].organizer != null && data.dates[`${i}`].organizer != '') {
|
|
2252
2272
|
const organizerParts = data.dates[`${i}`].organizer.split('|');
|
|
2253
|
-
ics_lines.push('ORGANIZER;CN=' + organizerParts[0] + ':MAILTO:' + organizerParts[1]);
|
|
2273
|
+
ics_lines.push('ORGANIZER;CN="' + atcb_rewrite_ical_text(organizerParts[0], false, true) + '":MAILTO:' + organizerParts[1]);
|
|
2254
2274
|
}
|
|
2255
2275
|
if (data.dates[`${i}`].attendee != null && data.dates[`${i}`].attendee != '') {
|
|
2256
2276
|
const attendeeParts = data.dates[`${i}`].attendee.split('|');
|
|
2257
|
-
ics_lines.push('ATTENDEE;ROLE=REQ-PARTICIPANT;CN=' + attendeeParts[0] + ':MAILTO:' + attendeeParts[1]);
|
|
2277
|
+
ics_lines.push('ATTENDEE;ROLE=REQ-PARTICIPANT;CN="' + atcb_rewrite_ical_text(attendeeParts[0], false, true) + '":MAILTO:' + attendeeParts[1]);
|
|
2258
2278
|
}
|
|
2259
2279
|
if (data.recurrence != null && data.recurrence != '') {
|
|
2260
2280
|
ics_lines.push(data.recurrence);
|
|
@@ -2456,11 +2476,16 @@ function atcb_validEmail(email, mx = false) {
|
|
|
2456
2476
|
}
|
|
2457
2477
|
return true;
|
|
2458
2478
|
}
|
|
2459
|
-
function atcb_rewrite_html_elements(content, clear = false) {
|
|
2460
|
-
content = content.replace(/<br\s*\/?>/gi, '\n');
|
|
2479
|
+
function atcb_rewrite_html_elements(content, clear = false, iCalBreaks = false) {
|
|
2461
2480
|
if (clear) {
|
|
2462
|
-
content = content.replace(/\[(|\/)(url|
|
|
2463
|
-
content = content.replace(/\{(|\/)(url|
|
|
2481
|
+
content = content.replace(/\[(|\/)(url|hr|p|b|strong|u|i|em|li|ul|ol|h\d)\]|((\|.*)\[\/url\])/gi, '');
|
|
2482
|
+
content = content.replace(/\{(|\/)(url|hr|p|b|strong|u|i|em|li|ul|ol|h\d)\}|((\|.*)\{\/url\})/gi, '');
|
|
2483
|
+
if (iCalBreaks) {
|
|
2484
|
+
content = content.replace(/(\[br\]|\{br\})/gi, '\\n');
|
|
2485
|
+
} else {
|
|
2486
|
+
content = content.replace(/(\[br\]|\{br\})/gi, ' ');
|
|
2487
|
+
}
|
|
2488
|
+
content = content.replace(/&[#a-zA-Z0-9]{1,9};/gi, '');
|
|
2464
2489
|
} else {
|
|
2465
2490
|
content = content.replace(/\[(\/|)(br|hr|p|b|strong|u|i|em|li|ul|ol|h\d)\]/gi, '<$1$2>');
|
|
2466
2491
|
content = content.replace(/\{(\/|)(br|hr|p|b|strong|u|i|em|li|ul|ol|h\d)\}/gi, '<$1$2>');
|
|
@@ -2484,6 +2509,17 @@ function atcb_parse_url_code(input) {
|
|
|
2484
2509
|
})();
|
|
2485
2510
|
return '<a href="' + urlText[0] + '" target="' + atcbDefaultTarget + '" rel="noopener">' + text + '</a>';
|
|
2486
2511
|
}
|
|
2512
|
+
function atcb_rewrite_ical_text(content, truncate = true, inQuotes = false) {
|
|
2513
|
+
if (inQuotes) {
|
|
2514
|
+
content = content.replace(/"/g, '');
|
|
2515
|
+
} else {
|
|
2516
|
+
content = content.replace(/\\/g, '\\\\').replace(/(,|;)/g, '\\$1');
|
|
2517
|
+
}
|
|
2518
|
+
if (truncate) {
|
|
2519
|
+
content = content.replace(/.{60}/g, '$&' + '\r\n ');
|
|
2520
|
+
}
|
|
2521
|
+
return content;
|
|
2522
|
+
}
|
|
2487
2523
|
function atcb_position_list(host, trigger, list, blockUpwards = false, resize = false) {
|
|
2488
2524
|
let anchorSet = false;
|
|
2489
2525
|
const originalTrigger = trigger;
|
|
@@ -2698,6 +2734,7 @@ const i18nStrings = {
|
|
|
2698
2734
|
'modal.subscribe.yahoo.h': 'Add Calendar to Yahoo',
|
|
2699
2735
|
'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
2736
|
cancel: 'Cancel',
|
|
2737
|
+
expired: 'Expired',
|
|
2701
2738
|
},
|
|
2702
2739
|
de: {
|
|
2703
2740
|
'label.addtocalendar': 'Im Kalender speichern',
|
|
@@ -2718,6 +2755,7 @@ const i18nStrings = {
|
|
|
2718
2755
|
'modal.subscribe.yahoo.h': 'Kalender zu Yahoo hinzufügen',
|
|
2719
2756
|
'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
2757
|
cancel: 'Abbrechen',
|
|
2758
|
+
expired: 'Abgelaufen',
|
|
2721
2759
|
},
|
|
2722
2760
|
es: {
|
|
2723
2761
|
'label.addtocalendar': 'Añadir al Calendario',
|
|
@@ -2738,6 +2776,7 @@ const i18nStrings = {
|
|
|
2738
2776
|
'modal.subscribe.yahoo.h': 'Añadir calendario a Yahoo',
|
|
2739
2777
|
'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
2778
|
cancel: 'Cancelar',
|
|
2779
|
+
expired: 'Caducada',
|
|
2741
2780
|
},
|
|
2742
2781
|
pt: {
|
|
2743
2782
|
'label.addtocalendar': 'Incluir no Calendário',
|
|
@@ -2758,6 +2797,7 @@ const i18nStrings = {
|
|
|
2758
2797
|
'modal.subscribe.yahoo.h': 'Adicionar calendário ao Yahoo',
|
|
2759
2798
|
'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
2799
|
cancel: 'Cancelar',
|
|
2800
|
+
expired: 'Expirada',
|
|
2761
2801
|
},
|
|
2762
2802
|
fr: {
|
|
2763
2803
|
'label.addtocalendar': "Ajouter à l'Agenda",
|
|
@@ -2778,6 +2818,7 @@ const i18nStrings = {
|
|
|
2778
2818
|
'modal.subscribe.yahoo.h': 'Ajouter un agenda à Yahoo',
|
|
2779
2819
|
'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
2820
|
cancel: 'Annuler',
|
|
2821
|
+
expired: 'Expiré',
|
|
2781
2822
|
},
|
|
2782
2823
|
nl: {
|
|
2783
2824
|
'label.addtocalendar': 'Opslaan in Agenda',
|
|
@@ -2798,6 +2839,7 @@ const i18nStrings = {
|
|
|
2798
2839
|
'modal.subscribe.yahoo.h': 'Toevoegen aan Yahoo',
|
|
2799
2840
|
'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
2841
|
cancel: 'Annuleren',
|
|
2842
|
+
expired: 'Verlopen',
|
|
2801
2843
|
},
|
|
2802
2844
|
tr: {
|
|
2803
2845
|
'label.addtocalendar': 'Takvime Ekle',
|
|
@@ -2818,6 +2860,7 @@ const i18nStrings = {
|
|
|
2818
2860
|
'modal.subscribe.yahoo.h': "Yahoo'ya takvim ekleme",
|
|
2819
2861
|
'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
2862
|
cancel: 'İptal',
|
|
2863
|
+
expired: 'Günü geçmiş',
|
|
2821
2864
|
},
|
|
2822
2865
|
zh: {
|
|
2823
2866
|
'label.addtocalendar': '添加到日历',
|
|
@@ -2838,6 +2881,7 @@ const i18nStrings = {
|
|
|
2838
2881
|
'modal.subscribe.yahoo.h': '将日历添加到 Yahoo',
|
|
2839
2882
|
'modal.subscribe.yahoo.text': '<ol><li>打开 Yahoo 日历。</li><li>点击“操作”标签。</li><li>选择“关注其他日历”。</li><li>选择一个名称并将剪贴板中的 URL 粘贴到 URL 字段中。</li></ol>',
|
|
2840
2883
|
cancel: '中止',
|
|
2884
|
+
expired: '已到期',
|
|
2841
2885
|
},
|
|
2842
2886
|
ar: {
|
|
2843
2887
|
'label.addtocalendar': 'إضافة إلى التقويم',
|
|
@@ -2858,6 +2902,7 @@ const i18nStrings = {
|
|
|
2858
2902
|
'modal.subscribe.yahoo.h': 'أضف التقويم إلى Yahoo',
|
|
2859
2903
|
'modal.subscribe.yahoo.text': '<ol><li>افتح تقويم Yahoo.</li><li>انقر فوق علامة التبويب "الإجراءات".</li><li>حدد "متابعة تقويمات أخرى".</li><li>اختر اسمًا والصق عنوان URL من الحافظة الخاصة بك في حقل URL.</li></ol>',
|
|
2860
2904
|
cancel: 'إحباط',
|
|
2905
|
+
expired: 'منتهي الصلاحية',
|
|
2861
2906
|
},
|
|
2862
2907
|
hi: {
|
|
2863
2908
|
'label.addtocalendar': 'कैलेंडर में जोड़ें',
|
|
@@ -2878,6 +2923,7 @@ const i18nStrings = {
|
|
|
2878
2923
|
'modal.subscribe.yahoo.h': 'Yahoo . में कैलेंडर जोड़ें',
|
|
2879
2924
|
'modal.subscribe.yahoo.text': '<ol><li>Yahoo कैलेंडर खोलें।</li><li>"कृती" टैब पर क्लिक करें।</li><li>"इतर कॅलेंडर्सचे अनुसरण करा" चुनें।</li><li>एक नाम चुनें और अपने क्लिपबोर्ड से URL को URL फ़ील्ड में पेस्ट करें।</li></ol>',
|
|
2880
2925
|
cancel: 'रद्द करना',
|
|
2926
|
+
expired: 'खत्म हो चुका',
|
|
2881
2927
|
},
|
|
2882
2928
|
pl: {
|
|
2883
2929
|
'label.addtocalendar': 'Dodaj do kalendarza',
|
|
@@ -2898,6 +2944,7 @@ const i18nStrings = {
|
|
|
2898
2944
|
'modal.subscribe.yahoo.h': 'Dodaj kalendarz do Yahoo',
|
|
2899
2945
|
'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
2946
|
cancel: 'Anuluj',
|
|
2947
|
+
expired: 'Wygasły',
|
|
2901
2948
|
},
|
|
2902
2949
|
id: {
|
|
2903
2950
|
'label.addtocalendar': 'Tambahkan ke Kalender',
|
|
@@ -2918,6 +2965,7 @@ const i18nStrings = {
|
|
|
2918
2965
|
'modal.subscribe.yahoo.h': 'Tambahkan kalender ke Yahoo',
|
|
2919
2966
|
'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
2967
|
cancel: 'Batal',
|
|
2968
|
+
expired: 'Kedaluwarsa',
|
|
2921
2969
|
},
|
|
2922
2970
|
no: {
|
|
2923
2971
|
'label.addtocalendar': 'Legg til i kalenderen',
|
|
@@ -2938,6 +2986,7 @@ const i18nStrings = {
|
|
|
2938
2986
|
'modal.subscribe.yahoo.h': 'Legg til kalender til Yahoo',
|
|
2939
2987
|
'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
2988
|
cancel: 'Avbryt',
|
|
2989
|
+
expired: 'Utløpt',
|
|
2941
2990
|
},
|
|
2942
2991
|
fi: {
|
|
2943
2992
|
'label.addtocalendar': 'Lisää kalenteriin',
|
|
@@ -2958,6 +3007,7 @@ const i18nStrings = {
|
|
|
2958
3007
|
'modal.subscribe.yahoo.h': 'Lisää kalenteri Yahoo',
|
|
2959
3008
|
'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
3009
|
cancel: 'Peruuta',
|
|
3010
|
+
expired: 'Vanhentunut',
|
|
2961
3011
|
},
|
|
2962
3012
|
sv: {
|
|
2963
3013
|
'label.addtocalendar': 'Lägg till i kalender',
|
|
@@ -2978,6 +3028,7 @@ const i18nStrings = {
|
|
|
2978
3028
|
'modal.subscribe.yahoo.h': 'Lägg till kalender i Yahoo',
|
|
2979
3029
|
'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
3030
|
cancel: 'Avbryt',
|
|
3031
|
+
expired: 'Utgånget',
|
|
2981
3032
|
},
|
|
2982
3033
|
cs: {
|
|
2983
3034
|
'label.addtocalendar': 'Přidat do kalendáře',
|
|
@@ -2998,6 +3049,7 @@ const i18nStrings = {
|
|
|
2998
3049
|
'modal.subscribe.yahoo.h': 'Přidat kalendář do Yahoo',
|
|
2999
3050
|
'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
3051
|
cancel: 'Storno',
|
|
3052
|
+
expired: 'Platnost vypršela',
|
|
3001
3053
|
},
|
|
3002
3054
|
ja: {
|
|
3003
3055
|
'label.addtocalendar': 'カレンダーに追加',
|
|
@@ -3018,6 +3070,7 @@ const i18nStrings = {
|
|
|
3018
3070
|
'modal.subscribe.yahoo.h': 'Yahooにカレンダーを追加する',
|
|
3019
3071
|
'modal.subscribe.yahoo.text': '<ol><li>Yahooカレンダーを開く。</li><li>[実行] タブをクリックします。</li><li>[その他のカレンダーのフォロー] を選択します。</li><li>名前を決めて、クリップボードにあるURLをURL欄に貼り付けます。</li></ol>',
|
|
3020
3072
|
cancel: 'キャンセル',
|
|
3073
|
+
expired: '期限切れ',
|
|
3021
3074
|
},
|
|
3022
3075
|
it: {
|
|
3023
3076
|
'label.addtocalendar': 'Aggiungi al calendario',
|
|
@@ -3038,6 +3091,7 @@ const i18nStrings = {
|
|
|
3038
3091
|
'modal.subscribe.yahoo.h': 'Aggiungi il calendario a Yahoo',
|
|
3039
3092
|
'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
3093
|
cancel: 'Annulla',
|
|
3094
|
+
expired: 'Scaduta',
|
|
3041
3095
|
},
|
|
3042
3096
|
ko: {
|
|
3043
3097
|
'label.addtocalendar': '캘린더에 추가',
|
|
@@ -3058,6 +3112,7 @@ const i18nStrings = {
|
|
|
3058
3112
|
'modal.subscribe.yahoo.h': 'Yahoo에 캘린더 추가',
|
|
3059
3113
|
'modal.subscribe.yahoo.text': '<ol><li>Yahoo 캘린더를 엽니다.</li><li>"동작" 탭을 클릭합니다.</li><li>"다른 일정관리 팔로우"를 선택합니다.</li><li>이름을 선택하고 클립보드의 URL을 URL 필드에 붙여넣습니다.</li></ol>',
|
|
3060
3114
|
cancel: '취소',
|
|
3115
|
+
expired: '만료됨',
|
|
3061
3116
|
},
|
|
3062
3117
|
vi: {
|
|
3063
3118
|
'label.addtocalendar': 'Thêm vào Lịch',
|
|
@@ -3078,6 +3133,7 @@ const i18nStrings = {
|
|
|
3078
3133
|
'modal.subscribe.yahoo.h': 'Thêm lịch vào Yahoo',
|
|
3079
3134
|
'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
3135
|
cancel: 'Hủy bỏ',
|
|
3136
|
+
expired: 'Hết hạn',
|
|
3081
3137
|
},
|
|
3082
3138
|
ro: {
|
|
3083
3139
|
'label.addtocalendar': 'Adauga In Calendar',
|
|
@@ -3098,6 +3154,7 @@ const i18nStrings = {
|
|
|
3098
3154
|
'modal.subscribe.yahoo.h': 'Adauga Calendar in Yahoo',
|
|
3099
3155
|
'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
3156
|
cancel: 'Anuleaza',
|
|
3157
|
+
expired: 'Expirat',
|
|
3101
3158
|
},
|
|
3102
3159
|
};
|
|
3103
3160
|
const availableLanguages = Object.keys(i18nStrings);
|
|
@@ -3131,6 +3188,7 @@ if (isBrowser()) {
|
|
|
3131
3188
|
elem.innerHTML = template;
|
|
3132
3189
|
this.attachShadow({ mode: 'open', delegateFocus: true });
|
|
3133
3190
|
this.shadowRoot.append(elem.content.cloneNode(true));
|
|
3191
|
+
this.loaded = false;
|
|
3134
3192
|
this.initialized = false;
|
|
3135
3193
|
this.data = {};
|
|
3136
3194
|
this.error = false;
|
|
@@ -3143,43 +3201,17 @@ if (isBrowser()) {
|
|
|
3143
3201
|
if (this.data.name == null || this.data.name == '') {
|
|
3144
3202
|
try {
|
|
3145
3203
|
this.data = atcb_read_attributes(this);
|
|
3204
|
+
this.loaded = true;
|
|
3146
3205
|
} catch (e) {
|
|
3147
3206
|
if (this.debug) {
|
|
3148
3207
|
atcb_render_debug_msg(this.shadowRoot, e);
|
|
3149
3208
|
}
|
|
3209
|
+
this.loaded = true;
|
|
3150
3210
|
return;
|
|
3151
3211
|
}
|
|
3152
3212
|
this.data.proKey = '';
|
|
3153
3213
|
}
|
|
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
|
-
}
|
|
3214
|
+
this.initButton();
|
|
3183
3215
|
}
|
|
3184
3216
|
disconnectedCallback() {
|
|
3185
3217
|
atcb_cleanup(this.shadowRoot, this.data);
|
|
@@ -3202,10 +3234,10 @@ if (isBrowser()) {
|
|
|
3202
3234
|
if (this.data.proKey != null && this.data.proKey != '') {
|
|
3203
3235
|
return;
|
|
3204
3236
|
}
|
|
3205
|
-
if (!this.
|
|
3237
|
+
if (!this.loaded) {
|
|
3206
3238
|
return;
|
|
3207
3239
|
}
|
|
3208
|
-
if (this.debug) {
|
|
3240
|
+
if (this.debug && this.initialized) {
|
|
3209
3241
|
console.log(`${name}'s value has been changed from ${oldValue} to ${newValue}`);
|
|
3210
3242
|
}
|
|
3211
3243
|
atcb_cleanup(this.shadowRoot, this.data);
|
|
@@ -3222,7 +3254,32 @@ if (isBrowser()) {
|
|
|
3222
3254
|
}
|
|
3223
3255
|
return;
|
|
3224
3256
|
}
|
|
3225
|
-
this.
|
|
3257
|
+
this.initButton();
|
|
3258
|
+
}
|
|
3259
|
+
initButton() {
|
|
3260
|
+
if (!this.initialized) {
|
|
3261
|
+
this.initialized = true;
|
|
3262
|
+
atcbBtnCount = atcbBtnCount + 1;
|
|
3263
|
+
}
|
|
3264
|
+
if (this.identifier && this.identifier != '') {
|
|
3265
|
+
this.data.identifier = this.identifier;
|
|
3266
|
+
} else {
|
|
3267
|
+
if (this.data.identifier && this.data.identifier != '') {
|
|
3268
|
+
if (!/^[\w\-_]+$/.test(this.data.identifier)) {
|
|
3269
|
+
this.data.identifier = '';
|
|
3270
|
+
if (this.debug) {
|
|
3271
|
+
console.warn('Add to Calendar Button generation: identifier invalid - using auto numbers instead');
|
|
3272
|
+
}
|
|
3273
|
+
} else {
|
|
3274
|
+
this.data.identifier = 'atcb-btn-' + this.data.identifier;
|
|
3275
|
+
}
|
|
3276
|
+
}
|
|
3277
|
+
if (this.data.identifier == null || this.data.identifier == '') {
|
|
3278
|
+
this.data.identifier = 'atcb-btn-' + atcbBtnCount;
|
|
3279
|
+
}
|
|
3280
|
+
this.identifier = this.data.identifier;
|
|
3281
|
+
}
|
|
3282
|
+
this.setAttribute('atcb-button-id', this.data.identifier);
|
|
3226
3283
|
try {
|
|
3227
3284
|
atcb_build_button(this.shadowRoot, this.data, this.debug);
|
|
3228
3285
|
} catch (e) {
|
|
@@ -3243,7 +3300,7 @@ function atcb_read_attributes(el) {
|
|
|
3243
3300
|
for (let i = 0; i < atcbWcParams.length; i++) {
|
|
3244
3301
|
let attr = atcbWcParams[`${i}`];
|
|
3245
3302
|
if (el.hasAttribute(`${attr}`)) {
|
|
3246
|
-
let inputVal = atcb_secure_content(el.getAttribute(`${attr}`).replace(/(
|
|
3303
|
+
let inputVal = atcb_secure_content(el.getAttribute(`${attr}`).replace(/(\\r\\n|\\n|\\r)/g, ''), false);
|
|
3247
3304
|
let val;
|
|
3248
3305
|
if (atcbWcBooleanParams.includes(attr)) {
|
|
3249
3306
|
if (inputVal == '') {
|
|
@@ -3288,7 +3345,7 @@ function atcb_read_attributes(el) {
|
|
|
3288
3345
|
}
|
|
3289
3346
|
const identifierAttr = el.getAttribute('identifier');
|
|
3290
3347
|
if (identifierAttr != null && identifierAttr != '') {
|
|
3291
|
-
data['identifier'] = atcb_secure_content(identifierAttr.replace(/(
|
|
3348
|
+
data['identifier'] = atcb_secure_content(identifierAttr.replace(/(\\r\\n|\\n|\\r)/g, ''), false);
|
|
3292
3349
|
}
|
|
3293
3350
|
}
|
|
3294
3351
|
if (!atcb_check_required(data)) {
|
|
@@ -3296,7 +3353,7 @@ function atcb_read_attributes(el) {
|
|
|
3296
3353
|
const atcbJsonInput = (function () {
|
|
3297
3354
|
if (slotInput != '') {
|
|
3298
3355
|
try {
|
|
3299
|
-
return JSON.parse(atcb_secure_content(slotInput.replace(/(
|
|
3356
|
+
return JSON.parse(atcb_secure_content(slotInput.replace(/(\\r\\n|\\n|\\r)/g, ''), false));
|
|
3300
3357
|
} catch (e) {
|
|
3301
3358
|
throw new Error('Add to Calendar Button generation failed: JSON content provided, but badly formatted (in doubt, try some tool like https://jsonformatter.org/ to validate).\r\nError message: ' + e);
|
|
3302
3359
|
}
|
|
@@ -3321,10 +3378,12 @@ function atcb_build_button(host, data, debug = false) {
|
|
|
3321
3378
|
atcb_setup_state_management(data);
|
|
3322
3379
|
atcb_set_global_event_listener(host, data);
|
|
3323
3380
|
atcb_init_log(data.proKey, debug);
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3381
|
+
if (!data.hidden) {
|
|
3382
|
+
atcb_generate_button(host, rootObj, data, debug);
|
|
3383
|
+
if (!data.hideRichData && data.name && data.dates[0].location && data.dates[0].startDate) {
|
|
3384
|
+
atcb_generate_rich_data(data, host.host);
|
|
3385
|
+
data.schemaEl = host.host.previousSibling;
|
|
3386
|
+
}
|
|
3328
3387
|
}
|
|
3329
3388
|
atcb_log_event('initialization', data.identifier, data.identifier);
|
|
3330
3389
|
} else if (debug) {
|
|
@@ -3386,14 +3445,14 @@ function atcb_load_css(host, rootObj = null, style = '', inline = false, buttons
|
|
|
3386
3445
|
const cssContent = document.createElement('style');
|
|
3387
3446
|
const overrideDefaultCss = (function () {
|
|
3388
3447
|
if (host.host.hasAttribute('styleLight')) {
|
|
3389
|
-
const output = ':host { ' + atcb_secure_content(host.host.getAttribute('styleLight').replace(/(
|
|
3448
|
+
const output = ':host { ' + atcb_secure_content(host.host.getAttribute('styleLight').replace(/(\\r\\n|\\n|\\r)/g, ''), false) + ' }';
|
|
3390
3449
|
return output;
|
|
3391
3450
|
}
|
|
3392
3451
|
return '';
|
|
3393
3452
|
})();
|
|
3394
3453
|
const overrideDarkCss = (function () {
|
|
3395
3454
|
if (host.host.hasAttribute('styleDark')) {
|
|
3396
|
-
const output = ':host(.atcb-dark), :host-context(html.atcb-dark):host(.atcb-bodyScheme), :host-context(body.atcb-dark):host(.atcb-bodyScheme) { ' + atcb_secure_content(host.host.getAttribute('styleDark').replace(/(
|
|
3455
|
+
const output = ':host(.atcb-dark), :host-context(html.atcb-dark):host(.atcb-bodyScheme), :host-context(body.atcb-dark):host(.atcb-bodyScheme) { ' + atcb_secure_content(host.host.getAttribute('styleDark').replace(/(\\r\\n|\\n|\\r)/g, ''), false) + ' }';
|
|
3397
3456
|
return output;
|
|
3398
3457
|
}
|
|
3399
3458
|
return '';
|
|
@@ -3498,36 +3557,38 @@ function atcb_action(data, triggerElement, keyboardTrigger = false) {
|
|
|
3498
3557
|
}
|
|
3499
3558
|
potentialExistingHost.remove();
|
|
3500
3559
|
}
|
|
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
3560
|
atcb_log_event('initialization', data.identifier, data.identifier);
|
|
3526
|
-
if (
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3561
|
+
if (!data.blockInteraction) {
|
|
3562
|
+
let host = document.createElement('div');
|
|
3563
|
+
host.id = 'atcb-customTrigger-' + data.identifier + '-host';
|
|
3564
|
+
if (root == document.body) {
|
|
3565
|
+
document.body.append(host);
|
|
3566
|
+
} else {
|
|
3567
|
+
root.after(host);
|
|
3568
|
+
}
|
|
3569
|
+
if (triggerElement) {
|
|
3570
|
+
const btnDim = triggerElement.getBoundingClientRect();
|
|
3571
|
+
host.style.position = 'relative';
|
|
3572
|
+
host.style.left = -btnDim.width + 'px';
|
|
3573
|
+
host.style.top = btnDim.height + 'px';
|
|
3574
|
+
}
|
|
3575
|
+
host.setAttribute('atcb-button-id', data.identifier);
|
|
3576
|
+
host.attachShadow({ mode: 'open', delegateFocus: true });
|
|
3577
|
+
const elem = document.createElement('template');
|
|
3578
|
+
elem.innerHTML = template;
|
|
3579
|
+
host.shadowRoot.append(elem.content.cloneNode(true));
|
|
3580
|
+
const rootObj = host.shadowRoot.querySelector('.atcb-initialized');
|
|
3581
|
+
atcb_setup_state_management(data);
|
|
3582
|
+
atcb_set_light_mode(host.shadowRoot, data);
|
|
3583
|
+
host.shadowRoot.querySelector('.atcb-initialized').setAttribute('lang', data.language);
|
|
3584
|
+
atcb_load_css(host.shadowRoot, rootObj, data.buttonStyle, false, false, data.customCss);
|
|
3585
|
+
atcb_set_global_event_listener(host.shadowRoot, data);
|
|
3586
|
+
if (oneOption) {
|
|
3587
|
+
atcb_generate_links(host.shadowRoot, data.options[0], data, 'all', keyboardTrigger);
|
|
3588
|
+
atcb_log_event('openSingletonLink', data.identifier, data.identifier);
|
|
3589
|
+
} else {
|
|
3590
|
+
atcb_toggle(host.shadowRoot, 'open', data, triggerElement, keyboardTrigger);
|
|
3591
|
+
}
|
|
3531
3592
|
}
|
|
3532
3593
|
atcb_init_log(data.proKey, data.debug);
|
|
3533
3594
|
if (data.debug) {
|
|
@@ -3556,8 +3617,7 @@ function atcb_init_log(pro = '', debug = false) {
|
|
|
3556
3617
|
if (pro != '') {
|
|
3557
3618
|
console.log('Add to Calendar PRO script initialized' + versionOutput + ' | https://add-to-calendar-pro.com');
|
|
3558
3619
|
} else {
|
|
3559
|
-
console.log('%
|
|
3560
|
-
console.log('see https://add-to-calendar-button.com for details');
|
|
3620
|
+
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
3621
|
}
|
|
3562
3622
|
atcbInitialGlobalInit = true;
|
|
3563
3623
|
}
|
|
@@ -3586,7 +3646,7 @@ function atcb_set_global_event_listener(host, data) {
|
|
|
3586
3646
|
lightModeMutationObserver[data.identifier].observe(document.documentElement, { attributes: true });
|
|
3587
3647
|
lightModeMutationObserver[data.identifier].observe(document.body, { attributes: true });
|
|
3588
3648
|
}
|
|
3589
|
-
if (!atcbInitialGlobalInit
|
|
3649
|
+
if (!atcbInitialGlobalInit) {
|
|
3590
3650
|
document.addEventListener('keyup', atcb_global_listener_keyup);
|
|
3591
3651
|
document.addEventListener('keydown', atcb_global_listener_keydown);
|
|
3592
3652
|
window.addEventListener('resize', atcb_global_listener_resize);
|