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