add-to-calendar-button 1.7.4 → 1.7.5

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.
@@ -3,7 +3,7 @@
3
3
  * Add-to-Calendar Button
4
4
  * ++++++++++++++++++++++
5
5
  *
6
- * Version: 1.7.4
6
+ * Version: 1.7.5
7
7
  * Creator: Jens Kuerschner (https://jenskuerschner.de)
8
8
  * Project: https://github.com/jekuer/add-to-calendar-button
9
9
  * License: MIT with “Commons Clause” License Condition v1.0
@@ -3,7 +3,7 @@
3
3
  * Add-to-Calendar Button
4
4
  * ++++++++++++++++++++++
5
5
  */
6
- const atcbVersion = '1.7.4';
6
+ const atcbVersion = '1.7.5';
7
7
  /* Creator: Jens Kuerschner (https://jenskuerschner.de)
8
8
  * Project: https://github.com/jekuer/add-to-calendar-button
9
9
  * License: MIT with “Commons Clause” License Condition v1.0
@@ -35,13 +35,13 @@ function atcb_init() {
35
35
  // get their JSON content first
36
36
  if (schema && schema.innerHTML) {
37
37
  // get schema.org event markup and flatten the event block
38
- atcbConfig = JSON.parse(schema.innerHTML.replace(/(\r\n|\n|\r)/gm, "")); // we also remove any real code line breaks from the JSON before parsing it. Use <br> or \n explicitely in the description to create a line break
38
+ atcbConfig = JSON.parse(schema.innerHTML.replace(/(\r\n|\n|\r)/gm, "").replace(/(<(?!br)([^>]+)>)/gi, "")); // remove real code line breaks before parsing. Use <br> or \n explicitely in the description to create a line break. Also strip HTML tags (especially since stupid Safari adds stuff).
39
39
  atcbConfig = atcb_parse_schema_json(atcbConfig);
40
40
  // set flag to not delete HTML content later
41
41
  atcbConfig['deleteJSON'] = false;
42
42
  } else {
43
43
  // get JSON from HTML block
44
- atcbConfig = JSON.parse(atcButtons[i].innerHTML.replace(/(\r\n|\n|\r)/gm, "")); // we also remove any real code line breaks from the JSON before parsing it. Use <br> or \n explicitely in the description to create a line break
44
+ atcbConfig = JSON.parse(atcButtons[i].innerHTML.replace(/(\r\n|\n|\r)/gm, "").replace(/(<(?!br)([^>]+)>)/gi, "")); // remove real code line breaks before parsing. Use <br> or \n explicitely in the description to create a line break. Also strip HTML tags (especially since stupid Safari adds stuff).
45
45
  // set flag to delete HTML content later
46
46
  atcbConfig['deleteJSON'] = true;
47
47
  }
@@ -3,7 +3,7 @@
3
3
  * Add-to-Calendar Button
4
4
  * ++++++++++++++++++++++
5
5
  */
6
- const atcbVersion = '1.7.4';
6
+ const atcbVersion = '1.7.5';
7
7
  /* Creator: Jens Kuerschner (https://jenskuerschner.de)
8
8
  * Project: https://github.com/jekuer/add-to-calendar-button
9
9
  * License: MIT with “Commons Clause” License Condition v1.0
@@ -35,13 +35,13 @@ function atcb_init() {
35
35
  // get their JSON content first
36
36
  if (schema && schema.innerHTML) {
37
37
  // get schema.org event markup and flatten the event block
38
- atcbConfig = JSON.parse(schema.innerHTML.replace(/(\r\n|\n|\r)/gm, "")); // we also remove any real code line breaks from the JSON before parsing it. Use <br> or \n explicitely in the description to create a line break
38
+ atcbConfig = JSON.parse(schema.innerHTML.replace(/(\r\n|\n|\r)/gm, "").replace(/(<(?!br)([^>]+)>)/gi, "")); // remove real code line breaks before parsing. Use <br> or \n explicitely in the description to create a line break. Also strip HTML tags (especially since stupid Safari adds stuff).
39
39
  atcbConfig = atcb_parse_schema_json(atcbConfig);
40
40
  // set flag to not delete HTML content later
41
41
  atcbConfig['deleteJSON'] = false;
42
42
  } else {
43
43
  // get JSON from HTML block
44
- atcbConfig = JSON.parse(atcButtons[i].innerHTML.replace(/(\r\n|\n|\r)/gm, "")); // we also remove any real code line breaks from the JSON before parsing it. Use <br> or \n explicitely in the description to create a line break
44
+ atcbConfig = JSON.parse(atcButtons[i].innerHTML.replace(/(\r\n|\n|\r)/gm, "").replace(/(<(?!br)([^>]+)>)/gi, "")); // remove real code line breaks before parsing. Use <br> or \n explicitely in the description to create a line break. Also strip HTML tags (especially since stupid Safari adds stuff).
45
45
  // set flag to delete HTML content later
46
46
  atcbConfig['deleteJSON'] = true;
47
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "add-to-calendar-button",
3
- "version": "1.7.4",
3
+ "version": "1.7.5",
4
4
  "description": "A convenient JavaScript snippet, which lets you create beautiful buttons, where people can add events to their calendars.",
5
5
  "main": "npm_dist/cjs/index.js",
6
6
  "module": "npm_dist/mjs/index.js",