add-to-calendar-button 2.6.20 → 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/assets/css/atcb-3d.css +1 -1
- package/assets/css/atcb-date.css +1 -1
- package/assets/css/atcb-flat.css +1 -1
- package/assets/css/atcb-neumorphism.css +1 -1
- package/assets/css/atcb-round.css +1 -1
- package/assets/css/atcb-text.css +1 -1
- package/assets/css/atcb.css +1 -1
- package/dist/atcb-no-pro-unstyle.js +31 -34
- package/dist/atcb-no-pro.js +31 -34
- package/dist/atcb-unstyle.js +31 -34
- package/dist/atcb.js +31 -34
- package/dist/commonjs/index.js +31 -35
- package/dist/commonjs/no-pro/index.js +31 -35
- package/dist/commonjs/no-pro-unstyle/index.js +31 -35
- package/dist/commonjs/unstyle/index.js +31 -35
- package/dist/module/index.js +31 -34
- package/dist/module/no-pro/index.js +31 -34
- package/dist/module/no-pro-unstyle/index.js +31 -34
- package/dist/module/unstyle/index.js +31 -34
- package/package.json +7 -8
- 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/assets/css/atcb-3d.css
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Style: 3D
|
|
7
7
|
*
|
|
8
|
-
* Version: 2.6.
|
|
8
|
+
* Version: 2.6.21
|
|
9
9
|
* Creator: Jens Kuerschner (https://jekuer.com)
|
|
10
10
|
* Project: https://github.com/add2cal/add-to-calendar-button
|
|
11
11
|
* License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
|
package/assets/css/atcb-date.css
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Style: Date
|
|
7
7
|
*
|
|
8
|
-
* Version: 2.6.
|
|
8
|
+
* Version: 2.6.21
|
|
9
9
|
* Creator: Jens Kuerschner (https://jekuer.com)
|
|
10
10
|
* Project: https://github.com/add2cal/add-to-calendar-button
|
|
11
11
|
* License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
|
package/assets/css/atcb-flat.css
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Style: Flat
|
|
7
7
|
*
|
|
8
|
-
* Version: 2.6.
|
|
8
|
+
* Version: 2.6.21
|
|
9
9
|
* Creator: Jens Kuerschner (https://jekuer.com)
|
|
10
10
|
* Project: https://github.com/add2cal/add-to-calendar-button
|
|
11
11
|
* License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Style: Neumorphism
|
|
7
7
|
*
|
|
8
|
-
* Version: 2.6.
|
|
8
|
+
* Version: 2.6.21
|
|
9
9
|
* Creator: Jens Kuerschner (https://jekuer.com)
|
|
10
10
|
* Project: https://github.com/add2cal/add-to-calendar-button
|
|
11
11
|
* License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Style: Round
|
|
7
7
|
*
|
|
8
|
-
* Version: 2.6.
|
|
8
|
+
* Version: 2.6.21
|
|
9
9
|
* Creator: Jens Kuerschner (https://jekuer.com)
|
|
10
10
|
* Project: https://github.com/add2cal/add-to-calendar-button
|
|
11
11
|
* License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
|
package/assets/css/atcb-text.css
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Style: Text
|
|
7
7
|
*
|
|
8
|
-
* Version: 2.6.
|
|
8
|
+
* Version: 2.6.21
|
|
9
9
|
* Creator: Jens Kuerschner (https://jekuer.com)
|
|
10
10
|
* Project: https://github.com/add2cal/add-to-calendar-button
|
|
11
11
|
* License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
|
package/assets/css/atcb.css
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Style: Default
|
|
7
7
|
*
|
|
8
|
-
* Version: 2.6.
|
|
8
|
+
* Version: 2.6.21
|
|
9
9
|
* Creator: Jens Kuerschner (https://jekuer.com)
|
|
10
10
|
* Project: https://github.com/add2cal/add-to-calendar-button
|
|
11
11
|
* License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
|
|
@@ -974,14 +974,14 @@ 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.
|
|
984
|
+
const atcbVersion = '2.6.21';
|
|
985
985
|
const atcbCssTemplate = {};
|
|
986
986
|
const atcbIsBrowser = () => {
|
|
987
987
|
if (typeof window === 'undefined') {
|
|
@@ -1025,7 +1025,7 @@ const atcbIsAndroid = atcbIsBrowser()
|
|
|
1025
1025
|
};*/
|
|
1026
1026
|
const atcbIsSafari = atcbIsBrowser()
|
|
1027
1027
|
? () => {
|
|
1028
|
-
if (/^((?!chrome|android|crios|fxios).)*safari/i.test(navigator.userAgent)) {
|
|
1028
|
+
if (/^(?:(?!chrome|android|crios|fxios).)*safari/i.test(navigator.userAgent)) {
|
|
1029
1029
|
return true;
|
|
1030
1030
|
} else {
|
|
1031
1031
|
return false;
|
|
@@ -1043,7 +1043,7 @@ const atcbIsMobile = () => {
|
|
|
1043
1043
|
};
|
|
1044
1044
|
const atcbIsWebView = atcbIsBrowser()
|
|
1045
1045
|
? () => {
|
|
1046
|
-
if (
|
|
1046
|
+
if (/; ?wv|(?:iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(navigator.userAgent)) {
|
|
1047
1047
|
return true;
|
|
1048
1048
|
} else {
|
|
1049
1049
|
return false;
|
|
@@ -1054,7 +1054,7 @@ const atcbIsWebView = atcbIsBrowser()
|
|
|
1054
1054
|
};
|
|
1055
1055
|
const atcbIsProblematicWebView = atcbIsBrowser()
|
|
1056
1056
|
? () => {
|
|
1057
|
-
if (/
|
|
1057
|
+
if (/Instagram/i.test(navigator.userAgent)) {
|
|
1058
1058
|
return true;
|
|
1059
1059
|
} else {
|
|
1060
1060
|
return false;
|
|
@@ -1273,7 +1273,7 @@ function atcb_decorate_data_timezone(tz = null) {
|
|
|
1273
1273
|
function atcb_decorate_data_rrule(data) {
|
|
1274
1274
|
if (data.recurrence && data.recurrence !== '') {
|
|
1275
1275
|
data.recurrence = data.recurrence.replace(/\s+/g, '').toUpperCase();
|
|
1276
|
-
if (!/^(RRULE:[\w
|
|
1276
|
+
if (!/^(?:RRULE:[\w=;,:+\-/\\]+|daily|weekly|monthly|yearly)$/im.test(data.recurrence)) {
|
|
1277
1277
|
data.recurrence = '!wrong rrule format!';
|
|
1278
1278
|
} else {
|
|
1279
1279
|
if (/^RRULE:/i.test(data.recurrence)) {
|
|
@@ -1516,8 +1516,7 @@ function atcb_decorate_data_description(data, i) {
|
|
|
1516
1516
|
description = cleanDescription(description);
|
|
1517
1517
|
if (data.customVar) {
|
|
1518
1518
|
for (const key in data.customVar) {
|
|
1519
|
-
const sanitizedKey = key.replace(/[
|
|
1520
|
-
// eslint-disable-next-line security/detect-non-literal-regexp
|
|
1519
|
+
const sanitizedKey = key.replace(/[^\w\-.]/g, '');
|
|
1521
1520
|
description = description.replace(new RegExp(`%%${sanitizedKey}%%`, 'g'), data.customVar[`${key}`]);
|
|
1522
1521
|
}
|
|
1523
1522
|
}
|
|
@@ -1576,10 +1575,8 @@ function atcb_decorate_data_extend(data) {
|
|
|
1576
1575
|
}
|
|
1577
1576
|
if (data.customVar) {
|
|
1578
1577
|
for (const key in data.customVar) {
|
|
1579
|
-
const sanitizedKey = key.replace(/[
|
|
1580
|
-
// eslint-disable-next-line security/detect-non-literal-regexp
|
|
1578
|
+
const sanitizedKey = key.replace(/[^\w\-.]/g, '');
|
|
1581
1579
|
data.dates[`${i}`].name = data.dates[`${i}`].name.replace(new RegExp(`%%${sanitizedKey}%%`, 'g'), data.customVar[`${key}`]);
|
|
1582
|
-
// eslint-disable-next-line security/detect-non-literal-regexp
|
|
1583
1580
|
data.dates[`${i}`].location = data.dates[`${i}`].location.replace(new RegExp(`%%${sanitizedKey}%%`, 'g'), data.customVar[`${key}`]);
|
|
1584
1581
|
}
|
|
1585
1582
|
}
|
|
@@ -1598,7 +1595,7 @@ function atcb_date_cleanup(dateTimeData) {
|
|
|
1598
1595
|
}
|
|
1599
1596
|
const endpoints = ['start', 'end'];
|
|
1600
1597
|
endpoints.forEach(function (point) {
|
|
1601
|
-
if (!/^(
|
|
1598
|
+
if (!/^(?:\d{4}-\d{2}-\d{2}T?(?:\d{2}:\d{2})?Z?|today(?:\+\d{1,4})?)$/i.test(dateTimeData[point + 'Date'])) {
|
|
1602
1599
|
dateTimeData[point + 'Date'] = 'badly-formed';
|
|
1603
1600
|
} else {
|
|
1604
1601
|
dateTimeData[point + 'Date'] = atcb_date_calculation(dateTimeData[point + 'Date']);
|
|
@@ -1803,7 +1800,7 @@ async function atcb_validate_buttonStyle(data, msgPrefix) {
|
|
|
1803
1800
|
if (!availableStyles.includes(data.buttonStyle)) {
|
|
1804
1801
|
throw new Error(msgPrefix + ' failed: provided buttonStyle invalid');
|
|
1805
1802
|
}
|
|
1806
|
-
if (data.customCss && data.customCss !== '' && (!atcb_secure_url(data.customCss, false) || !/\.css(
|
|
1803
|
+
if (data.customCss && data.customCss !== '' && (!atcb_secure_url(data.customCss, false) || !/\.css(?:$|\?)/.test(data.customCss))) {
|
|
1807
1804
|
throw new Error(msgPrefix + ' failed: customCss provided, but no valid url');
|
|
1808
1805
|
}
|
|
1809
1806
|
if ((!data.customCss || data.customCss === '') && data.buttonStyle === 'custom') {
|
|
@@ -1904,7 +1901,7 @@ async function atcb_validate_attendee(data, msgPrefix, i, msgSuffix) {
|
|
|
1904
1901
|
return true;
|
|
1905
1902
|
}
|
|
1906
1903
|
async function atcb_validate_uid(data, msgPrefix, i, msgSuffix) {
|
|
1907
|
-
if (!/^(
|
|
1904
|
+
if (!/^(?:\w|-){1,254}$/.test(data.dates[`${i}`].uid)) {
|
|
1908
1905
|
if (data.debug) {
|
|
1909
1906
|
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);
|
|
1910
1907
|
}
|
|
@@ -1973,7 +1970,7 @@ async function atcb_validate_rrule(data, msgPrefix) {
|
|
|
1973
1970
|
if (data.recurrence && data.recurrence !== '' && data.dates.length > 1) {
|
|
1974
1971
|
throw new Error(msgPrefix + ' failed: RRULE and multi-date set at the same time');
|
|
1975
1972
|
}
|
|
1976
|
-
if (data.recurrence && data.recurrence !== '' && !/^RRULE:[\w
|
|
1973
|
+
if (data.recurrence && data.recurrence !== '' && !/^RRULE:[\w=;,:+\-/\\]+$/i.test(data.recurrence)) {
|
|
1977
1974
|
throw new Error(msgPrefix + ' failed: RRULE data misspelled');
|
|
1978
1975
|
}
|
|
1979
1976
|
return true;
|
|
@@ -1982,22 +1979,22 @@ async function atcb_validate_rrule_simplyfied(data, msgPrefix) {
|
|
|
1982
1979
|
if (data.recurrence_interval && (data.recurrence_interval < 1 || data.recurrence_interval % 1 !== 0)) {
|
|
1983
1980
|
throw new Error(msgPrefix + ' failed: recurrence data (interval) misspelled');
|
|
1984
1981
|
}
|
|
1985
|
-
if (data.recurrence_until && data.recurrence_until !== '' && !/^
|
|
1982
|
+
if (data.recurrence_until && data.recurrence_until !== '' && !/^[\d\-:]+$/.test(data.recurrence_until)) {
|
|
1986
1983
|
throw new Error(msgPrefix + ' failed: recurrence data (until) misspelled');
|
|
1987
1984
|
}
|
|
1988
1985
|
if (data.recurrence_count && (data.recurrence_count < 1 || data.recurrence_count % 1 !== 0)) {
|
|
1989
1986
|
throw new Error(msgPrefix + ' failed: recurrence data (interval) misspelled');
|
|
1990
1987
|
}
|
|
1991
|
-
if (data.recurrence_byMonth && data.recurrence_byMonth !== '' && !/^
|
|
1988
|
+
if (data.recurrence_byMonth && data.recurrence_byMonth !== '' && !/^[\d,]+$/.test(data.recurrence_byMonth)) {
|
|
1992
1989
|
throw new Error(msgPrefix + ' failed: recurrence data (byMonth) misspelled');
|
|
1993
1990
|
}
|
|
1994
|
-
if (data.recurrence_byMonthDay && data.recurrence_byMonthDay !== '' && !/^
|
|
1991
|
+
if (data.recurrence_byMonthDay && data.recurrence_byMonthDay !== '' && !/^[\d,]+$/.test(data.recurrence_byMonthDay)) {
|
|
1995
1992
|
throw new Error(msgPrefix + ' failed: recurrence data (byMonthDay) misspelled');
|
|
1996
1993
|
}
|
|
1997
|
-
if (data.recurrence_byDay && data.recurrence_byDay !== '' && !/^(\d
|
|
1994
|
+
if (data.recurrence_byDay && data.recurrence_byDay !== '' && !/^(?:[\d,-]|MO|TU|WE|TH|FR|SA|SU)+$/im.test(data.recurrence_byDay)) {
|
|
1998
1995
|
throw new Error(msgPrefix + ' failed: recurrence data (byDay) misspelled');
|
|
1999
1996
|
}
|
|
2000
|
-
if (data.recurrence_weekstart && data.recurrence_weekstart !== '' && !/^(MO|TU|WE|TH|FR|SA|SU)$/im.test(data.recurrence_weekstart)) {
|
|
1997
|
+
if (data.recurrence_weekstart && data.recurrence_weekstart !== '' && !/^(?:MO|TU|WE|TH|FR|SA|SU)$/im.test(data.recurrence_weekstart)) {
|
|
2001
1998
|
throw new Error(msgPrefix + ' failed: recurrence data (weekstart) misspelled');
|
|
2002
1999
|
}
|
|
2003
2000
|
return true;
|
|
@@ -2508,7 +2505,8 @@ function atcb_create_atcbl(host, atList = true, returnEl = false, licenseNoteOnl
|
|
|
2508
2505
|
}
|
|
2509
2506
|
} else {
|
|
2510
2507
|
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).';
|
|
2511
|
-
atcbL.setAttribute('style', 'none !important');
|
|
2508
|
+
atcbL.setAttribute('style', 'display:none !important');
|
|
2509
|
+
atcbL.classList.add('atcb-attribution');
|
|
2512
2510
|
host.append(atcbL);
|
|
2513
2511
|
}
|
|
2514
2512
|
if (returnEl) return null;
|
|
@@ -3185,7 +3183,7 @@ function atcb_subscribe_ical(data, fileUrl) {
|
|
|
3185
3183
|
function atcb_subscribe_google(data, fileUrl) {
|
|
3186
3184
|
const baseUrl = 'https://calendar.google.com/calendar/r?cid=';
|
|
3187
3185
|
const baseUrlApp = 'calendar.google.com/calendar?cid=';
|
|
3188
|
-
const fileUrlRegex = /^(https?:\/\/|webcal:\/\/|\/\/)calendar\.google\.com\//;
|
|
3186
|
+
const fileUrlRegex = /^(?:https?:\/\/|webcal:\/\/|\/\/)calendar\.google\.com\//;
|
|
3189
3187
|
const newFileUrl = (function () {
|
|
3190
3188
|
if (fileUrlRegex.test(fileUrl)) {
|
|
3191
3189
|
return fileUrl.replace(/^(.)*\?cid=/, '');
|
|
@@ -3220,7 +3218,7 @@ function atcb_generate_google(data, date, subEvent = 'all') {
|
|
|
3220
3218
|
urlParts.push('https://calendar.google.com/calendar/render?action=TEMPLATE');
|
|
3221
3219
|
const formattedDate = atcb_generate_time(date, 'clean', 'google');
|
|
3222
3220
|
urlParts.push('dates=' + encodeURIComponent(formattedDate.start) + '%2F' + encodeURIComponent(formattedDate.end));
|
|
3223
|
-
if (date.timeZone && date.timeZone !== '' && !/
|
|
3221
|
+
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) {
|
|
3224
3222
|
urlParts.push('ctz=' + date.timeZone);
|
|
3225
3223
|
}
|
|
3226
3224
|
if (date.name && date.name !== '') {
|
|
@@ -3371,7 +3369,6 @@ function atcb_open_cal_url(data, type, url, subscribe = false, subEvent = null,
|
|
|
3371
3369
|
return;
|
|
3372
3370
|
}
|
|
3373
3371
|
}
|
|
3374
|
-
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
|
3375
3372
|
const newTab = window.open(url, target);
|
|
3376
3373
|
if (newTab) {
|
|
3377
3374
|
newTab.focus();
|
|
@@ -3593,7 +3590,7 @@ function atcb_generate_time(data, style = 'delimiters', targetCal = 'general', a
|
|
|
3593
3590
|
}
|
|
3594
3591
|
return durationHours + ':' + ('0' + durationMinutes).slice(-2);
|
|
3595
3592
|
})();
|
|
3596
|
-
if (targetCal == 'ical' || (targetCal == 'google' && !/
|
|
3593
|
+
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))) {
|
|
3597
3594
|
return {
|
|
3598
3595
|
start: atcb_format_datetime(newStartDate, 'clean', true, true),
|
|
3599
3596
|
end: atcb_format_datetime(newEndDate, 'clean', true, true),
|
|
@@ -3915,7 +3912,7 @@ function atcb_secure_url(url, throwError = true) {
|
|
|
3915
3912
|
}
|
|
3916
3913
|
}
|
|
3917
3914
|
function atcb_validEmail(email) {
|
|
3918
|
-
if (!/^.{0,70}@.{1,30}\.[a-
|
|
3915
|
+
if (!/^.{0,70}@.{1,30}\.[a-z]{2,9}$/i.test(email)) {
|
|
3919
3916
|
return false;
|
|
3920
3917
|
}
|
|
3921
3918
|
return true;
|
|
@@ -3933,9 +3930,9 @@ function atcb_rewrite_html_elements(content, clear = false, iCalBreaks = false)
|
|
|
3933
3930
|
content = content.replace(/\{url\}(.+?)\{\/url\}/gi, (match, p1) => {
|
|
3934
3931
|
return p1.split('|')[0];
|
|
3935
3932
|
});
|
|
3936
|
-
content = content.replace(/\[(
|
|
3937
|
-
content = content.replace(/\{(
|
|
3938
|
-
content = content.replace(/&[#a-
|
|
3933
|
+
content = content.replace(/\[\/?(hr|[pbui]|strong|em|li|ul|ol|h\d)\]/gi, '');
|
|
3934
|
+
content = content.replace(/\{\/?(hr|[pbui]|strong|em|li|ul|ol|h\d)\}/gi, '');
|
|
3935
|
+
content = content.replace(/&[#a-z0-9]{1,9};/gi, '');
|
|
3939
3936
|
} else {
|
|
3940
3937
|
content = content.replace(/\[url\]((?:(?!\[\/url\]).)*)\[\/url\]/gi, function (match, p1) {
|
|
3941
3938
|
return atcb_parse_url_code(p1);
|
|
@@ -3943,8 +3940,8 @@ function atcb_rewrite_html_elements(content, clear = false, iCalBreaks = false)
|
|
|
3943
3940
|
content = content.replace(/\{url\}((?:(?!\[\/url\]).)*)\{\/url\}/gi, function (match, p1) {
|
|
3944
3941
|
return atcb_parse_url_code(p1);
|
|
3945
3942
|
});
|
|
3946
|
-
content = content.replace(/\[(
|
|
3947
|
-
content = content.replace(/\{(
|
|
3943
|
+
content = content.replace(/\[(\/)?(br|hr|[pbui]|strong|em|li|ul|ol|h\d)(\s?\/?)\]/gi, '<$1$2$3>');
|
|
3944
|
+
content = content.replace(/\{(\/)?(br|hr|[pbui]|strong|em|li|ul|ol|h\d)(\s?\/?)\}/gi, '<$1$2$3>');
|
|
3948
3945
|
}
|
|
3949
3946
|
return content;
|
|
3950
3947
|
}
|
|
@@ -5154,7 +5151,7 @@ if (atcbIsBrowser()) {
|
|
|
5154
5151
|
this.data.identifier = this.identifier;
|
|
5155
5152
|
} else {
|
|
5156
5153
|
if (this.data.identifier && this.data.identifier !== '') {
|
|
5157
|
-
if (!/^[\w
|
|
5154
|
+
if (!/^[\w-]+$/.test(this.data.identifier)) {
|
|
5158
5155
|
this.data.identifier = '';
|
|
5159
5156
|
if (this.debug) {
|
|
5160
5157
|
let prefix = 'Add to Calendar Button';
|
|
@@ -5352,7 +5349,7 @@ async function atcb_load_css(host, rootObj = null, data) {
|
|
|
5352
5349
|
const cssGlobalContent = document.createElement('style');
|
|
5353
5350
|
cssGlobalContent.id = 'atcb-global-style';
|
|
5354
5351
|
const scrollBarWidth = window.innerWidth - document.documentElement.clientWidth;
|
|
5355
|
-
cssGlobalContent.innerText = '.atcb-modal-no-scroll{overflow-y:hidden !important;-webkit-overflow-scrolling:touch;} body.atcb-modal-no-scroll{padding-right:' + scrollBarWidth + 'px;}';
|
|
5352
|
+
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;}';
|
|
5356
5353
|
if (nonceVal) {
|
|
5357
5354
|
cssGlobalContent.setAttribute('nonce', nonceVal);
|
|
5358
5355
|
}
|
|
@@ -5501,7 +5498,7 @@ async function atcb_action(inputData, triggerElement, keyboardTrigger = false) {
|
|
|
5501
5498
|
if (triggerElement.id && triggerElement.id !== '') {
|
|
5502
5499
|
data.identifier = triggerElement.id;
|
|
5503
5500
|
} else {
|
|
5504
|
-
if (data.identifier && data.identifier != '' && /^[\w
|
|
5501
|
+
if (data.identifier && data.identifier != '' && /^[\w-]+$/.test(data.identifier)) {
|
|
5505
5502
|
data.identifier = 'atcb-btn-' + data.identifier;
|
|
5506
5503
|
} else {
|
|
5507
5504
|
data.identifier = 'atcb-btn-custom';
|
package/dist/atcb-no-pro.js
CHANGED
|
@@ -974,14 +974,14 @@ 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.
|
|
984
|
+
const atcbVersion = '2.6.21';
|
|
985
985
|
const atcbCssTemplate = {
|
|
986
986
|
if (typeof window === 'undefined') {
|
|
987
987
|
return false;
|
|
@@ -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') {
|
|
@@ -1903,7 +1900,7 @@ async function atcb_validate_attendee(data, msgPrefix, i, msgSuffix) {
|
|
|
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;
|
|
@@ -2507,7 +2504,8 @@ function atcb_create_atcbl(host, atList = true, returnEl = false, licenseNoteOnl
|
|
|
2507
2504
|
}
|
|
2508
2505
|
} else {
|
|
2509
2506
|
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).';
|
|
2510
|
-
atcbL.setAttribute('style', 'none !important');
|
|
2507
|
+
atcbL.setAttribute('style', 'display:none !important');
|
|
2508
|
+
atcbL.classList.add('atcb-attribution');
|
|
2511
2509
|
host.append(atcbL);
|
|
2512
2510
|
}
|
|
2513
2511
|
if (returnEl) return null;
|
|
@@ -3184,7 +3182,7 @@ function atcb_subscribe_ical(data, fileUrl) {
|
|
|
3184
3182
|
function atcb_subscribe_google(data, fileUrl) {
|
|
3185
3183
|
const baseUrl = 'https://calendar.google.com/calendar/r?cid=';
|
|
3186
3184
|
const baseUrlApp = 'calendar.google.com/calendar?cid=';
|
|
3187
|
-
const fileUrlRegex = /^(https?:\/\/|webcal:\/\/|\/\/)calendar\.google\.com\//;
|
|
3185
|
+
const fileUrlRegex = /^(?:https?:\/\/|webcal:\/\/|\/\/)calendar\.google\.com\//;
|
|
3188
3186
|
const newFileUrl = (function () {
|
|
3189
3187
|
if (fileUrlRegex.test(fileUrl)) {
|
|
3190
3188
|
return fileUrl.replace(/^(.)*\?cid=/, '');
|
|
@@ -3219,7 +3217,7 @@ function atcb_generate_google(data, date, subEvent = 'all') {
|
|
|
3219
3217
|
urlParts.push('https://calendar.google.com/calendar/render?action=TEMPLATE');
|
|
3220
3218
|
const formattedDate = atcb_generate_time(date, 'clean', 'google');
|
|
3221
3219
|
urlParts.push('dates=' + encodeURIComponent(formattedDate.start) + '%2F' + encodeURIComponent(formattedDate.end));
|
|
3222
|
-
if (date.timeZone && date.timeZone !== '' && !/
|
|
3220
|
+
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) {
|
|
3223
3221
|
urlParts.push('ctz=' + date.timeZone);
|
|
3224
3222
|
}
|
|
3225
3223
|
if (date.name && date.name !== '') {
|
|
@@ -3370,7 +3368,6 @@ function atcb_open_cal_url(data, type, url, subscribe = false, subEvent = null,
|
|
|
3370
3368
|
return;
|
|
3371
3369
|
}
|
|
3372
3370
|
}
|
|
3373
|
-
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
|
3374
3371
|
const newTab = window.open(url, target);
|
|
3375
3372
|
if (newTab) {
|
|
3376
3373
|
newTab.focus();
|
|
@@ -3592,7 +3589,7 @@ function atcb_generate_time(data, style = 'delimiters', targetCal = 'general', a
|
|
|
3592
3589
|
}
|
|
3593
3590
|
return durationHours + ':' + ('0' + durationMinutes).slice(-2);
|
|
3594
3591
|
})();
|
|
3595
|
-
if (targetCal == 'ical' || (targetCal == 'google' && !/
|
|
3592
|
+
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))) {
|
|
3596
3593
|
return {
|
|
3597
3594
|
start: atcb_format_datetime(newStartDate, 'clean', true, true),
|
|
3598
3595
|
end: atcb_format_datetime(newEndDate, 'clean', true, true),
|
|
@@ -3914,7 +3911,7 @@ function atcb_secure_url(url, throwError = true) {
|
|
|
3914
3911
|
}
|
|
3915
3912
|
}
|
|
3916
3913
|
function atcb_validEmail(email) {
|
|
3917
|
-
if (!/^.{0,70}@.{1,30}\.[a-
|
|
3914
|
+
if (!/^.{0,70}@.{1,30}\.[a-z]{2,9}$/i.test(email)) {
|
|
3918
3915
|
return false;
|
|
3919
3916
|
}
|
|
3920
3917
|
return true;
|
|
@@ -3932,9 +3929,9 @@ function atcb_rewrite_html_elements(content, clear = false, iCalBreaks = false)
|
|
|
3932
3929
|
content = content.replace(/\{url\}(.+?)\{\/url\}/gi, (match, p1) => {
|
|
3933
3930
|
return p1.split('|')[0];
|
|
3934
3931
|
});
|
|
3935
|
-
content = content.replace(/\[(
|
|
3936
|
-
content = content.replace(/\{(
|
|
3937
|
-
content = content.replace(/&[#a-
|
|
3932
|
+
content = content.replace(/\[\/?(hr|[pbui]|strong|em|li|ul|ol|h\d)\]/gi, '');
|
|
3933
|
+
content = content.replace(/\{\/?(hr|[pbui]|strong|em|li|ul|ol|h\d)\}/gi, '');
|
|
3934
|
+
content = content.replace(/&[#a-z0-9]{1,9};/gi, '');
|
|
3938
3935
|
} else {
|
|
3939
3936
|
content = content.replace(/\[url\]((?:(?!\[\/url\]).)*)\[\/url\]/gi, function (match, p1) {
|
|
3940
3937
|
return atcb_parse_url_code(p1);
|
|
@@ -3942,8 +3939,8 @@ function atcb_rewrite_html_elements(content, clear = false, iCalBreaks = false)
|
|
|
3942
3939
|
content = content.replace(/\{url\}((?:(?!\[\/url\]).)*)\{\/url\}/gi, function (match, p1) {
|
|
3943
3940
|
return atcb_parse_url_code(p1);
|
|
3944
3941
|
});
|
|
3945
|
-
content = content.replace(/\[(
|
|
3946
|
-
content = content.replace(/\{(
|
|
3942
|
+
content = content.replace(/\[(\/)?(br|hr|[pbui]|strong|em|li|ul|ol|h\d)(\s?\/?)\]/gi, '<$1$2$3>');
|
|
3943
|
+
content = content.replace(/\{(\/)?(br|hr|[pbui]|strong|em|li|ul|ol|h\d)(\s?\/?)\}/gi, '<$1$2$3>');
|
|
3947
3944
|
}
|
|
3948
3945
|
return content;
|
|
3949
3946
|
}
|
|
@@ -5153,7 +5150,7 @@ if (atcbIsBrowser()) {
|
|
|
5153
5150
|
this.data.identifier = this.identifier;
|
|
5154
5151
|
} else {
|
|
5155
5152
|
if (this.data.identifier && this.data.identifier !== '') {
|
|
5156
|
-
if (!/^[\w
|
|
5153
|
+
if (!/^[\w-]+$/.test(this.data.identifier)) {
|
|
5157
5154
|
this.data.identifier = '';
|
|
5158
5155
|
if (this.debug) {
|
|
5159
5156
|
let prefix = 'Add to Calendar Button';
|
|
@@ -5351,7 +5348,7 @@ async function atcb_load_css(host, rootObj = null, data) {
|
|
|
5351
5348
|
const cssGlobalContent = document.createElement('style');
|
|
5352
5349
|
cssGlobalContent.id = 'atcb-global-style';
|
|
5353
5350
|
const scrollBarWidth = window.innerWidth - document.documentElement.clientWidth;
|
|
5354
|
-
cssGlobalContent.innerText = '.atcb-modal-no-scroll{overflow-y:hidden !important;-webkit-overflow-scrolling:touch;} body.atcb-modal-no-scroll{padding-right:' + scrollBarWidth + 'px;}';
|
|
5351
|
+
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;}';
|
|
5355
5352
|
if (nonceVal) {
|
|
5356
5353
|
cssGlobalContent.setAttribute('nonce', nonceVal);
|
|
5357
5354
|
}
|
|
@@ -5500,7 +5497,7 @@ async function atcb_action(inputData, triggerElement, keyboardTrigger = false) {
|
|
|
5500
5497
|
if (triggerElement.id && triggerElement.id !== '') {
|
|
5501
5498
|
data.identifier = triggerElement.id;
|
|
5502
5499
|
} else {
|
|
5503
|
-
if (data.identifier && data.identifier != '' && /^[\w
|
|
5500
|
+
if (data.identifier && data.identifier != '' && /^[\w-]+$/.test(data.identifier)) {
|
|
5504
5501
|
data.identifier = 'atcb-btn-' + data.identifier;
|
|
5505
5502
|
} else {
|
|
5506
5503
|
data.identifier = 'atcb-btn-custom';
|