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.
@@ -1,4 +1,3 @@
1
- // eslint-disable-next-line @typescript-eslint/no-var-requires
2
1
  const tzlibActions = require('timezones-ical-library');
3
2
  /*!
4
3
  * @preserve
@@ -7,14 +6,14 @@ const tzlibActions = require('timezones-ical-library');
7
6
  * Add to Calendar Button
8
7
  * ++++++++++++++++++++++
9
8
  *
10
- * Version: 2.6.20
9
+ * Version: 2.6.21
11
10
  * Creator: Jens Kuerschner (https://jekuer.com)
12
11
  * Project: https://github.com/add2cal/add-to-calendar-button
13
12
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
14
13
  * Note: DO NOT REMOVE THE COPYRIGHT NOTICE ABOVE!
15
14
  *
16
15
  */
17
- const atcbVersion = '2.6.20';
16
+ const atcbVersion = '2.6.21';
18
17
  const atcbCssTemplate = {
19
18
  if (typeof window === 'undefined') {
20
19
  return false;
@@ -57,7 +56,7 @@ const atcbIsAndroid = atcbIsBrowser()
57
56
  };*/
58
57
  const atcbIsSafari = atcbIsBrowser()
59
58
  ? () => {
60
- if (/^((?!chrome|android|crios|fxios).)*safari/i.test(navigator.userAgent)) {
59
+ if (/^(?:(?!chrome|android|crios|fxios).)*safari/i.test(navigator.userAgent)) {
61
60
  return true;
62
61
  } else {
63
62
  return false;
@@ -75,7 +74,7 @@ const atcbIsMobile = () => {
75
74
  };
76
75
  const atcbIsWebView = atcbIsBrowser()
77
76
  ? () => {
78
- if (/(; ?wv|(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari))/i.test(navigator.userAgent)) {
77
+ if (/; ?wv|(?:iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(navigator.userAgent)) {
79
78
  return true;
80
79
  } else {
81
80
  return false;
@@ -86,7 +85,7 @@ const atcbIsWebView = atcbIsBrowser()
86
85
  };
87
86
  const atcbIsProblematicWebView = atcbIsBrowser()
88
87
  ? () => {
89
- if (/(Instagram)/i.test(navigator.userAgent)) {
88
+ if (/Instagram/i.test(navigator.userAgent)) {
90
89
  return true;
91
90
  } else {
92
91
  return false;
@@ -305,7 +304,7 @@ function atcb_decorate_data_timezone(tz = null) {
305
304
  function atcb_decorate_data_rrule(data) {
306
305
  if (data.recurrence && data.recurrence !== '') {
307
306
  data.recurrence = data.recurrence.replace(/\s+/g, '').toUpperCase();
308
- if (!/^(RRULE:[\w=;,:+-/\\]+|daily|weekly|monthly|yearly)$/im.test(data.recurrence)) {
307
+ if (!/^(?:RRULE:[\w=;,:+\-/\\]+|daily|weekly|monthly|yearly)$/im.test(data.recurrence)) {
309
308
  data.recurrence = '!wrong rrule format!';
310
309
  } else {
311
310
  if (/^RRULE:/i.test(data.recurrence)) {
@@ -548,8 +547,7 @@ function atcb_decorate_data_description(data, i) {
548
547
  description = cleanDescription(description);
549
548
  if (data.customVar) {
550
549
  for (const key in data.customVar) {
551
- const sanitizedKey = key.replace(/[^a-zA-Z0-9\-_.]/g, '');
552
- // eslint-disable-next-line security/detect-non-literal-regexp
550
+ const sanitizedKey = key.replace(/[^\w\-.]/g, '');
553
551
  description = description.replace(new RegExp(`%%${sanitizedKey}%%`, 'g'), data.customVar[`${key}`]);
554
552
  }
555
553
  }
@@ -608,10 +606,8 @@ function atcb_decorate_data_extend(data) {
608
606
  }
609
607
  if (data.customVar) {
610
608
  for (const key in data.customVar) {
611
- const sanitizedKey = key.replace(/[^a-zA-Z0-9\-_.]/g, '');
612
- // eslint-disable-next-line security/detect-non-literal-regexp
609
+ const sanitizedKey = key.replace(/[^\w\-.]/g, '');
613
610
  data.dates[`${i}`].name = data.dates[`${i}`].name.replace(new RegExp(`%%${sanitizedKey}%%`, 'g'), data.customVar[`${key}`]);
614
- // eslint-disable-next-line security/detect-non-literal-regexp
615
611
  data.dates[`${i}`].location = data.dates[`${i}`].location.replace(new RegExp(`%%${sanitizedKey}%%`, 'g'), data.customVar[`${key}`]);
616
612
  }
617
613
  }
@@ -630,7 +626,7 @@ function atcb_date_cleanup(dateTimeData) {
630
626
  }
631
627
  const endpoints = ['start', 'end'];
632
628
  endpoints.forEach(function (point) {
633
- if (!/^(\d{4}-\d{2}-\d{2}T?(?:\d{2}:\d{2}|)Z?|today(?:\+\d{1,4}|))$/i.test(dateTimeData[point + 'Date'])) {
629
+ if (!/^(?:\d{4}-\d{2}-\d{2}T?(?:\d{2}:\d{2})?Z?|today(?:\+\d{1,4})?)$/i.test(dateTimeData[point + 'Date'])) {
634
630
  dateTimeData[point + 'Date'] = 'badly-formed';
635
631
  } else {
636
632
  dateTimeData[point + 'Date'] = atcb_date_calculation(dateTimeData[point + 'Date']);
@@ -835,7 +831,7 @@ async function atcb_validate_buttonStyle(data, msgPrefix) {
835
831
  if (!availableStyles.includes(data.buttonStyle)) {
836
832
  throw new Error(msgPrefix + ' failed: provided buttonStyle invalid');
837
833
  }
838
- if (data.customCss && data.customCss !== '' && (!atcb_secure_url(data.customCss, false) || !/\.css($|\?)/.test(data.customCss))) {
834
+ if (data.customCss && data.customCss !== '' && (!atcb_secure_url(data.customCss, false) || !/\.css(?:$|\?)/.test(data.customCss))) {
839
835
  throw new Error(msgPrefix + ' failed: customCss provided, but no valid url');
840
836
  }
841
837
  if ((!data.customCss || data.customCss === '') && data.buttonStyle === 'custom') {
@@ -936,7 +932,7 @@ async function atcb_validate_attendee(data, msgPrefix, i, msgSuffix) {
936
932
  return true;
937
933
  }
938
934
  async function atcb_validate_uid(data, msgPrefix, i, msgSuffix) {
939
- if (!/^(\w|-){1,254}$/.test(data.dates[`${i}`].uid)) {
935
+ if (!/^(?:\w|-){1,254}$/.test(data.dates[`${i}`].uid)) {
940
936
  if (data.debug) {
941
937
  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);
942
938
  }
@@ -1005,7 +1001,7 @@ async function atcb_validate_rrule(data, msgPrefix) {
1005
1001
  if (data.recurrence && data.recurrence !== '' && data.dates.length > 1) {
1006
1002
  throw new Error(msgPrefix + ' failed: RRULE and multi-date set at the same time');
1007
1003
  }
1008
- if (data.recurrence && data.recurrence !== '' && !/^RRULE:[\w=;,:+-/\\]+$/i.test(data.recurrence)) {
1004
+ if (data.recurrence && data.recurrence !== '' && !/^RRULE:[\w=;,:+\-/\\]+$/i.test(data.recurrence)) {
1009
1005
  throw new Error(msgPrefix + ' failed: RRULE data misspelled');
1010
1006
  }
1011
1007
  return true;
@@ -1014,22 +1010,22 @@ async function atcb_validate_rrule_simplyfied(data, msgPrefix) {
1014
1010
  if (data.recurrence_interval && (data.recurrence_interval < 1 || data.recurrence_interval % 1 !== 0)) {
1015
1011
  throw new Error(msgPrefix + ' failed: recurrence data (interval) misspelled');
1016
1012
  }
1017
- if (data.recurrence_until && data.recurrence_until !== '' && !/^(\d|-|:)+$/i.test(data.recurrence_until)) {
1013
+ if (data.recurrence_until && data.recurrence_until !== '' && !/^[\d\-:]+$/.test(data.recurrence_until)) {
1018
1014
  throw new Error(msgPrefix + ' failed: recurrence data (until) misspelled');
1019
1015
  }
1020
1016
  if (data.recurrence_count && (data.recurrence_count < 1 || data.recurrence_count % 1 !== 0)) {
1021
1017
  throw new Error(msgPrefix + ' failed: recurrence data (interval) misspelled');
1022
1018
  }
1023
- if (data.recurrence_byMonth && data.recurrence_byMonth !== '' && !/^(\d|,)+$/.test(data.recurrence_byMonth)) {
1019
+ if (data.recurrence_byMonth && data.recurrence_byMonth !== '' && !/^[\d,]+$/.test(data.recurrence_byMonth)) {
1024
1020
  throw new Error(msgPrefix + ' failed: recurrence data (byMonth) misspelled');
1025
1021
  }
1026
- if (data.recurrence_byMonthDay && data.recurrence_byMonthDay !== '' && !/^(\d|,)+$/.test(data.recurrence_byMonthDay)) {
1022
+ if (data.recurrence_byMonthDay && data.recurrence_byMonthDay !== '' && !/^[\d,]+$/.test(data.recurrence_byMonthDay)) {
1027
1023
  throw new Error(msgPrefix + ' failed: recurrence data (byMonthDay) misspelled');
1028
1024
  }
1029
- if (data.recurrence_byDay && data.recurrence_byDay !== '' && !/^(\d|-|MO|TU|WE|TH|FR|SA|SU|,)+$/im.test(data.recurrence_byDay)) {
1025
+ if (data.recurrence_byDay && data.recurrence_byDay !== '' && !/^(?:[\d,-]|MO|TU|WE|TH|FR|SA|SU)+$/im.test(data.recurrence_byDay)) {
1030
1026
  throw new Error(msgPrefix + ' failed: recurrence data (byDay) misspelled');
1031
1027
  }
1032
- if (data.recurrence_weekstart && data.recurrence_weekstart !== '' && !/^(MO|TU|WE|TH|FR|SA|SU)$/im.test(data.recurrence_weekstart)) {
1028
+ if (data.recurrence_weekstart && data.recurrence_weekstart !== '' && !/^(?:MO|TU|WE|TH|FR|SA|SU)$/im.test(data.recurrence_weekstart)) {
1033
1029
  throw new Error(msgPrefix + ' failed: recurrence data (weekstart) misspelled');
1034
1030
  }
1035
1031
  return true;
@@ -2261,7 +2257,8 @@ function atcb_create_atcbl(host, atList = true, returnEl = false, licenseNoteOnl
2261
2257
  }
2262
2258
  } else {
2263
2259
  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).';
2264
- atcbL.setAttribute('style', 'none !important');
2260
+ atcbL.setAttribute('style', 'display:none !important');
2261
+ atcbL.classList.add('atcb-attribution');
2265
2262
  host.append(atcbL);
2266
2263
  }
2267
2264
  if (returnEl) return null;
@@ -2938,7 +2935,7 @@ function atcb_subscribe_ical(data, fileUrl) {
2938
2935
  function atcb_subscribe_google(data, fileUrl) {
2939
2936
  const baseUrl = 'https://calendar.google.com/calendar/r?cid=';
2940
2937
  const baseUrlApp = 'calendar.google.com/calendar?cid=';
2941
- const fileUrlRegex = /^(https?:\/\/|webcal:\/\/|\/\/)calendar\.google\.com\//;
2938
+ const fileUrlRegex = /^(?:https?:\/\/|webcal:\/\/|\/\/)calendar\.google\.com\//;
2942
2939
  const newFileUrl = (function () {
2943
2940
  if (fileUrlRegex.test(fileUrl)) {
2944
2941
  return fileUrl.replace(/^(.)*\?cid=/, '');
@@ -2973,7 +2970,7 @@ function atcb_generate_google(data, date, subEvent = 'all') {
2973
2970
  urlParts.push('https://calendar.google.com/calendar/render?action=TEMPLATE');
2974
2971
  const formattedDate = atcb_generate_time(date, 'clean', 'google');
2975
2972
  urlParts.push('dates=' + encodeURIComponent(formattedDate.start) + '%2F' + encodeURIComponent(formattedDate.end));
2976
- 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) {
2973
+ 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) {
2977
2974
  urlParts.push('ctz=' + date.timeZone);
2978
2975
  }
2979
2976
  if (date.name && date.name !== '') {
@@ -3124,7 +3121,6 @@ function atcb_open_cal_url(data, type, url, subscribe = false, subEvent = null,
3124
3121
  return;
3125
3122
  }
3126
3123
  }
3127
- // eslint-disable-next-line security/detect-non-literal-fs-filename
3128
3124
  const newTab = window.open(url, target);
3129
3125
  if (newTab) {
3130
3126
  newTab.focus();
@@ -3346,7 +3342,7 @@ function atcb_generate_time(data, style = 'delimiters', targetCal = 'general', a
3346
3342
  }
3347
3343
  return durationHours + ':' + ('0' + durationMinutes).slice(-2);
3348
3344
  })();
3349
- 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))) {
3345
+ 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))) {
3350
3346
  return {
3351
3347
  start: atcb_format_datetime(newStartDate, 'clean', true, true),
3352
3348
  end: atcb_format_datetime(newEndDate, 'clean', true, true),
@@ -3668,7 +3664,7 @@ function atcb_secure_url(url, throwError = true) {
3668
3664
  }
3669
3665
  }
3670
3666
  function atcb_validEmail(email) {
3671
- if (!/^.{0,70}@.{1,30}\.[a-zA-Z]{2,9}$/.test(email)) {
3667
+ if (!/^.{0,70}@.{1,30}\.[a-z]{2,9}$/i.test(email)) {
3672
3668
  return false;
3673
3669
  }
3674
3670
  return true;
@@ -3686,9 +3682,9 @@ function atcb_rewrite_html_elements(content, clear = false, iCalBreaks = false)
3686
3682
  content = content.replace(/\{url\}(.+?)\{\/url\}/gi, (match, p1) => {
3687
3683
  return p1.split('|')[0];
3688
3684
  });
3689
- content = content.replace(/\[(|\/)(hr|p|b|strong|u|i|em|li|ul|ol|h\d)\]/gi, '');
3690
- content = content.replace(/\{(|\/)(hr|p|b|strong|u|i|em|li|ul|ol|h\d)\}/gi, '');
3691
- content = content.replace(/&[#a-zA-Z0-9]{1,9};/gi, '');
3685
+ content = content.replace(/\[\/?(hr|[pbui]|strong|em|li|ul|ol|h\d)\]/gi, '');
3686
+ content = content.replace(/\{\/?(hr|[pbui]|strong|em|li|ul|ol|h\d)\}/gi, '');
3687
+ content = content.replace(/&[#a-z0-9]{1,9};/gi, '');
3692
3688
  } else {
3693
3689
  content = content.replace(/\[url\]((?:(?!\[\/url\]).)*)\[\/url\]/gi, function (match, p1) {
3694
3690
  return atcb_parse_url_code(p1);
@@ -3696,8 +3692,8 @@ function atcb_rewrite_html_elements(content, clear = false, iCalBreaks = false)
3696
3692
  content = content.replace(/\{url\}((?:(?!\[\/url\]).)*)\{\/url\}/gi, function (match, p1) {
3697
3693
  return atcb_parse_url_code(p1);
3698
3694
  });
3699
- content = content.replace(/\[(\/|)(br|hr|p|b|strong|u|i|em|li|ul|ol|h\d)(\s?\/?)\]/gi, '<$1$2$3>');
3700
- content = content.replace(/\{(\/|)(br|hr|p|b|strong|u|i|em|li|ul|ol|h\d)(\s?\/?)\}/gi, '<$1$2$3>');
3695
+ content = content.replace(/\[(\/)?(br|hr|[pbui]|strong|em|li|ul|ol|h\d)(\s?\/?)\]/gi, '<$1$2$3>');
3696
+ content = content.replace(/\{(\/)?(br|hr|[pbui]|strong|em|li|ul|ol|h\d)(\s?\/?)\}/gi, '<$1$2$3>');
3701
3697
  }
3702
3698
  return content;
3703
3699
  }
@@ -4907,7 +4903,7 @@ if (atcbIsBrowser()) {
4907
4903
  this.data.identifier = this.identifier;
4908
4904
  } else {
4909
4905
  if (this.data.identifier && this.data.identifier !== '') {
4910
- if (!/^[\w\-_]+$/.test(this.data.identifier)) {
4906
+ if (!/^[\w-]+$/.test(this.data.identifier)) {
4911
4907
  this.data.identifier = '';
4912
4908
  if (this.debug) {
4913
4909
  let prefix = 'Add to Calendar Button';
@@ -5105,7 +5101,7 @@ async function atcb_load_css(host, rootObj = null, data) {
5105
5101
  const cssGlobalContent = document.createElement('style');
5106
5102
  cssGlobalContent.id = 'atcb-global-style';
5107
5103
  const scrollBarWidth = window.innerWidth - document.documentElement.clientWidth;
5108
- cssGlobalContent.innerText = '.atcb-modal-no-scroll{overflow-y:hidden !important;-webkit-overflow-scrolling:touch;} body.atcb-modal-no-scroll{padding-right:' + scrollBarWidth + 'px;}';
5104
+ 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;}';
5109
5105
  if (nonceVal) {
5110
5106
  cssGlobalContent.setAttribute('nonce', nonceVal);
5111
5107
  }
@@ -5254,7 +5250,7 @@ async function atcb_action(inputData, triggerElement, keyboardTrigger = false) {
5254
5250
  if (triggerElement.id && triggerElement.id !== '') {
5255
5251
  data.identifier = triggerElement.id;
5256
5252
  } else {
5257
- if (data.identifier && data.identifier != '' && /^[\w\-_]+$/.test(data.identifier)) {
5253
+ if (data.identifier && data.identifier != '' && /^[\w-]+$/.test(data.identifier)) {
5258
5254
  data.identifier = 'atcb-btn-' + data.identifier;
5259
5255
  } else {
5260
5256
  data.identifier = 'atcb-btn-custom';
@@ -1,4 +1,3 @@
1
- // eslint-disable-next-line @typescript-eslint/no-var-requires
2
1
  const tzlibActions = require('timezones-ical-library');
3
2
  /*!
4
3
  * @preserve
@@ -7,14 +6,14 @@ const tzlibActions = require('timezones-ical-library');
7
6
  * Add to Calendar Button
8
7
  * ++++++++++++++++++++++
9
8
  *
10
- * Version: 2.6.20
9
+ * Version: 2.6.21
11
10
  * Creator: Jens Kuerschner (https://jekuer.com)
12
11
  * Project: https://github.com/add2cal/add-to-calendar-button
13
12
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
14
13
  * Note: DO NOT REMOVE THE COPYRIGHT NOTICE ABOVE!
15
14
  *
16
15
  */
17
- const atcbVersion = '2.6.20';
16
+ const atcbVersion = '2.6.21';
18
17
  const atcbCssTemplate = {
19
18
  if (typeof window === 'undefined') {
20
19
  return false;
@@ -57,7 +56,7 @@ const atcbIsAndroid = atcbIsBrowser()
57
56
  };*/
58
57
  const atcbIsSafari = atcbIsBrowser()
59
58
  ? () => {
60
- if (/^((?!chrome|android|crios|fxios).)*safari/i.test(navigator.userAgent)) {
59
+ if (/^(?:(?!chrome|android|crios|fxios).)*safari/i.test(navigator.userAgent)) {
61
60
  return true;
62
61
  } else {
63
62
  return false;
@@ -75,7 +74,7 @@ const atcbIsMobile = () => {
75
74
  };
76
75
  const atcbIsWebView = atcbIsBrowser()
77
76
  ? () => {
78
- if (/(; ?wv|(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari))/i.test(navigator.userAgent)) {
77
+ if (/; ?wv|(?:iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(navigator.userAgent)) {
79
78
  return true;
80
79
  } else {
81
80
  return false;
@@ -86,7 +85,7 @@ const atcbIsWebView = atcbIsBrowser()
86
85
  };
87
86
  const atcbIsProblematicWebView = atcbIsBrowser()
88
87
  ? () => {
89
- if (/(Instagram)/i.test(navigator.userAgent)) {
88
+ if (/Instagram/i.test(navigator.userAgent)) {
90
89
  return true;
91
90
  } else {
92
91
  return false;
@@ -305,7 +304,7 @@ function atcb_decorate_data_timezone(tz = null) {
305
304
  function atcb_decorate_data_rrule(data) {
306
305
  if (data.recurrence && data.recurrence !== '') {
307
306
  data.recurrence = data.recurrence.replace(/\s+/g, '').toUpperCase();
308
- if (!/^(RRULE:[\w=;,:+-/\\]+|daily|weekly|monthly|yearly)$/im.test(data.recurrence)) {
307
+ if (!/^(?:RRULE:[\w=;,:+\-/\\]+|daily|weekly|monthly|yearly)$/im.test(data.recurrence)) {
309
308
  data.recurrence = '!wrong rrule format!';
310
309
  } else {
311
310
  if (/^RRULE:/i.test(data.recurrence)) {
@@ -548,8 +547,7 @@ function atcb_decorate_data_description(data, i) {
548
547
  description = cleanDescription(description);
549
548
  if (data.customVar) {
550
549
  for (const key in data.customVar) {
551
- const sanitizedKey = key.replace(/[^a-zA-Z0-9\-_.]/g, '');
552
- // eslint-disable-next-line security/detect-non-literal-regexp
550
+ const sanitizedKey = key.replace(/[^\w\-.]/g, '');
553
551
  description = description.replace(new RegExp(`%%${sanitizedKey}%%`, 'g'), data.customVar[`${key}`]);
554
552
  }
555
553
  }
@@ -608,10 +606,8 @@ function atcb_decorate_data_extend(data) {
608
606
  }
609
607
  if (data.customVar) {
610
608
  for (const key in data.customVar) {
611
- const sanitizedKey = key.replace(/[^a-zA-Z0-9\-_.]/g, '');
612
- // eslint-disable-next-line security/detect-non-literal-regexp
609
+ const sanitizedKey = key.replace(/[^\w\-.]/g, '');
613
610
  data.dates[`${i}`].name = data.dates[`${i}`].name.replace(new RegExp(`%%${sanitizedKey}%%`, 'g'), data.customVar[`${key}`]);
614
- // eslint-disable-next-line security/detect-non-literal-regexp
615
611
  data.dates[`${i}`].location = data.dates[`${i}`].location.replace(new RegExp(`%%${sanitizedKey}%%`, 'g'), data.customVar[`${key}`]);
616
612
  }
617
613
  }
@@ -630,7 +626,7 @@ function atcb_date_cleanup(dateTimeData) {
630
626
  }
631
627
  const endpoints = ['start', 'end'];
632
628
  endpoints.forEach(function (point) {
633
- if (!/^(\d{4}-\d{2}-\d{2}T?(?:\d{2}:\d{2}|)Z?|today(?:\+\d{1,4}|))$/i.test(dateTimeData[point + 'Date'])) {
629
+ if (!/^(?:\d{4}-\d{2}-\d{2}T?(?:\d{2}:\d{2})?Z?|today(?:\+\d{1,4})?)$/i.test(dateTimeData[point + 'Date'])) {
634
630
  dateTimeData[point + 'Date'] = 'badly-formed';
635
631
  } else {
636
632
  dateTimeData[point + 'Date'] = atcb_date_calculation(dateTimeData[point + 'Date']);
@@ -835,7 +831,7 @@ async function atcb_validate_buttonStyle(data, msgPrefix) {
835
831
  if (!availableStyles.includes(data.buttonStyle)) {
836
832
  throw new Error(msgPrefix + ' failed: provided buttonStyle invalid');
837
833
  }
838
- if (data.customCss && data.customCss !== '' && (!atcb_secure_url(data.customCss, false) || !/\.css($|\?)/.test(data.customCss))) {
834
+ if (data.customCss && data.customCss !== '' && (!atcb_secure_url(data.customCss, false) || !/\.css(?:$|\?)/.test(data.customCss))) {
839
835
  throw new Error(msgPrefix + ' failed: customCss provided, but no valid url');
840
836
  }
841
837
  if ((!data.customCss || data.customCss === '') && data.buttonStyle === 'custom') {
@@ -936,7 +932,7 @@ async function atcb_validate_attendee(data, msgPrefix, i, msgSuffix) {
936
932
  return true;
937
933
  }
938
934
  async function atcb_validate_uid(data, msgPrefix, i, msgSuffix) {
939
- if (!/^(\w|-){1,254}$/.test(data.dates[`${i}`].uid)) {
935
+ if (!/^(?:\w|-){1,254}$/.test(data.dates[`${i}`].uid)) {
940
936
  if (data.debug) {
941
937
  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);
942
938
  }
@@ -1005,7 +1001,7 @@ async function atcb_validate_rrule(data, msgPrefix) {
1005
1001
  if (data.recurrence && data.recurrence !== '' && data.dates.length > 1) {
1006
1002
  throw new Error(msgPrefix + ' failed: RRULE and multi-date set at the same time');
1007
1003
  }
1008
- if (data.recurrence && data.recurrence !== '' && !/^RRULE:[\w=;,:+-/\\]+$/i.test(data.recurrence)) {
1004
+ if (data.recurrence && data.recurrence !== '' && !/^RRULE:[\w=;,:+\-/\\]+$/i.test(data.recurrence)) {
1009
1005
  throw new Error(msgPrefix + ' failed: RRULE data misspelled');
1010
1006
  }
1011
1007
  return true;
@@ -1014,22 +1010,22 @@ async function atcb_validate_rrule_simplyfied(data, msgPrefix) {
1014
1010
  if (data.recurrence_interval && (data.recurrence_interval < 1 || data.recurrence_interval % 1 !== 0)) {
1015
1011
  throw new Error(msgPrefix + ' failed: recurrence data (interval) misspelled');
1016
1012
  }
1017
- if (data.recurrence_until && data.recurrence_until !== '' && !/^(\d|-|:)+$/i.test(data.recurrence_until)) {
1013
+ if (data.recurrence_until && data.recurrence_until !== '' && !/^[\d\-:]+$/.test(data.recurrence_until)) {
1018
1014
  throw new Error(msgPrefix + ' failed: recurrence data (until) misspelled');
1019
1015
  }
1020
1016
  if (data.recurrence_count && (data.recurrence_count < 1 || data.recurrence_count % 1 !== 0)) {
1021
1017
  throw new Error(msgPrefix + ' failed: recurrence data (interval) misspelled');
1022
1018
  }
1023
- if (data.recurrence_byMonth && data.recurrence_byMonth !== '' && !/^(\d|,)+$/.test(data.recurrence_byMonth)) {
1019
+ if (data.recurrence_byMonth && data.recurrence_byMonth !== '' && !/^[\d,]+$/.test(data.recurrence_byMonth)) {
1024
1020
  throw new Error(msgPrefix + ' failed: recurrence data (byMonth) misspelled');
1025
1021
  }
1026
- if (data.recurrence_byMonthDay && data.recurrence_byMonthDay !== '' && !/^(\d|,)+$/.test(data.recurrence_byMonthDay)) {
1022
+ if (data.recurrence_byMonthDay && data.recurrence_byMonthDay !== '' && !/^[\d,]+$/.test(data.recurrence_byMonthDay)) {
1027
1023
  throw new Error(msgPrefix + ' failed: recurrence data (byMonthDay) misspelled');
1028
1024
  }
1029
- if (data.recurrence_byDay && data.recurrence_byDay !== '' && !/^(\d|-|MO|TU|WE|TH|FR|SA|SU|,)+$/im.test(data.recurrence_byDay)) {
1025
+ if (data.recurrence_byDay && data.recurrence_byDay !== '' && !/^(?:[\d,-]|MO|TU|WE|TH|FR|SA|SU)+$/im.test(data.recurrence_byDay)) {
1030
1026
  throw new Error(msgPrefix + ' failed: recurrence data (byDay) misspelled');
1031
1027
  }
1032
- if (data.recurrence_weekstart && data.recurrence_weekstart !== '' && !/^(MO|TU|WE|TH|FR|SA|SU)$/im.test(data.recurrence_weekstart)) {
1028
+ if (data.recurrence_weekstart && data.recurrence_weekstart !== '' && !/^(?:MO|TU|WE|TH|FR|SA|SU)$/im.test(data.recurrence_weekstart)) {
1033
1029
  throw new Error(msgPrefix + ' failed: recurrence data (weekstart) misspelled');
1034
1030
  }
1035
1031
  return true;
@@ -1540,7 +1536,8 @@ function atcb_create_atcbl(host, atList = true, returnEl = false, licenseNoteOnl
1540
1536
  }
1541
1537
  } else {
1542
1538
  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).';
1543
- atcbL.setAttribute('style', 'none !important');
1539
+ atcbL.setAttribute('style', 'display:none !important');
1540
+ atcbL.classList.add('atcb-attribution');
1544
1541
  host.append(atcbL);
1545
1542
  }
1546
1543
  if (returnEl) return null;
@@ -2217,7 +2214,7 @@ function atcb_subscribe_ical(data, fileUrl) {
2217
2214
  function atcb_subscribe_google(data, fileUrl) {
2218
2215
  const baseUrl = 'https://calendar.google.com/calendar/r?cid=';
2219
2216
  const baseUrlApp = 'calendar.google.com/calendar?cid=';
2220
- const fileUrlRegex = /^(https?:\/\/|webcal:\/\/|\/\/)calendar\.google\.com\//;
2217
+ const fileUrlRegex = /^(?:https?:\/\/|webcal:\/\/|\/\/)calendar\.google\.com\//;
2221
2218
  const newFileUrl = (function () {
2222
2219
  if (fileUrlRegex.test(fileUrl)) {
2223
2220
  return fileUrl.replace(/^(.)*\?cid=/, '');
@@ -2252,7 +2249,7 @@ function atcb_generate_google(data, date, subEvent = 'all') {
2252
2249
  urlParts.push('https://calendar.google.com/calendar/render?action=TEMPLATE');
2253
2250
  const formattedDate = atcb_generate_time(date, 'clean', 'google');
2254
2251
  urlParts.push('dates=' + encodeURIComponent(formattedDate.start) + '%2F' + encodeURIComponent(formattedDate.end));
2255
- 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) {
2252
+ 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) {
2256
2253
  urlParts.push('ctz=' + date.timeZone);
2257
2254
  }
2258
2255
  if (date.name && date.name !== '') {
@@ -2403,7 +2400,6 @@ function atcb_open_cal_url(data, type, url, subscribe = false, subEvent = null,
2403
2400
  return;
2404
2401
  }
2405
2402
  }
2406
- // eslint-disable-next-line security/detect-non-literal-fs-filename
2407
2403
  const newTab = window.open(url, target);
2408
2404
  if (newTab) {
2409
2405
  newTab.focus();
@@ -2625,7 +2621,7 @@ function atcb_generate_time(data, style = 'delimiters', targetCal = 'general', a
2625
2621
  }
2626
2622
  return durationHours + ':' + ('0' + durationMinutes).slice(-2);
2627
2623
  })();
2628
- 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))) {
2624
+ 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))) {
2629
2625
  return {
2630
2626
  start: atcb_format_datetime(newStartDate, 'clean', true, true),
2631
2627
  end: atcb_format_datetime(newEndDate, 'clean', true, true),
@@ -2947,7 +2943,7 @@ function atcb_secure_url(url, throwError = true) {
2947
2943
  }
2948
2944
  }
2949
2945
  function atcb_validEmail(email) {
2950
- if (!/^.{0,70}@.{1,30}\.[a-zA-Z]{2,9}$/.test(email)) {
2946
+ if (!/^.{0,70}@.{1,30}\.[a-z]{2,9}$/i.test(email)) {
2951
2947
  return false;
2952
2948
  }
2953
2949
  return true;
@@ -2965,9 +2961,9 @@ function atcb_rewrite_html_elements(content, clear = false, iCalBreaks = false)
2965
2961
  content = content.replace(/\{url\}(.+?)\{\/url\}/gi, (match, p1) => {
2966
2962
  return p1.split('|')[0];
2967
2963
  });
2968
- content = content.replace(/\[(|\/)(hr|p|b|strong|u|i|em|li|ul|ol|h\d)\]/gi, '');
2969
- content = content.replace(/\{(|\/)(hr|p|b|strong|u|i|em|li|ul|ol|h\d)\}/gi, '');
2970
- content = content.replace(/&[#a-zA-Z0-9]{1,9};/gi, '');
2964
+ content = content.replace(/\[\/?(hr|[pbui]|strong|em|li|ul|ol|h\d)\]/gi, '');
2965
+ content = content.replace(/\{\/?(hr|[pbui]|strong|em|li|ul|ol|h\d)\}/gi, '');
2966
+ content = content.replace(/&[#a-z0-9]{1,9};/gi, '');
2971
2967
  } else {
2972
2968
  content = content.replace(/\[url\]((?:(?!\[\/url\]).)*)\[\/url\]/gi, function (match, p1) {
2973
2969
  return atcb_parse_url_code(p1);
@@ -2975,8 +2971,8 @@ function atcb_rewrite_html_elements(content, clear = false, iCalBreaks = false)
2975
2971
  content = content.replace(/\{url\}((?:(?!\[\/url\]).)*)\{\/url\}/gi, function (match, p1) {
2976
2972
  return atcb_parse_url_code(p1);
2977
2973
  });
2978
- content = content.replace(/\[(\/|)(br|hr|p|b|strong|u|i|em|li|ul|ol|h\d)(\s?\/?)\]/gi, '<$1$2$3>');
2979
- content = content.replace(/\{(\/|)(br|hr|p|b|strong|u|i|em|li|ul|ol|h\d)(\s?\/?)\}/gi, '<$1$2$3>');
2974
+ content = content.replace(/\[(\/)?(br|hr|[pbui]|strong|em|li|ul|ol|h\d)(\s?\/?)\]/gi, '<$1$2$3>');
2975
+ content = content.replace(/\{(\/)?(br|hr|[pbui]|strong|em|li|ul|ol|h\d)(\s?\/?)\}/gi, '<$1$2$3>');
2980
2976
  }
2981
2977
  return content;
2982
2978
  }
@@ -4186,7 +4182,7 @@ if (atcbIsBrowser()) {
4186
4182
  this.data.identifier = this.identifier;
4187
4183
  } else {
4188
4184
  if (this.data.identifier && this.data.identifier !== '') {
4189
- if (!/^[\w\-_]+$/.test(this.data.identifier)) {
4185
+ if (!/^[\w-]+$/.test(this.data.identifier)) {
4190
4186
  this.data.identifier = '';
4191
4187
  if (this.debug) {
4192
4188
  let prefix = 'Add to Calendar Button';
@@ -4384,7 +4380,7 @@ async function atcb_load_css(host, rootObj = null, data) {
4384
4380
  const cssGlobalContent = document.createElement('style');
4385
4381
  cssGlobalContent.id = 'atcb-global-style';
4386
4382
  const scrollBarWidth = window.innerWidth - document.documentElement.clientWidth;
4387
- cssGlobalContent.innerText = '.atcb-modal-no-scroll{overflow-y:hidden !important;-webkit-overflow-scrolling:touch;} body.atcb-modal-no-scroll{padding-right:' + scrollBarWidth + 'px;}';
4383
+ 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;}';
4388
4384
  if (nonceVal) {
4389
4385
  cssGlobalContent.setAttribute('nonce', nonceVal);
4390
4386
  }
@@ -4533,7 +4529,7 @@ async function atcb_action(inputData, triggerElement, keyboardTrigger = false) {
4533
4529
  if (triggerElement.id && triggerElement.id !== '') {
4534
4530
  data.identifier = triggerElement.id;
4535
4531
  } else {
4536
- if (data.identifier && data.identifier != '' && /^[\w\-_]+$/.test(data.identifier)) {
4532
+ if (data.identifier && data.identifier != '' && /^[\w-]+$/.test(data.identifier)) {
4537
4533
  data.identifier = 'atcb-btn-' + data.identifier;
4538
4534
  } else {
4539
4535
  data.identifier = 'atcb-btn-custom';