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.
@@ -974,14 +974,14 @@ function tzlib_get_timezones(jsonType = false) {
974
974
  * Add to Calendar Button
975
975
  * ++++++++++++++++++++++
976
976
  *
977
- * Version: 2.6.20
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.20';
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 (/(; ?wv|(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari))/i.test(navigator.userAgent)) {
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 (/(Instagram)/i.test(navigator.userAgent)) {
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=;,:+-/\\]+|daily|weekly|monthly|yearly)$/im.test(data.recurrence)) {
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(/[^a-zA-Z0-9\-_.]/g, '');
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(/[^a-zA-Z0-9\-_.]/g, '');
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 (!/^(\d{4}-\d{2}-\d{2}T?(?:\d{2}:\d{2}|)Z?|today(?:\+\d{1,4}|))$/i.test(dateTimeData[point + 'Date'])) {
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($|\?)/.test(data.customCss))) {
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 (!/^(\w|-){1,254}$/.test(data.dates[`${i}`].uid)) {
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=;,:+-/\\]+$/i.test(data.recurrence)) {
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 !== '' && !/^(\d|-|:)+$/i.test(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 !== '' && !/^(\d|,)+$/.test(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 !== '' && !/^(\d|,)+$/.test(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|-|MO|TU|WE|TH|FR|SA|SU|,)+$/im.test(data.recurrence_byDay)) {
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;
@@ -3229,7 +3226,8 @@ function atcb_create_atcbl(host, atList = true, returnEl = false, licenseNoteOnl
3229
3226
  }
3230
3227
  } else {
3231
3228
  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).';
3232
- atcbL.setAttribute('style', 'none !important');
3229
+ atcbL.setAttribute('style', 'display:none !important');
3230
+ atcbL.classList.add('atcb-attribution');
3233
3231
  host.append(atcbL);
3234
3232
  }
3235
3233
  if (returnEl) return null;
@@ -3906,7 +3904,7 @@ function atcb_subscribe_ical(data, fileUrl) {
3906
3904
  function atcb_subscribe_google(data, fileUrl) {
3907
3905
  const baseUrl = 'https://calendar.google.com/calendar/r?cid=';
3908
3906
  const baseUrlApp = 'calendar.google.com/calendar?cid=';
3909
- const fileUrlRegex = /^(https?:\/\/|webcal:\/\/|\/\/)calendar\.google\.com\//;
3907
+ const fileUrlRegex = /^(?:https?:\/\/|webcal:\/\/|\/\/)calendar\.google\.com\//;
3910
3908
  const newFileUrl = (function () {
3911
3909
  if (fileUrlRegex.test(fileUrl)) {
3912
3910
  return fileUrl.replace(/^(.)*\?cid=/, '');
@@ -3941,7 +3939,7 @@ function atcb_generate_google(data, date, subEvent = 'all') {
3941
3939
  urlParts.push('https://calendar.google.com/calendar/render?action=TEMPLATE');
3942
3940
  const formattedDate = atcb_generate_time(date, 'clean', 'google');
3943
3941
  urlParts.push('dates=' + encodeURIComponent(formattedDate.start) + '%2F' + encodeURIComponent(formattedDate.end));
3944
- if (date.timeZone && date.timeZone !== '' && !/(GMT[+|-]\d{1,2}|Etc\/U|Etc\/Zulu|CET|CST6CDT|EET|EST|EST5EDT|MET|MST|MST7MDT|PST8PDT|WET)/i.test(date.timeZone) && !formattedDate.allday) {
3942
+ 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) {
3945
3943
  urlParts.push('ctz=' + date.timeZone);
3946
3944
  }
3947
3945
  if (date.name && date.name !== '') {
@@ -4092,7 +4090,6 @@ function atcb_open_cal_url(data, type, url, subscribe = false, subEvent = null,
4092
4090
  return;
4093
4091
  }
4094
4092
  }
4095
- // eslint-disable-next-line security/detect-non-literal-fs-filename
4096
4093
  const newTab = window.open(url, target);
4097
4094
  if (newTab) {
4098
4095
  newTab.focus();
@@ -4314,7 +4311,7 @@ function atcb_generate_time(data, style = 'delimiters', targetCal = 'general', a
4314
4311
  }
4315
4312
  return durationHours + ':' + ('0' + durationMinutes).slice(-2);
4316
4313
  })();
4317
- if (targetCal == 'ical' || (targetCal == 'google' && !/(GMT[+|-]\d{1,2}|Etc\/U|Etc\/Zulu|CET|CST6CDT|EET|EST|EST5EDT|MET|MST|MST7MDT|PST8PDT|WET)/i.test(data.timeZone))) {
4314
+ 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))) {
4318
4315
  return {
4319
4316
  start: atcb_format_datetime(newStartDate, 'clean', true, true),
4320
4317
  end: atcb_format_datetime(newEndDate, 'clean', true, true),
@@ -4636,7 +4633,7 @@ function atcb_secure_url(url, throwError = true) {
4636
4633
  }
4637
4634
  }
4638
4635
  function atcb_validEmail(email) {
4639
- if (!/^.{0,70}@.{1,30}\.[a-zA-Z]{2,9}$/.test(email)) {
4636
+ if (!/^.{0,70}@.{1,30}\.[a-z]{2,9}$/i.test(email)) {
4640
4637
  return false;
4641
4638
  }
4642
4639
  return true;
@@ -4654,9 +4651,9 @@ function atcb_rewrite_html_elements(content, clear = false, iCalBreaks = false)
4654
4651
  content = content.replace(/\{url\}(.+?)\{\/url\}/gi, (match, p1) => {
4655
4652
  return p1.split('|')[0];
4656
4653
  });
4657
- content = content.replace(/\[(|\/)(hr|p|b|strong|u|i|em|li|ul|ol|h\d)\]/gi, '');
4658
- content = content.replace(/\{(|\/)(hr|p|b|strong|u|i|em|li|ul|ol|h\d)\}/gi, '');
4659
- content = content.replace(/&[#a-zA-Z0-9]{1,9};/gi, '');
4654
+ content = content.replace(/\[\/?(hr|[pbui]|strong|em|li|ul|ol|h\d)\]/gi, '');
4655
+ content = content.replace(/\{\/?(hr|[pbui]|strong|em|li|ul|ol|h\d)\}/gi, '');
4656
+ content = content.replace(/&[#a-z0-9]{1,9};/gi, '');
4660
4657
  } else {
4661
4658
  content = content.replace(/\[url\]((?:(?!\[\/url\]).)*)\[\/url\]/gi, function (match, p1) {
4662
4659
  return atcb_parse_url_code(p1);
@@ -4664,8 +4661,8 @@ function atcb_rewrite_html_elements(content, clear = false, iCalBreaks = false)
4664
4661
  content = content.replace(/\{url\}((?:(?!\[\/url\]).)*)\{\/url\}/gi, function (match, p1) {
4665
4662
  return atcb_parse_url_code(p1);
4666
4663
  });
4667
- content = content.replace(/\[(\/|)(br|hr|p|b|strong|u|i|em|li|ul|ol|h\d)(\s?\/?)\]/gi, '<$1$2$3>');
4668
- content = content.replace(/\{(\/|)(br|hr|p|b|strong|u|i|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>');
4665
+ content = content.replace(/\{(\/)?(br|hr|[pbui]|strong|em|li|ul|ol|h\d)(\s?\/?)\}/gi, '<$1$2$3>');
4669
4666
  }
4670
4667
  return content;
4671
4668
  }
@@ -5875,7 +5872,7 @@ if (atcbIsBrowser()) {
5875
5872
  this.data.identifier = this.identifier;
5876
5873
  } else {
5877
5874
  if (this.data.identifier && this.data.identifier !== '') {
5878
- if (!/^[\w\-_]+$/.test(this.data.identifier)) {
5875
+ if (!/^[\w-]+$/.test(this.data.identifier)) {
5879
5876
  this.data.identifier = '';
5880
5877
  if (this.debug) {
5881
5878
  let prefix = 'Add to Calendar Button';
@@ -6073,7 +6070,7 @@ async function atcb_load_css(host, rootObj = null, data) {
6073
6070
  const cssGlobalContent = document.createElement('style');
6074
6071
  cssGlobalContent.id = 'atcb-global-style';
6075
6072
  const scrollBarWidth = window.innerWidth - document.documentElement.clientWidth;
6076
- cssGlobalContent.innerText = '.atcb-modal-no-scroll{overflow-y:hidden !important;-webkit-overflow-scrolling:touch;} body.atcb-modal-no-scroll{padding-right:' + scrollBarWidth + 'px;}';
6073
+ 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;}';
6077
6074
  if (nonceVal) {
6078
6075
  cssGlobalContent.setAttribute('nonce', nonceVal);
6079
6076
  }
@@ -6222,7 +6219,7 @@ async function atcb_action(inputData, triggerElement, keyboardTrigger = false) {
6222
6219
  if (triggerElement.id && triggerElement.id !== '') {
6223
6220
  data.identifier = triggerElement.id;
6224
6221
  } else {
6225
- if (data.identifier && data.identifier != '' && /^[\w\-_]+$/.test(data.identifier)) {
6222
+ if (data.identifier && data.identifier != '' && /^[\w-]+$/.test(data.identifier)) {
6226
6223
  data.identifier = 'atcb-btn-' + data.identifier;
6227
6224
  } else {
6228
6225
  data.identifier = 'atcb-btn-custom';
package/dist/atcb.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.20
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.20';
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 (/(; ?wv|(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari))/i.test(navigator.userAgent)) {
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 (/(Instagram)/i.test(navigator.userAgent)) {
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=;,:+-/\\]+|daily|weekly|monthly|yearly)$/im.test(data.recurrence)) {
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(/[^a-zA-Z0-9\-_.]/g, '');
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(/[^a-zA-Z0-9\-_.]/g, '');
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 (!/^(\d{4}-\d{2}-\d{2}T?(?:\d{2}:\d{2}|)Z?|today(?:\+\d{1,4}|))$/i.test(dateTimeData[point + 'Date'])) {
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($|\?)/.test(data.customCss))) {
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 (!/^(\w|-){1,254}$/.test(data.dates[`${i}`].uid)) {
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=;,:+-/\\]+$/i.test(data.recurrence)) {
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 !== '' && !/^(\d|-|:)+$/i.test(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 !== '' && !/^(\d|,)+$/.test(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 !== '' && !/^(\d|,)+$/.test(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|-|MO|TU|WE|TH|FR|SA|SU|,)+$/im.test(data.recurrence_byDay)) {
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;
@@ -3228,7 +3225,8 @@ function atcb_create_atcbl(host, atList = true, returnEl = false, licenseNoteOnl
3228
3225
  }
3229
3226
  } else {
3230
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).';
3231
- atcbL.setAttribute('style', 'none !important');
3228
+ atcbL.setAttribute('style', 'display:none !important');
3229
+ atcbL.classList.add('atcb-attribution');
3232
3230
  host.append(atcbL);
3233
3231
  }
3234
3232
  if (returnEl) return null;
@@ -3905,7 +3903,7 @@ function atcb_subscribe_ical(data, fileUrl) {
3905
3903
  function atcb_subscribe_google(data, fileUrl) {
3906
3904
  const baseUrl = 'https://calendar.google.com/calendar/r?cid=';
3907
3905
  const baseUrlApp = 'calendar.google.com/calendar?cid=';
3908
- const fileUrlRegex = /^(https?:\/\/|webcal:\/\/|\/\/)calendar\.google\.com\//;
3906
+ const fileUrlRegex = /^(?:https?:\/\/|webcal:\/\/|\/\/)calendar\.google\.com\//;
3909
3907
  const newFileUrl = (function () {
3910
3908
  if (fileUrlRegex.test(fileUrl)) {
3911
3909
  return fileUrl.replace(/^(.)*\?cid=/, '');
@@ -3940,7 +3938,7 @@ function atcb_generate_google(data, date, subEvent = 'all') {
3940
3938
  urlParts.push('https://calendar.google.com/calendar/render?action=TEMPLATE');
3941
3939
  const formattedDate = atcb_generate_time(date, 'clean', 'google');
3942
3940
  urlParts.push('dates=' + encodeURIComponent(formattedDate.start) + '%2F' + encodeURIComponent(formattedDate.end));
3943
- if (date.timeZone && date.timeZone !== '' && !/(GMT[+|-]\d{1,2}|Etc\/U|Etc\/Zulu|CET|CST6CDT|EET|EST|EST5EDT|MET|MST|MST7MDT|PST8PDT|WET)/i.test(date.timeZone) && !formattedDate.allday) {
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) {
3944
3942
  urlParts.push('ctz=' + date.timeZone);
3945
3943
  }
3946
3944
  if (date.name && date.name !== '') {
@@ -4091,7 +4089,6 @@ function atcb_open_cal_url(data, type, url, subscribe = false, subEvent = null,
4091
4089
  return;
4092
4090
  }
4093
4091
  }
4094
- // eslint-disable-next-line security/detect-non-literal-fs-filename
4095
4092
  const newTab = window.open(url, target);
4096
4093
  if (newTab) {
4097
4094
  newTab.focus();
@@ -4313,7 +4310,7 @@ function atcb_generate_time(data, style = 'delimiters', targetCal = 'general', a
4313
4310
  }
4314
4311
  return durationHours + ':' + ('0' + durationMinutes).slice(-2);
4315
4312
  })();
4316
- if (targetCal == 'ical' || (targetCal == 'google' && !/(GMT[+|-]\d{1,2}|Etc\/U|Etc\/Zulu|CET|CST6CDT|EET|EST|EST5EDT|MET|MST|MST7MDT|PST8PDT|WET)/i.test(data.timeZone))) {
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))) {
4317
4314
  return {
4318
4315
  start: atcb_format_datetime(newStartDate, 'clean', true, true),
4319
4316
  end: atcb_format_datetime(newEndDate, 'clean', true, true),
@@ -4635,7 +4632,7 @@ function atcb_secure_url(url, throwError = true) {
4635
4632
  }
4636
4633
  }
4637
4634
  function atcb_validEmail(email) {
4638
- if (!/^.{0,70}@.{1,30}\.[a-zA-Z]{2,9}$/.test(email)) {
4635
+ if (!/^.{0,70}@.{1,30}\.[a-z]{2,9}$/i.test(email)) {
4639
4636
  return false;
4640
4637
  }
4641
4638
  return true;
@@ -4653,9 +4650,9 @@ function atcb_rewrite_html_elements(content, clear = false, iCalBreaks = false)
4653
4650
  content = content.replace(/\{url\}(.+?)\{\/url\}/gi, (match, p1) => {
4654
4651
  return p1.split('|')[0];
4655
4652
  });
4656
- content = content.replace(/\[(|\/)(hr|p|b|strong|u|i|em|li|ul|ol|h\d)\]/gi, '');
4657
- content = content.replace(/\{(|\/)(hr|p|b|strong|u|i|em|li|ul|ol|h\d)\}/gi, '');
4658
- content = content.replace(/&[#a-zA-Z0-9]{1,9};/gi, '');
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, '');
4659
4656
  } else {
4660
4657
  content = content.replace(/\[url\]((?:(?!\[\/url\]).)*)\[\/url\]/gi, function (match, p1) {
4661
4658
  return atcb_parse_url_code(p1);
@@ -4663,8 +4660,8 @@ function atcb_rewrite_html_elements(content, clear = false, iCalBreaks = false)
4663
4660
  content = content.replace(/\{url\}((?:(?!\[\/url\]).)*)\{\/url\}/gi, function (match, p1) {
4664
4661
  return atcb_parse_url_code(p1);
4665
4662
  });
4666
- content = content.replace(/\[(\/|)(br|hr|p|b|strong|u|i|em|li|ul|ol|h\d)(\s?\/?)\]/gi, '<$1$2$3>');
4667
- content = content.replace(/\{(\/|)(br|hr|p|b|strong|u|i|em|li|ul|ol|h\d)(\s?\/?)\}/gi, '<$1$2$3>');
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>');
4668
4665
  }
4669
4666
  return content;
4670
4667
  }
@@ -5874,7 +5871,7 @@ if (atcbIsBrowser()) {
5874
5871
  this.data.identifier = this.identifier;
5875
5872
  } else {
5876
5873
  if (this.data.identifier && this.data.identifier !== '') {
5877
- if (!/^[\w\-_]+$/.test(this.data.identifier)) {
5874
+ if (!/^[\w-]+$/.test(this.data.identifier)) {
5878
5875
  this.data.identifier = '';
5879
5876
  if (this.debug) {
5880
5877
  let prefix = 'Add to Calendar Button';
@@ -6072,7 +6069,7 @@ async function atcb_load_css(host, rootObj = null, data) {
6072
6069
  const cssGlobalContent = document.createElement('style');
6073
6070
  cssGlobalContent.id = 'atcb-global-style';
6074
6071
  const scrollBarWidth = window.innerWidth - document.documentElement.clientWidth;
6075
- 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;}';
6076
6073
  if (nonceVal) {
6077
6074
  cssGlobalContent.setAttribute('nonce', nonceVal);
6078
6075
  }
@@ -6221,7 +6218,7 @@ async function atcb_action(inputData, triggerElement, keyboardTrigger = false) {
6221
6218
  if (triggerElement.id && triggerElement.id !== '') {
6222
6219
  data.identifier = triggerElement.id;
6223
6220
  } else {
6224
- if (data.identifier && data.identifier != '' && /^[\w\-_]+$/.test(data.identifier)) {
6221
+ if (data.identifier && data.identifier != '' && /^[\w-]+$/.test(data.identifier)) {
6225
6222
  data.identifier = 'atcb-btn-' + data.identifier;
6226
6223
  } else {
6227
6224
  data.identifier = 'atcb-btn-custom';