add-to-calendar-button 2.6.19 → 2.6.21
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/assets/css/atcb-3d.css +7 -2
- package/assets/css/atcb-3d.min.css +1 -1
- package/assets/css/atcb-date.css +7 -2
- package/assets/css/atcb-date.min.css +1 -1
- package/assets/css/atcb-flat.css +7 -2
- package/assets/css/atcb-flat.min.css +1 -1
- package/assets/css/atcb-neumorphism.css +7 -2
- package/assets/css/atcb-neumorphism.min.css +1 -1
- package/assets/css/atcb-round.css +7 -2
- package/assets/css/atcb-round.min.css +1 -1
- package/assets/css/atcb-text.css +7 -2
- package/assets/css/atcb-text.min.css +1 -1
- package/assets/css/atcb.css +7 -2
- package/assets/css/atcb.min.css +1 -1
- package/dist/atcb-no-pro-unstyle.js +61 -50
- package/dist/atcb-no-pro.js +62 -51
- package/dist/atcb-unstyle.js +62 -51
- package/dist/atcb.js +63 -52
- package/dist/commonjs/index.js +63 -53
- package/dist/commonjs/no-pro/index.js +62 -52
- package/dist/commonjs/no-pro-unstyle/index.js +61 -51
- package/dist/commonjs/unstyle/index.js +62 -52
- package/dist/module/index.js +63 -52
- package/dist/module/no-pro/index.js +62 -51
- package/dist/module/no-pro-unstyle/index.js +61 -50
- package/dist/module/unstyle/index.js +62 -51
- package/package.json +10 -11
- package/test/server-side-init.test.js +0 -3
- package/test/test-prep.js +0 -4
- package/test/wc-tests/wc-load.test.js +0 -3
- package/.eslintrc.json +0 -36
- package/dist/commonjs/.eslintrc.json +0 -1
package/dist/atcb.js
CHANGED
|
@@ -974,15 +974,15 @@ function tzlib_get_timezones(jsonType = false) {
|
|
|
974
974
|
* Add to Calendar Button
|
|
975
975
|
* ++++++++++++++++++++++
|
|
976
976
|
*
|
|
977
|
-
* Version: 2.6.
|
|
977
|
+
* Version: 2.6.21
|
|
978
978
|
* Creator: Jens Kuerschner (https://jekuer.com)
|
|
979
979
|
* Project: https://github.com/add2cal/add-to-calendar-button
|
|
980
980
|
* License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
|
|
981
981
|
* Note: DO NOT REMOVE THE COPYRIGHT NOTICE ABOVE!
|
|
982
982
|
*
|
|
983
983
|
*/
|
|
984
|
-
const atcbVersion = '2.6.
|
|
985
|
-
const atcbCssTemplate = {
|
|
984
|
+
const atcbVersion = '2.6.21';
|
|
985
|
+
const atcbCssTemplate = {
|
|
986
986
|
if (typeof window === 'undefined') {
|
|
987
987
|
return false;
|
|
988
988
|
} else {
|
|
@@ -1024,7 +1024,7 @@ const atcbIsAndroid = atcbIsBrowser()
|
|
|
1024
1024
|
};*/
|
|
1025
1025
|
const atcbIsSafari = atcbIsBrowser()
|
|
1026
1026
|
? () => {
|
|
1027
|
-
if (/^((?!chrome|android|crios|fxios).)*safari/i.test(navigator.userAgent)) {
|
|
1027
|
+
if (/^(?:(?!chrome|android|crios|fxios).)*safari/i.test(navigator.userAgent)) {
|
|
1028
1028
|
return true;
|
|
1029
1029
|
} else {
|
|
1030
1030
|
return false;
|
|
@@ -1042,7 +1042,7 @@ const atcbIsMobile = () => {
|
|
|
1042
1042
|
};
|
|
1043
1043
|
const atcbIsWebView = atcbIsBrowser()
|
|
1044
1044
|
? () => {
|
|
1045
|
-
if (
|
|
1045
|
+
if (/; ?wv|(?:iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(navigator.userAgent)) {
|
|
1046
1046
|
return true;
|
|
1047
1047
|
} else {
|
|
1048
1048
|
return false;
|
|
@@ -1053,7 +1053,7 @@ const atcbIsWebView = atcbIsBrowser()
|
|
|
1053
1053
|
};
|
|
1054
1054
|
const atcbIsProblematicWebView = atcbIsBrowser()
|
|
1055
1055
|
? () => {
|
|
1056
|
-
if (/
|
|
1056
|
+
if (/Instagram/i.test(navigator.userAgent)) {
|
|
1057
1057
|
return true;
|
|
1058
1058
|
} else {
|
|
1059
1059
|
return false;
|
|
@@ -1272,7 +1272,7 @@ function atcb_decorate_data_timezone(tz = null) {
|
|
|
1272
1272
|
function atcb_decorate_data_rrule(data) {
|
|
1273
1273
|
if (data.recurrence && data.recurrence !== '') {
|
|
1274
1274
|
data.recurrence = data.recurrence.replace(/\s+/g, '').toUpperCase();
|
|
1275
|
-
if (!/^(RRULE:[\w
|
|
1275
|
+
if (!/^(?:RRULE:[\w=;,:+\-/\\]+|daily|weekly|monthly|yearly)$/im.test(data.recurrence)) {
|
|
1276
1276
|
data.recurrence = '!wrong rrule format!';
|
|
1277
1277
|
} else {
|
|
1278
1278
|
if (/^RRULE:/i.test(data.recurrence)) {
|
|
@@ -1515,8 +1515,7 @@ function atcb_decorate_data_description(data, i) {
|
|
|
1515
1515
|
description = cleanDescription(description);
|
|
1516
1516
|
if (data.customVar) {
|
|
1517
1517
|
for (const key in data.customVar) {
|
|
1518
|
-
const sanitizedKey = key.replace(/[
|
|
1519
|
-
// eslint-disable-next-line security/detect-non-literal-regexp
|
|
1518
|
+
const sanitizedKey = key.replace(/[^\w\-.]/g, '');
|
|
1520
1519
|
description = description.replace(new RegExp(`%%${sanitizedKey}%%`, 'g'), data.customVar[`${key}`]);
|
|
1521
1520
|
}
|
|
1522
1521
|
}
|
|
@@ -1575,10 +1574,8 @@ function atcb_decorate_data_extend(data) {
|
|
|
1575
1574
|
}
|
|
1576
1575
|
if (data.customVar) {
|
|
1577
1576
|
for (const key in data.customVar) {
|
|
1578
|
-
const sanitizedKey = key.replace(/[
|
|
1579
|
-
// eslint-disable-next-line security/detect-non-literal-regexp
|
|
1577
|
+
const sanitizedKey = key.replace(/[^\w\-.]/g, '');
|
|
1580
1578
|
data.dates[`${i}`].name = data.dates[`${i}`].name.replace(new RegExp(`%%${sanitizedKey}%%`, 'g'), data.customVar[`${key}`]);
|
|
1581
|
-
// eslint-disable-next-line security/detect-non-literal-regexp
|
|
1582
1579
|
data.dates[`${i}`].location = data.dates[`${i}`].location.replace(new RegExp(`%%${sanitizedKey}%%`, 'g'), data.customVar[`${key}`]);
|
|
1583
1580
|
}
|
|
1584
1581
|
}
|
|
@@ -1597,7 +1594,7 @@ function atcb_date_cleanup(dateTimeData) {
|
|
|
1597
1594
|
}
|
|
1598
1595
|
const endpoints = ['start', 'end'];
|
|
1599
1596
|
endpoints.forEach(function (point) {
|
|
1600
|
-
if (!/^(
|
|
1597
|
+
if (!/^(?:\d{4}-\d{2}-\d{2}T?(?:\d{2}:\d{2})?Z?|today(?:\+\d{1,4})?)$/i.test(dateTimeData[point + 'Date'])) {
|
|
1601
1598
|
dateTimeData[point + 'Date'] = 'badly-formed';
|
|
1602
1599
|
} else {
|
|
1603
1600
|
dateTimeData[point + 'Date'] = atcb_date_calculation(dateTimeData[point + 'Date']);
|
|
@@ -1802,7 +1799,7 @@ async function atcb_validate_buttonStyle(data, msgPrefix) {
|
|
|
1802
1799
|
if (!availableStyles.includes(data.buttonStyle)) {
|
|
1803
1800
|
throw new Error(msgPrefix + ' failed: provided buttonStyle invalid');
|
|
1804
1801
|
}
|
|
1805
|
-
if (data.customCss && data.customCss !== '' && (!atcb_secure_url(data.customCss, false) || !/\.css(
|
|
1802
|
+
if (data.customCss && data.customCss !== '' && (!atcb_secure_url(data.customCss, false) || !/\.css(?:$|\?)/.test(data.customCss))) {
|
|
1806
1803
|
throw new Error(msgPrefix + ' failed: customCss provided, but no valid url');
|
|
1807
1804
|
}
|
|
1808
1805
|
if ((!data.customCss || data.customCss === '') && data.buttonStyle === 'custom') {
|
|
@@ -1881,7 +1878,7 @@ async function atcb_validate_availability(data, msgPrefix, i, msgSuffix) {
|
|
|
1881
1878
|
async function atcb_validate_organizer(data, msgPrefix, i, msgSuffix) {
|
|
1882
1879
|
if (data.dates[`${i}`].organizer && data.dates[`${i}`].organizer !== '') {
|
|
1883
1880
|
const organizerParts = data.dates[`${i}`].organizer.split('|');
|
|
1884
|
-
if (organizerParts.length !== 2 || organizerParts[0].length > 50 || organizerParts[1].length >
|
|
1881
|
+
if (organizerParts.length !== 2 || organizerParts[0].length > 50 || organizerParts[1].length > 100 || !atcb_validEmail(organizerParts[1])) {
|
|
1885
1882
|
throw new Error(msgPrefix + ' failed: organizer needs to match the schema "NAME|EMAIL" with a valid email address' + msgSuffix);
|
|
1886
1883
|
}
|
|
1887
1884
|
}
|
|
@@ -1896,14 +1893,14 @@ async function atcb_validate_attendee(data, msgPrefix, i, msgSuffix) {
|
|
|
1896
1893
|
if (attendeeParts.length === 1 && atcb_validEmail(attendeeParts[0])) {
|
|
1897
1894
|
return true;
|
|
1898
1895
|
}
|
|
1899
|
-
if (attendeeParts.length !== 2 || attendeeParts[0].length > 50 || attendeeParts[1].length >
|
|
1896
|
+
if (attendeeParts.length !== 2 || attendeeParts[0].length > 50 || attendeeParts[1].length > 100 || !atcb_validEmail(attendeeParts[1])) {
|
|
1900
1897
|
throw new Error(msgPrefix + ' failed: attendee needs to be a valid email address or match the schema "NAME|EMAIL" with EMAIL being a valid email address' + msgSuffix);
|
|
1901
1898
|
}
|
|
1902
1899
|
}
|
|
1903
1900
|
return true;
|
|
1904
1901
|
}
|
|
1905
1902
|
async function atcb_validate_uid(data, msgPrefix, i, msgSuffix) {
|
|
1906
|
-
if (!/^(
|
|
1903
|
+
if (!/^(?:\w|-){1,254}$/.test(data.dates[`${i}`].uid)) {
|
|
1907
1904
|
if (data.debug) {
|
|
1908
1905
|
console.warn(msgPrefix + ': UID not valid. May only contain alpha, digits, and dashes; and be less than 255 characters. Falling back to an automated value!' + msgSuffix);
|
|
1909
1906
|
}
|
|
@@ -1972,7 +1969,7 @@ async function atcb_validate_rrule(data, msgPrefix) {
|
|
|
1972
1969
|
if (data.recurrence && data.recurrence !== '' && data.dates.length > 1) {
|
|
1973
1970
|
throw new Error(msgPrefix + ' failed: RRULE and multi-date set at the same time');
|
|
1974
1971
|
}
|
|
1975
|
-
if (data.recurrence && data.recurrence !== '' && !/^RRULE:[\w
|
|
1972
|
+
if (data.recurrence && data.recurrence !== '' && !/^RRULE:[\w=;,:+\-/\\]+$/i.test(data.recurrence)) {
|
|
1976
1973
|
throw new Error(msgPrefix + ' failed: RRULE data misspelled');
|
|
1977
1974
|
}
|
|
1978
1975
|
return true;
|
|
@@ -1981,22 +1978,22 @@ async function atcb_validate_rrule_simplyfied(data, msgPrefix) {
|
|
|
1981
1978
|
if (data.recurrence_interval && (data.recurrence_interval < 1 || data.recurrence_interval % 1 !== 0)) {
|
|
1982
1979
|
throw new Error(msgPrefix + ' failed: recurrence data (interval) misspelled');
|
|
1983
1980
|
}
|
|
1984
|
-
if (data.recurrence_until && data.recurrence_until !== '' && !/^
|
|
1981
|
+
if (data.recurrence_until && data.recurrence_until !== '' && !/^[\d\-:]+$/.test(data.recurrence_until)) {
|
|
1985
1982
|
throw new Error(msgPrefix + ' failed: recurrence data (until) misspelled');
|
|
1986
1983
|
}
|
|
1987
1984
|
if (data.recurrence_count && (data.recurrence_count < 1 || data.recurrence_count % 1 !== 0)) {
|
|
1988
1985
|
throw new Error(msgPrefix + ' failed: recurrence data (interval) misspelled');
|
|
1989
1986
|
}
|
|
1990
|
-
if (data.recurrence_byMonth && data.recurrence_byMonth !== '' && !/^
|
|
1987
|
+
if (data.recurrence_byMonth && data.recurrence_byMonth !== '' && !/^[\d,]+$/.test(data.recurrence_byMonth)) {
|
|
1991
1988
|
throw new Error(msgPrefix + ' failed: recurrence data (byMonth) misspelled');
|
|
1992
1989
|
}
|
|
1993
|
-
if (data.recurrence_byMonthDay && data.recurrence_byMonthDay !== '' && !/^
|
|
1990
|
+
if (data.recurrence_byMonthDay && data.recurrence_byMonthDay !== '' && !/^[\d,]+$/.test(data.recurrence_byMonthDay)) {
|
|
1994
1991
|
throw new Error(msgPrefix + ' failed: recurrence data (byMonthDay) misspelled');
|
|
1995
1992
|
}
|
|
1996
|
-
if (data.recurrence_byDay && data.recurrence_byDay !== '' && !/^(\d
|
|
1993
|
+
if (data.recurrence_byDay && data.recurrence_byDay !== '' && !/^(?:[\d,-]|MO|TU|WE|TH|FR|SA|SU)+$/im.test(data.recurrence_byDay)) {
|
|
1997
1994
|
throw new Error(msgPrefix + ' failed: recurrence data (byDay) misspelled');
|
|
1998
1995
|
}
|
|
1999
|
-
if (data.recurrence_weekstart && data.recurrence_weekstart !== '' && !/^(MO|TU|WE|TH|FR|SA|SU)$/im.test(data.recurrence_weekstart)) {
|
|
1996
|
+
if (data.recurrence_weekstart && data.recurrence_weekstart !== '' && !/^(?:MO|TU|WE|TH|FR|SA|SU)$/im.test(data.recurrence_weekstart)) {
|
|
2000
1997
|
throw new Error(msgPrefix + ' failed: recurrence data (weekstart) misspelled');
|
|
2001
1998
|
}
|
|
2002
1999
|
return true;
|
|
@@ -2437,7 +2434,7 @@ async function atcb_generate_rsvp_form(host, data, hostEl, keyboardTrigger = fal
|
|
|
2437
2434
|
} else {
|
|
2438
2435
|
rsvpData.fields = rsvpData.fields.map((field) => {
|
|
2439
2436
|
if (field.name === 'email') {
|
|
2440
|
-
return { ...field, required: true, type: 'email', default: attendee !== ''
|
|
2437
|
+
return { ...field, required: true, type: 'email', default: attendee !== '' ? attendee : field.default };
|
|
2441
2438
|
}
|
|
2442
2439
|
return field;
|
|
2443
2440
|
});
|
|
@@ -3203,24 +3200,36 @@ function atcb_generate_bg_overlay(host, trigger = '', modal = false, darken = tr
|
|
|
3203
3200
|
}
|
|
3204
3201
|
return bgOverlay;
|
|
3205
3202
|
}
|
|
3206
|
-
|
|
3203
|
+
/*!
|
|
3204
|
+
* @preserve
|
|
3205
|
+
* PER LICENSE AGREEMENT, YOU ARE NOT ALLOWED TO REMOVE OR CHANGE THIS FUNCTION!
|
|
3206
|
+
*/
|
|
3207
|
+
function atcb_create_atcbl(host, atList = true, returnEl = false, licenseNoteOnly = false) {
|
|
3207
3208
|
const atcbL = document.createElement('div');
|
|
3208
3209
|
atcbL.id = 'atcb-reference';
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3210
|
+
if (!licenseNoteOnly) {
|
|
3211
|
+
setTimeout(() => {
|
|
3212
|
+
const svg =
|
|
3213
|
+
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52.916 2.8305"><path d="M51.446 1.2565c.0708-.2518.293-.4511.5555-.4783.2211-.042.4641.0128.622.18.2474.2472.3045.6146.2916.9503v.8594h-.8307l-.0027-1.0447c-.0079-.1547-.1075-.343-.2868-.3238-.2049.0128-.3115.2421-.295.4257v.9428h-.823l-.0027-1.0435c-.0076-.1569-.1131-.3412-.2918-.3252-.2069.008-.311.2351-.2939.4188v.9499h-.8307V.8237h.8307v.4019c.0906-.2264.2876-.4188.5368-.449.2878-.0533.6071.0705.7509.3331.0279.0465.0509.0959.0699.1468zm-3.9843.5228c-.0102.1874.107.3914.3024.424.1869.0419.3799-.0941.4215-.2776.0535-.1967-.0023-.4493-.2015-.5411-.1767-.0892-.4107.0032-.483.1865-.0297.0649-.0391.1374-.0392.2082zm-.7691 0c.0037-.2984.1395-.5957.3792-.7774.3035-.2327.7168-.2798 1.0829-.2005.3299.0729.6352.3018.7481.6275.1337.3797.0441.8526-.2795 1.1099-.3184.2561-.7624.3092-1.152.2184-.3379-.0788-.6426-.3312-.7369-.6717a1.092 1.092 0 0 1-.0417-.3063zm-.2351-.3308c-.1638-.0482-.3406-.0889-.5104-.0492s-.2742.2154-.2664.3837c-.0082.1705.0998.3468.2712.3876.1657.0389.3389.0016.4979-.0492l.0769.5499c-.2369.1272-.5165.1434-.7791.1149-.3236-.0401-.6353-.2311-.7805-.529-.1237-.2511-.139-.5539-.0485-.8181.108-.3075.3782-.5432.6902-.6287.2064-.058.4286-.0585.6371-.0119.1027.0253.198.0732.2884.1269l-.0769.523zm-2.6877.9806c-.003-.1221.066-.2371.1643-.3062.1303-.0934.3092-.1186.4572-.0533.132.054.2426.1752.2607.3197s-.0575.2836-.1746.3603c-.1633.1093-.3947.1063-.5517-.0135-.0951-.0715-.1577-.187-.1559-.307zm-3.046-1.0111c-.0091-.4276.1794-.8577.5181-1.1231.3714-.2958.8865-.3488 1.3384-.2477.4065.0946.7695.3811.9242.7731.2302.553.1173 1.2562-.3406 1.6606-.4021.3563-.9997.4264-1.5018.273-.4407-.1312-.7876-.5106-.8926-.9564a1.565 1.565 0 0 1-.0458-.3795zm1.4499.6961c.2631.014.4813-.2093.5326-.4557.0785-.3033.0224-.6834-.2491-.8753-.2182-.159-.5514-.1019-.704.1211-.1692.2437-.1902.5756-.088.8501.0775.2087.2816.3661.5085.3597zm-1.631.6458c-.1978.0602-.4078.0938-.6123.0464-.2697-.0443-.5044-.2371-.6009-.4927-.0701-.1852-.1026-.3819-.154-.5728h-.1846v1.0268h-.8614V.0601l1.3192.0034c.3398.0217.7177.1323.9118.434.152.2456.127.584-.0389.8163-.0979.1284-.2387.2162-.3846.2807.0316.1513.0475.3167.1461.4418.1193.1187.3064.1031.4596.0812v.6422zm-.871-1.8651c.0103-.138-.1243-.231-.25-.2384-.1427-.0193-.2871-.0088-.4307-.0115v.5422c.1905-.0038.3947.0138.5678-.0796a.234.234 0 0 0 .1128-.2126zM35.573.0603l1.1424.0047c.3439.0209.7218.1098.9446.3944.2252.2934.2163.7545-.0512 1.0195-.279.2859-.698.3701-1.0838.362-.0329.0105-.1126-.0258-.102.0281v.8987h-.8499V.0603zm1.0192 1.2345c.1672.0054.3805-.0562.4233-.2409.0425-.1434-.0225-.3102-.1619-.3724-.1328-.0705-.2859-.0537-.4306-.0559v.6615c.0561.0073.1128.0073.1692.0077zm-2.5176.2226h1.0576v.4653h-1.0576zM32.3311.8234h.8307v.4019q.0942-.2384.25-.348.1577-.1115.3615-.1115l.1154.6442q-.375 0-.5519.0808-.175.0788-.175.2538v1.023h-.8307zm-1.2257 1.5791c-.0937.2116-.2986.3716-.5319.3897-.3887.0533-.7844-.1743-.9578-.5217-.2044-.381-.1519-.892.1543-1.2049.2461-.2614.6627-.389.9973-.2285.1574.0799.2779.2236.3381.3886V.7662h.8268v2.0017h-.8268v-.3653zm0-.6345c-.0052-.2449-.2747-.4425-.5088-.3585-.217.0615-.3402.3271-.243.5316.0896.2161.3875.3078.5783.1678.1106-.0747.179-.2073.1735-.3408zM27.7118.7662c.2401-.008.4923.1021.6064.3222.0351.0816.045.0806.0397.0023V.1721l.8307-.1231v2.7189h-.8307v-.3653c-.0907.2158-.3003.3744-.5356.39-.3605.0507-.7279-.1432-.9123-.4525-.2569-.3983-.1992-.9693.1456-1.2985.173-.1702.412-.2772.6563-.2754zm.6461 1.0018c-.0048-.2526-.2909-.4519-.5276-.3518-.2324.0782-.3309.3933-.1843.5898.1239.1938.425.2285.5871.0636.0811-.0768.1287-.1897.1248-.3015zM24.139.8233h.7922v.4019c.1006-.2169.2949-.397.5347-.4408.2696-.0572.58.0085.76.2293.2045.2403.2438.5692.2358.8734v.8802h-.8268l-.0022-1.1213c-.004-.1252-.0677-.2748-.2066-.2939-.2045-.0306-.3739.1457-.4412.3226-.0292.0785-.0098.1646-.0154.2467v.8459h-.8306V.8233zm-1.0416 1.4236c.2011-.0002.3981-.0574.5807-.1384l.0961.5288c-.3198.1421-.6806.1894-1.027.145-.3369-.0473-.6587-.2545-.8007-.5699-.1588-.3469-.1132-.7886.1413-1.0788.2741-.3191.7406-.4335 1.1413-.3308.2768.0734.5008.3019.5751.5779.0429.146.0624.3015.043.453l-1.1806.1538c.0368.134.158.2311.2944.2482.0449.0082.0907.0114.1363.0114zm.1461-.7557c-.0268-.1234-.1257-.237-.2578-.244-.143-.0241-.2868.0725-.325.2111-.0103.0527-.0737.2029.0271.1552l.5558-.1223zm-1.4939 1.1721c-.2463.1208-.5356.1686-.805.1092-.227-.0527-.3993-.2481-.4518-.4712-.0545-.2125-.0296-.4333-.0353-.6502V.1714l.8307-.1231.0011 1.9292c.002.1378.1537.1938.2711.1813.0651.0169.1819-.1.162.0152l.0274.4893zm-2.5115-.2609c-.0937.2116-.2986.3716-.5319.3897-.3887.0533-.7844-.1743-.9578-.5217-.2044-.381-.1519-.892.1543-1.2049.2461-.2614.6627-.389.9973-.2285.1574.0799.2779.2236.3381.3886V.7661h.8268v2.0017h-.8268v-.3653zm0-.6345c-.0052-.2449-.2747-.4425-.5088-.3585-.217.0615-.3402.3271-.243.5316.0896.2161.3875.3078.5783.1678.1106-.0747.179-.2073.1735-.3408zm-2.3726.35c.1696.0054.3334-.0479.4884-.1115l.1077.6249c-.5137.3026-1.2229.2625-1.6732-.1399-.2959-.2444-.4693-.6191-.4819-1.0009-.0323-.4791.181-.9792.5853-1.2496.4565-.3128 1.0898-.3142 1.5659-.0438l-.1038.6115c-.2721-.1029-.5957-.168-.8667-.0274-.2291.1239-.3077.4039-.2984.6481-.0043.2465.1061.5161.3427.6212.1037.0495.2198.0676.3339.0676zm-2.923-.6005h1.0576v.4653h-1.0576zm-1.7829.2619c-.0102.1874.107.3914.3024.424.1869.0419.3799-.0941.4215-.2776.0535-.1967-.0023-.4493-.2015-.5411-.1767-.0892-.4107.0032-.4831.1865-.0297.0649-.0391.1374-.0392.2082zm-.7691 0c.0037-.2984.1395-.5957.3792-.7774.3035-.2327.7168-.2798 1.0829-.2005.33.0729.6352.3018.7481.6275.1337.3797.0441.8526-.2795 1.1099-.3184.2561-.7624.3092-1.152.2184-.3379-.0788-.6426-.3312-.7369-.6717a1.092 1.092 0 0 1-.0417-.3063zm-.1976.8841c-.2463.1208-.5356.1686-.805.1092-.227-.0527-.3993-.2481-.4518-.4712-.0557-.2169-.0286-.4422-.0334-.6635l.0019-.3551h-.25V.7943h.3115l.3653-.7461h.4v.7461h.4538v.4884h-.4538l.0011.6943c.0034.1365.1541.1943.2715.1818.0768.006.1848-.0959.1624.0301l.0265.4744zm-2.7861-1.146h1.0575v.4653H8.4068zM6.5412.7662c.2401-.008.4923.1021.6064.3223.0351.0816.045.0806.0397.0023V.172l.8307-.1231v2.7189h-.8307v-.3653c-.0907.2158-.3003.3744-.5356.39-.3605.0507-.7279-.1432-.9123-.4525-.2569-.3983-.1992-.9693.1456-1.2985.173-.1702.412-.2772.6563-.2754zm.6461 1.0018c-.0048-.2526-.2909-.4519-.5276-.3518-.2324.0782-.3308.3933-.1843.5898.1239.1938.425.2285.5871.0636.0811-.0768.1287-.1897.1248-.3015zM3.7956.7662c.2401-.008.4923.1021.6064.3222.0351.0816.045.0806.0397.0023V.172l.8307-.1231v2.7189h-.8307v-.3653c-.0907.2158-.3003.3744-.5356.39-.3605.0507-.7279-.1432-.9123-.4525-.2569-.3983-.1992-.9693.1456-1.2985.173-.1702.4119-.2772.6563-.2754zm.6461 1.0018c-.0048-.2526-.2909-.4519-.5276-.3518-.2324.0782-.3308.3933-.1843.5898.1239.1938.425.2285.5871.0636.0811-.0768.1287-.1897.1248-.3015zM.7498.0603h1.196l.7845 2.7074h-.9268l-.1038-.5192H.9997l-.1115.5192h-.8883zm.8576 1.7037L1.3497.5795 1.0843 1.764z"/></svg>';
|
|
3214
|
+
atcbL.innerHTML = '<a href="https://add-to-calendar-pro.com" target="_blank" rel="noopener">' + svg + '</a>';
|
|
3215
|
+
}, 500);
|
|
3216
|
+
if (atList) {
|
|
3217
|
+
host.querySelector('.atcb-initialized .atcb-list-wrapper').append(atcbL);
|
|
3218
|
+
} else if (returnEl) {
|
|
3219
|
+
return atcbL;
|
|
3220
|
+
} else {
|
|
3221
|
+
if (window.innerHeight > 1000 || window.innerWidth > 1000) {
|
|
3222
|
+
host.append(atcbL);
|
|
3223
|
+
atcbL.classList.add('fixed-ref');
|
|
3224
|
+
}
|
|
3222
3225
|
}
|
|
3226
|
+
} else {
|
|
3227
|
+
atcbL.innerHTML = 'Using the <a href="https://add-to-calendar-pro.com" target="_blank" rel="noopener referrer">Add to Calendar Button</a>, licensed under the Elastic License 2.0 (ELv2).';
|
|
3228
|
+
atcbL.setAttribute('style', 'display:none !important');
|
|
3229
|
+
atcbL.classList.add('atcb-attribution');
|
|
3230
|
+
host.append(atcbL);
|
|
3223
3231
|
}
|
|
3232
|
+
if (returnEl) return null;
|
|
3224
3233
|
}
|
|
3225
3234
|
async function atcb_create_modal(mainHost, data, icon = '', headline, content = '', buttons = [], subEvents = [], keyboardTrigger = false, goto = {}, closable = true) {
|
|
3226
3235
|
atcbStates['active'] = data.identifier;
|
|
@@ -3894,7 +3903,7 @@ function atcb_subscribe_ical(data, fileUrl) {
|
|
|
3894
3903
|
function atcb_subscribe_google(data, fileUrl) {
|
|
3895
3904
|
const baseUrl = 'https://calendar.google.com/calendar/r?cid=';
|
|
3896
3905
|
const baseUrlApp = 'calendar.google.com/calendar?cid=';
|
|
3897
|
-
const fileUrlRegex = /^(https?:\/\/|webcal:\/\/|\/\/)calendar\.google\.com\//;
|
|
3906
|
+
const fileUrlRegex = /^(?:https?:\/\/|webcal:\/\/|\/\/)calendar\.google\.com\//;
|
|
3898
3907
|
const newFileUrl = (function () {
|
|
3899
3908
|
if (fileUrlRegex.test(fileUrl)) {
|
|
3900
3909
|
return fileUrl.replace(/^(.)*\?cid=/, '');
|
|
@@ -3929,7 +3938,7 @@ function atcb_generate_google(data, date, subEvent = 'all') {
|
|
|
3929
3938
|
urlParts.push('https://calendar.google.com/calendar/render?action=TEMPLATE');
|
|
3930
3939
|
const formattedDate = atcb_generate_time(date, 'clean', 'google');
|
|
3931
3940
|
urlParts.push('dates=' + encodeURIComponent(formattedDate.start) + '%2F' + encodeURIComponent(formattedDate.end));
|
|
3932
|
-
if (date.timeZone && date.timeZone !== '' && !/
|
|
3941
|
+
if (date.timeZone && date.timeZone !== '' && !/GMT[+|-]\d{1,2}|Etc\/U|Etc\/Zulu|CET|CST6CDT|EET|EST|MET|MST|PST8PDT|WET/i.test(date.timeZone) && !formattedDate.allday) {
|
|
3933
3942
|
urlParts.push('ctz=' + date.timeZone);
|
|
3934
3943
|
}
|
|
3935
3944
|
if (date.name && date.name !== '') {
|
|
@@ -4080,7 +4089,6 @@ function atcb_open_cal_url(data, type, url, subscribe = false, subEvent = null,
|
|
|
4080
4089
|
return;
|
|
4081
4090
|
}
|
|
4082
4091
|
}
|
|
4083
|
-
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
|
4084
4092
|
const newTab = window.open(url, target);
|
|
4085
4093
|
if (newTab) {
|
|
4086
4094
|
newTab.focus();
|
|
@@ -4302,7 +4310,7 @@ function atcb_generate_time(data, style = 'delimiters', targetCal = 'general', a
|
|
|
4302
4310
|
}
|
|
4303
4311
|
return durationHours + ':' + ('0' + durationMinutes).slice(-2);
|
|
4304
4312
|
})();
|
|
4305
|
-
if (targetCal == 'ical' || (targetCal == 'google' && !/
|
|
4313
|
+
if (targetCal == 'ical' || (targetCal == 'google' && !/GMT[+|-]\d{1,2}|Etc\/U|Etc\/Zulu|CET|CST6CDT|EET|EST|MET|MST|PST8PDT|WET/i.test(data.timeZone))) {
|
|
4306
4314
|
return {
|
|
4307
4315
|
start: atcb_format_datetime(newStartDate, 'clean', true, true),
|
|
4308
4316
|
end: atcb_format_datetime(newEndDate, 'clean', true, true),
|
|
@@ -4624,7 +4632,7 @@ function atcb_secure_url(url, throwError = true) {
|
|
|
4624
4632
|
}
|
|
4625
4633
|
}
|
|
4626
4634
|
function atcb_validEmail(email) {
|
|
4627
|
-
if (!/^.{0,70}@.{1,30}\.[a-
|
|
4635
|
+
if (!/^.{0,70}@.{1,30}\.[a-z]{2,9}$/i.test(email)) {
|
|
4628
4636
|
return false;
|
|
4629
4637
|
}
|
|
4630
4638
|
return true;
|
|
@@ -4642,9 +4650,9 @@ function atcb_rewrite_html_elements(content, clear = false, iCalBreaks = false)
|
|
|
4642
4650
|
content = content.replace(/\{url\}(.+?)\{\/url\}/gi, (match, p1) => {
|
|
4643
4651
|
return p1.split('|')[0];
|
|
4644
4652
|
});
|
|
4645
|
-
content = content.replace(/\[(
|
|
4646
|
-
content = content.replace(/\{(
|
|
4647
|
-
content = content.replace(/&[#a-
|
|
4653
|
+
content = content.replace(/\[\/?(hr|[pbui]|strong|em|li|ul|ol|h\d)\]/gi, '');
|
|
4654
|
+
content = content.replace(/\{\/?(hr|[pbui]|strong|em|li|ul|ol|h\d)\}/gi, '');
|
|
4655
|
+
content = content.replace(/&[#a-z0-9]{1,9};/gi, '');
|
|
4648
4656
|
} else {
|
|
4649
4657
|
content = content.replace(/\[url\]((?:(?!\[\/url\]).)*)\[\/url\]/gi, function (match, p1) {
|
|
4650
4658
|
return atcb_parse_url_code(p1);
|
|
@@ -4652,8 +4660,8 @@ function atcb_rewrite_html_elements(content, clear = false, iCalBreaks = false)
|
|
|
4652
4660
|
content = content.replace(/\{url\}((?:(?!\[\/url\]).)*)\{\/url\}/gi, function (match, p1) {
|
|
4653
4661
|
return atcb_parse_url_code(p1);
|
|
4654
4662
|
});
|
|
4655
|
-
content = content.replace(/\[(
|
|
4656
|
-
content = content.replace(/\{(
|
|
4663
|
+
content = content.replace(/\[(\/)?(br|hr|[pbui]|strong|em|li|ul|ol|h\d)(\s?\/?)\]/gi, '<$1$2$3>');
|
|
4664
|
+
content = content.replace(/\{(\/)?(br|hr|[pbui]|strong|em|li|ul|ol|h\d)(\s?\/?)\}/gi, '<$1$2$3>');
|
|
4657
4665
|
}
|
|
4658
4666
|
return content;
|
|
4659
4667
|
}
|
|
@@ -5863,7 +5871,7 @@ if (atcbIsBrowser()) {
|
|
|
5863
5871
|
this.data.identifier = this.identifier;
|
|
5864
5872
|
} else {
|
|
5865
5873
|
if (this.data.identifier && this.data.identifier !== '') {
|
|
5866
|
-
if (!/^[\w
|
|
5874
|
+
if (!/^[\w-]+$/.test(this.data.identifier)) {
|
|
5867
5875
|
this.data.identifier = '';
|
|
5868
5876
|
if (this.debug) {
|
|
5869
5877
|
let prefix = 'Add to Calendar Button';
|
|
@@ -5882,7 +5890,6 @@ if (atcbIsBrowser()) {
|
|
|
5882
5890
|
this.identifier = this.data.identifier;
|
|
5883
5891
|
}
|
|
5884
5892
|
this.setAttribute('atcb-button-id', this.data.identifier);
|
|
5885
|
-
this.classList.add('add-to-calendar');
|
|
5886
5893
|
try {
|
|
5887
5894
|
this.setAttribute('style', 'visibility:visible;opacity:1;position:relative;outline:none !important;');
|
|
5888
5895
|
await atcb_build_button(this.shadowRoot, this.data);
|
|
@@ -5977,6 +5984,7 @@ function atcb_read_attributes(el, params = atcbWcParams) {
|
|
|
5977
5984
|
}
|
|
5978
5985
|
async function atcb_build_button(host, data) {
|
|
5979
5986
|
try {
|
|
5987
|
+
host.host.classList.add('add-to-calendar');
|
|
5980
5988
|
data = await atcb_decorate_data(data);
|
|
5981
5989
|
await atcb_validate(data);
|
|
5982
5990
|
const rootObj = host.querySelector('.atcb-initialized');
|
|
@@ -6001,6 +6009,9 @@ async function atcb_build_button(host, data) {
|
|
|
6001
6009
|
}
|
|
6002
6010
|
}
|
|
6003
6011
|
atcb_log_event('initialization', data.identifier, data.identifier);
|
|
6012
|
+
if (!data.proKey && data.hideBranding && !document.getElementById('atcb-reference')) {
|
|
6013
|
+
atcb_create_atcbl(document.body, false, false, true);
|
|
6014
|
+
}
|
|
6004
6015
|
return true;
|
|
6005
6016
|
} catch (e) {
|
|
6006
6017
|
throw new Error(e.message);
|
|
@@ -6058,7 +6069,7 @@ async function atcb_load_css(host, rootObj = null, data) {
|
|
|
6058
6069
|
const cssGlobalContent = document.createElement('style');
|
|
6059
6070
|
cssGlobalContent.id = 'atcb-global-style';
|
|
6060
6071
|
const scrollBarWidth = window.innerWidth - document.documentElement.clientWidth;
|
|
6061
|
-
cssGlobalContent.innerText = '.atcb-modal-no-scroll{overflow-y:hidden !important;-webkit-overflow-scrolling:touch;} body.atcb-modal-no-scroll{padding-right:' + scrollBarWidth + 'px;}';
|
|
6072
|
+
cssGlobalContent.innerText = '.atcb-modal-no-scroll{overflow-y:hidden !important;-webkit-overflow-scrolling:touch;} body.atcb-modal-no-scroll{padding-right:' + scrollBarWidth + 'px;}.atcb-attribution{display:none;}';
|
|
6062
6073
|
if (nonceVal) {
|
|
6063
6074
|
cssGlobalContent.setAttribute('nonce', nonceVal);
|
|
6064
6075
|
}
|
|
@@ -6207,7 +6218,7 @@ async function atcb_action(inputData, triggerElement, keyboardTrigger = false) {
|
|
|
6207
6218
|
if (triggerElement.id && triggerElement.id !== '') {
|
|
6208
6219
|
data.identifier = triggerElement.id;
|
|
6209
6220
|
} else {
|
|
6210
|
-
if (data.identifier && data.identifier != '' && /^[\w
|
|
6221
|
+
if (data.identifier && data.identifier != '' && /^[\w-]+$/.test(data.identifier)) {
|
|
6211
6222
|
data.identifier = 'atcb-btn-' + data.identifier;
|
|
6212
6223
|
} else {
|
|
6213
6224
|
data.identifier = 'atcb-btn-custom';
|