diff --git a/.prettierignore b/.prettierignore index a98186eb..dcb1b59d 100644 --- a/.prettierignore +++ b/.prettierignore @@ -6,3 +6,6 @@ # Ignore minified files *.min.* + +# Ignore dist folders +**/dist diff --git a/CHANGELOG.md b/CHANGELOG.md index a3dce14d..e7e2f1c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Version 2 +- v2.1 : Romanian language support and a bunch of fixes - v2.0 : "all" new version 2 - now a universally usable web component, working basically plug and play at almost all frontend stacks - more customization (hide/show all parts individually) and easy styling (no longer necessary to include the css file manually) diff --git a/Gruntfile.js b/Gruntfile.js index fe41a86f..825a935b 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -158,10 +158,7 @@ module.exports = function (grunt) { }, '.eslintrc.json commonJS': { 'dist/commonjs/.eslintrc.json': function (fs, fd, done) { - fs.writeSync( - fd, - '{ "extends": "../../.eslintrc.json", "env": { "node": true }, "plugins": ["commonjs"] }' - ); + fs.writeSync(fd, '{ "extends": "../../.eslintrc.json", "env": { "node": true }, "plugins": ["commonjs"] }'); done(); }, }, diff --git a/assets/css/atcb-3d.css b/assets/css/atcb-3d.css index ed4fbee7..4cdef430 100644 --- a/assets/css/atcb-3d.css +++ b/assets/css/atcb-3d.css @@ -5,7 +5,7 @@ * * Style: 3D * - * Version: 2.1.0 + * Version: 2.1.1 * Creator: Jens Kuerschner (https://jenskuerschner.de) * Project: https://github.com/add2cal/add-to-calendar-button * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt) diff --git a/assets/css/atcb-date.css b/assets/css/atcb-date.css index 24f57355..ecb38cfb 100644 --- a/assets/css/atcb-date.css +++ b/assets/css/atcb-date.css @@ -5,7 +5,7 @@ * * Style: Date * - * Version: 2.1.0 + * Version: 2.1.1 * Creator: Jens Kuerschner (https://jenskuerschner.de) * Project: https://github.com/add2cal/add-to-calendar-button * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt) diff --git a/assets/css/atcb-flat.css b/assets/css/atcb-flat.css index 0c8c3a10..9ba357f9 100644 --- a/assets/css/atcb-flat.css +++ b/assets/css/atcb-flat.css @@ -5,7 +5,7 @@ * * Style: Flat * - * Version: 2.1.0 + * Version: 2.1.1 * Creator: Jens Kuerschner (https://jenskuerschner.de) * Project: https://github.com/add2cal/add-to-calendar-button * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt) diff --git a/assets/css/atcb-neumorphism.css b/assets/css/atcb-neumorphism.css index e3c8af0e..35cce7b0 100644 --- a/assets/css/atcb-neumorphism.css +++ b/assets/css/atcb-neumorphism.css @@ -5,7 +5,7 @@ * * Style: Neumorphism * - * Version: 2.1.0 + * Version: 2.1.1 * Creator: Jens Kuerschner (https://jenskuerschner.de) * Project: https://github.com/add2cal/add-to-calendar-button * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt) diff --git a/assets/css/atcb-round.css b/assets/css/atcb-round.css index b1c231b3..a1819066 100644 --- a/assets/css/atcb-round.css +++ b/assets/css/atcb-round.css @@ -5,7 +5,7 @@ * * Style: Round * - * Version: 2.1.0 + * Version: 2.1.1 * Creator: Jens Kuerschner (https://jenskuerschner.de) * Project: https://github.com/add2cal/add-to-calendar-button * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt) diff --git a/assets/css/atcb-text.css b/assets/css/atcb-text.css index f5a23c99..7b0d32f3 100644 --- a/assets/css/atcb-text.css +++ b/assets/css/atcb-text.css @@ -5,7 +5,7 @@ * * Style: Text * - * Version: 2.1.0 + * Version: 2.1.1 * Creator: Jens Kuerschner (https://jenskuerschner.de) * Project: https://github.com/add2cal/add-to-calendar-button * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt) diff --git a/assets/css/atcb.css b/assets/css/atcb.css index 80168d2c..149704e5 100644 --- a/assets/css/atcb.css +++ b/assets/css/atcb.css @@ -5,7 +5,7 @@ * * Style: Default * - * Version: 2.1.0 + * Version: 2.1.1 * Creator: Jens Kuerschner (https://jenskuerschner.de) * Project: https://github.com/add2cal/add-to-calendar-button * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt) diff --git a/demo/package-lock.json b/demo/package-lock.json index 17dfc08b..3dfd1fd7 100644 --- a/demo/package-lock.json +++ b/demo/package-lock.json @@ -52,7 +52,7 @@ } }, "..": { - "version": "2.1.0", + "version": "2.1.1", "license": "ELv2", "dependencies": { "timezones-ical-library": "^1.6.0" diff --git a/demo/public/atcb.css b/demo/public/atcb.css index 6c47ae72..64f7df6a 100644 --- a/demo/public/atcb.css +++ b/demo/public/atcb.css @@ -5,7 +5,7 @@ * * Style: Default * - * Version: 2.1.0 + * Version: 2.1.1 * Creator: Jens Kuerschner (https://jenskuerschner.de) * Project: https://github.com/add2cal/add-to-calendar-button * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt) diff --git a/demo/src/components/FooterArea.vue b/demo/src/components/FooterArea.vue index 5337a299..87113ffc 100644 --- a/demo/src/components/FooterArea.vue +++ b/demo/src/components/FooterArea.vue @@ -47,7 +47,7 @@ const { t, locale } = useI18n();
© {{new Date().getFullYear()}} - , Current Version: 2.1.0 + , Current Version: 2.1.1
diff --git a/demo/src/views/AdvancedUseView.vue b/demo/src/views/AdvancedUseView.vue index acad0afb..2ea188f4 100644 --- a/demo/src/views/AdvancedUseView.vue +++ b/demo/src/views/AdvancedUseView.vue @@ -635,6 +635,7 @@ onUnmounted(() => { This might help you to track any user interaction more precisely.

Mind that this ID needs to be unique and may not be used at any other element!

+

It behaves a little different, if you are using the custom atcb_action function, where the script might take the triggering element's id first, before falling back to the described scheme.

@@ -646,6 +647,7 @@ onUnmounted(() => { Dies kann bspw. für Tracking-Funktionalitäten auf deiner Webseite hilfreich sein.

Beachte, dass der Wert eindeutig sein muss und für kein weiteres Element genutzt werden darf!

+

Bei Nutzung der atcb_action Funktion verhält es sich minimal anders. Das Skript nutzt das genannte Schema nur, wenn das auslösende Element keine ID besitzt.

diff --git a/demo/src/views/ConfigView.vue b/demo/src/views/ConfigView.vue index 2920d4b6..f6fe973e 100644 --- a/demo/src/views/ConfigView.vue +++ b/demo/src/views/ConfigView.vue @@ -76,12 +76,16 @@ const { t, locale } = useI18n(); Array of options to use in the list.

You can also override the label per option here. Simply add a pipe between the option name and your label (e.g. "Google|My custom Google Label").
- If you only specify 1 calendar type, the button would show the calendar's icon instead of the default one and redirect directly instead of opening a list (singleton case). + If you only specify 1 calendar type, the button would show the calendar's icon instead of the default one and redirect directly instead of opening a list (singleton case).
+ Some options might be dynamically excluded based on other settings!
+ "iCal" will be replaced by "Apple" on iOS devices. Array an Kalender-Arten, die in der Liste erscheinen.

Du kannst das Label jeweils direkt überschreiben. Füge hierzu ein Pipe-Symbol nach dem Kalender-Namen, gefolgt von deinem Label-Text ein (bspw. "Google|Mein Google-Label").
- Sofern du nur 1 Option definierst wird der Button das Icon dieser Option anzeigen sowie direkt die jeweilige Kalender-Aktion auslösen und keine Auswahlliste öffnen (Singleton-Case). + Sofern du nur 1 Option definierst wird der Button das Icon dieser Option anzeigen sowie direkt die jeweilige Kalender-Aktion auslösen und keine Auswahlliste öffnen (Singleton-Case).
+ Optionen können deaktiviert werden, wenn sie aufgrund anderere Einstellungen nicht unterstützt werden!
+ Auf iOS-Geräten wird die iCal-Option durch "Apple" ersetzt. diff --git a/package-lock.json b/package-lock.json index 04e268f9..0ff2f67e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "add-to-calendar-button", - "version": "2.1.0", + "version": "2.1.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "add-to-calendar-button", - "version": "2.1.0", + "version": "2.1.1", "license": "ELv2", "dependencies": { "timezones-ical-library": "^1.6.0" diff --git a/package.json b/package.json index 9c73aee4..35ec8fcd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "add-to-calendar-button", - "version": "2.1.0", + "version": "2.1.1", "engines": { "node": ">=16.18.1", "npm": ">=8.19.2" diff --git a/set-release.js b/set-release.js index 4d5e38c9..b11ebd25 100644 --- a/set-release.js +++ b/set-release.js @@ -5,4 +5,6 @@ const arg = process.argv[2] || 'patch'; execSync('npx grunt version::' + arg, { stdio: [0, 1, 2] }); execSync('npm install', { stdio: [0, 1, 2] }); -execSync('npm run build:all', { stdio: [0, 1, 2] }); +execSync('npm run build', { stdio: [0, 1, 2] }); +execSync('cd demo', { stdio: [0, 1, 2] }); +execSync('npm install', { stdio: [0, 1, 2] }); diff --git a/src/atcb-control.js b/src/atcb-control.js index df440d32..83ed3c7d 100644 --- a/src/atcb-control.js +++ b/src/atcb-control.js @@ -3,7 +3,7 @@ * Add to Calendar Button * ++++++++++++++++++++++ * - * Version: 2.1.0 + * Version: 2.1.1 * Creator: Jens Kuerschner (https://jenskuerschner.de) * Project: https://github.com/add2cal/add-to-calendar-button * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt) diff --git a/src/atcb-decorate.js b/src/atcb-decorate.js index 0fa1abf6..4b28fb87 100644 --- a/src/atcb-decorate.js +++ b/src/atcb-decorate.js @@ -3,7 +3,7 @@ * Add to Calendar Button * ++++++++++++++++++++++ * - * Version: 2.1.0 + * Version: 2.1.1 * Creator: Jens Kuerschner (https://jenskuerschner.de) * Project: https://github.com/add2cal/add-to-calendar-button * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt) @@ -110,13 +110,11 @@ function atcb_decorate_data_rrule(data) { // cleanup options, standardizing names and splitting off custom labels function atcb_decorate_data_options(data) { - // for iOS, we force the Apple option (if it is not there, but iCal is) - if (isiOS() && data.options.includes('ical') && !data.options.includes('apple')) { - data.options.push('apple'); - } - // next, iterrate over the options and generate the new clean arrays (for options and labels) + // iterrate over the options and generate the new clean arrays (for options and labels) const newOptions = []; data.optionLabels = []; + let iCalGiven = false; + let appleGiven = false; for (let i = 0; i < data.options.length; i++) { // preparing the input options and labels const cleanOption = data.options[`${i}`].split('|'); @@ -127,6 +125,12 @@ function atcb_decorate_data_options(data) { } return ''; })(); + if (optionName === 'apple') { + appleGiven = true; + } + if (optionName === 'ical') { + iCalGiven = true; + } // next, fill the new arrays (where the labels array already sits inside the main data object) // do not consider options, which should not appear on iOS (e.g. iCal, since we have the Apple option instead) // in the recurrence case, we leave out all options, which do not support it in general, as well as Apple and iCal for rrules with "until" @@ -141,6 +145,10 @@ function atcb_decorate_data_options(data) { newOptions.push(optionName); data.optionLabels.push(optionLabel); } + // for iOS, we force the Apple option (if it is not there, but iCal was) + if (isiOS() && iCalGiven && !appleGiven) { + newOptions.push('apple'); + } // last but not least, override the options at the main data object data.options = newOptions; return data; diff --git a/src/atcb-event.js b/src/atcb-event.js index 8a56c45c..2984b1b2 100644 --- a/src/atcb-event.js +++ b/src/atcb-event.js @@ -3,7 +3,7 @@ * Add to Calendar Button * ++++++++++++++++++++++ * - * Version: 2.1.0 + * Version: 2.1.1 * Creator: Jens Kuerschner (https://jenskuerschner.de) * Project: https://github.com/add2cal/add-to-calendar-button * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt) diff --git a/src/atcb-generate-rich-data.js b/src/atcb-generate-rich-data.js index 874e565c..640d33bc 100644 --- a/src/atcb-generate-rich-data.js +++ b/src/atcb-generate-rich-data.js @@ -3,7 +3,7 @@ * Add to Calendar Button * ++++++++++++++++++++++ * - * Version: 2.1.0 + * Version: 2.1.1 * Creator: Jens Kuerschner (https://jenskuerschner.de) * Project: https://github.com/add2cal/add-to-calendar-button * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt) diff --git a/src/atcb-generate.js b/src/atcb-generate.js index d107c155..29733d89 100644 --- a/src/atcb-generate.js +++ b/src/atcb-generate.js @@ -3,7 +3,7 @@ * Add to Calendar Button * ++++++++++++++++++++++ * - * Version: 2.1.0 + * Version: 2.1.1 * Creator: Jens Kuerschner (https://jenskuerschner.de) * Project: https://github.com/add2cal/add-to-calendar-button * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt) diff --git a/src/atcb-globals.js b/src/atcb-globals.js index 9168ca1f..bb07300c 100644 --- a/src/atcb-globals.js +++ b/src/atcb-globals.js @@ -5,14 +5,14 @@ * Add to Calendar Button * ++++++++++++++++++++++ * - * Version: 2.1.0 + * Version: 2.1.1 * Creator: Jens Kuerschner (https://jenskuerschner.de) * Project: https://github.com/add2cal/add-to-calendar-button * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt) * Note: DO NOT REMOVE THE COPYRIGHT NOTICE ABOVE! * */ -const atcbVersion = '2.1.0'; +const atcbVersion = '2.1.1'; // DEFINING CSS const atcbCssTemplate = {}; diff --git a/src/atcb-i18n.js b/src/atcb-i18n.js index a1700769..dd03e2cb 100644 --- a/src/atcb-i18n.js +++ b/src/atcb-i18n.js @@ -3,7 +3,7 @@ * Add to Calendar Button * ++++++++++++++++++++++ * - * Version: 2.1.0 + * Version: 2.1.1 * Creator: Jens Kuerschner (https://jenskuerschner.de) * Project: https://github.com/add2cal/add-to-calendar-button * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt) diff --git a/src/atcb-init.js b/src/atcb-init.js index 5764b13c..af7b4a6c 100644 --- a/src/atcb-init.js +++ b/src/atcb-init.js @@ -3,7 +3,7 @@ * Add to Calendar Button * ++++++++++++++++++++++ * - * Version: 2.1.0 + * Version: 2.1.1 * Creator: Jens Kuerschner (https://jenskuerschner.de) * Project: https://github.com/add2cal/add-to-calendar-button * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt) @@ -417,12 +417,10 @@ function atcb_action(data, triggerElement, keyboardTrigger = false) { data.identifier = triggerElement.id; } else { // however, if the trigger has no id, we set it with the identifier or a default fallback - if (data.identifier != null && data.identifier != '') { - if (!/^[\w\-_]+$/.test(data.identifier)) { - data.identifier = 'atcb-btn-custom'; - } else { - data.identifier = 'atcb-btn-' + data.identifier; - } + if (data.identifier != null && data.identifier != '' && /^[\w\-_]+$/.test(data.identifier)) { + data.identifier = 'atcb-btn-' + data.identifier; + } else { + data.identifier = 'atcb-btn-custom'; } triggerElement.id = data.identifier; } diff --git a/src/atcb-links.js b/src/atcb-links.js index de6d41f7..bb5b0981 100644 --- a/src/atcb-links.js +++ b/src/atcb-links.js @@ -3,7 +3,7 @@ * Add to Calendar Button * ++++++++++++++++++++++ * - * Version: 2.1.0 + * Version: 2.1.1 * Creator: Jens Kuerschner (https://jenskuerschner.de) * Project: https://github.com/add2cal/add-to-calendar-button * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt) diff --git a/src/atcb-util.js b/src/atcb-util.js index c74aa8a8..43ab0861 100644 --- a/src/atcb-util.js +++ b/src/atcb-util.js @@ -3,7 +3,7 @@ * Add to Calendar Button * ++++++++++++++++++++++ * - * Version: 2.1.0 + * Version: 2.1.1 * Creator: Jens Kuerschner (https://jenskuerschner.de) * Project: https://github.com/add2cal/add-to-calendar-button * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt) diff --git a/src/atcb-validate.js b/src/atcb-validate.js index b070b1be..241e8a0b 100644 --- a/src/atcb-validate.js +++ b/src/atcb-validate.js @@ -3,7 +3,7 @@ * Add to Calendar Button * ++++++++++++++++++++++ * - * Version: 2.1.0 + * Version: 2.1.1 * Creator: Jens Kuerschner (https://jenskuerschner.de) * Project: https://github.com/add2cal/add-to-calendar-button * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)