Skip to content

Commit c97d3b3

Browse files
committed
fix Teams link, better iCal support (drop base64)
1 parent 1572722 commit c97d3b3

File tree

9 files changed

+20
-16
lines changed

9 files changed

+20
-16
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ The code is available under the [MIT license (with “Commons Clause” License
226226

227227
## Changelog (without bug fixes)
228228

229+
* v1.6 : supporting Microsoft Teams
229230
* v1.5 : update to date format and better accesibility
230231
* v1.4 : schema.org support (also changed some keys in the JSON!)
231232
* v1.3 : new license (MIT with “Commons Clause”)
@@ -237,3 +238,4 @@ The code is available under the [MIT license (with “Commons Clause” License
237238
## Kudos go to
238239
* [github.com/dudewheresmycode](https://github.com/dudewheresmycodee)
239240
* [uxwing.com](https://uxwing.com)
241+
* all contributors!

assets/css/atcb.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Add-to-Calendar Button
44
* ++++++++++++++++++++++
55
*
6-
* Version: 1.5.1
6+
* Version: 1.6.0
77
* Creator: Jens Kuerschner (https://jenskuerschner.de)
88
* Project: https://github.com/jekuer/add-to-calendar-button
99
* License: MIT with “Commons Clause” License Condition v1.0

assets/js/atcb.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Add-to-Calendar Button
44
* ++++++++++++++++++++++
55
*/
6-
const atcbVersion = '1.5.1';
6+
const atcbVersion = '1.6.0';
77
/* Creator: Jens Kuerschner (https://jenskuerschner.de)
88
* Project: https://github.com/jekuer/add-to-calendar-button
99
* License: MIT with “Commons Clause” License Condition v1.0
@@ -501,8 +501,9 @@ function atcb_generate_teams(data) {
501501
let formattedDate = atcb_generate_time(data, 'delimiters', 'microsoft');
502502
url += '&startTime=' + formattedDate['start'] + '&endTime=' + formattedDate['end'];
503503
// add details (if set)
504+
let locationString = '';
504505
if (data['location'] != null && data['location'] != '') {
505-
let locationString = encodeURIComponent(data['location']);
506+
locationString = encodeURIComponent(data['location']);
506507
url += '&location=' + locationString; // workaround putting the location into the description, since the native field is not supported yet
507508
locationString += ' // ';
508509
}
@@ -543,7 +544,7 @@ function atcb_generate_ical(data) {
543544
"END:VEVENT",
544545
"END:VCALENDAR"
545546
];
546-
let dlurl = 'data:text/calendar;base64,'+btoa(ics_lines.join('\r\n').replace(/[\u00A0-\u2666]/g, function(c) { return '&#' + c.charCodeAt(0) + ';'; })); // includes a fix to not throw an error with non-Latin1 characters. However, still needs improvement, since it shows up encoded in the iCal file.
547+
let dlurl = 'data:text/calendar;charset=utf-8,'+encodeURIComponent(ics_lines.join('\r\n'));
547548
try {
548549
if (!window.ActiveXObject) {
549550
let save = document.createElement('a');

assets/js/atcb.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/atcb.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,13 @@
121121
</style>
122122

123123
<!-- load the general button css -->
124-
<link rel="stylesheet" href="./assets/css/atcb.min.css?v=1.5.1">
124+
<link rel="stylesheet" href="./assets/css/atcb.min.css?v=1.6.0">
125125

126126
</head>
127127
<body>
128128
<div class="container">
129129

130-
<h1>Add-to-Calendar Button <span id="tinyVersion">v1.5.1</span></h1>
130+
<h1>Add-to-Calendar Button <span id="tinyVersion">v1.6.0</span></h1>
131131
<h2>A convenient JavaScript snippet, which lets you create beautiful buttons, where people can add events to their calendars.</h2>
132132
<p class="github">
133133
<a target="_blank" href="https://github.com/jekuer/add-to-calendar-button" class="clean">
@@ -149,7 +149,7 @@ <h3>Example 1: The usual One</h3>
149149
<div class="atcb" style="display:none;">
150150
{
151151
"name":"Reminder to check the add-to-calendar-button repo",
152-
"description":"Check out the maybe easiest way to include add-to-calendar-buttons to your website at: [url]https://github.com/jekuer/add-to-calendar-button[/url]",
152+
"description":"Check out the maybe easiest way<br>è<br>Ц<br> to include add-to-calendar-buttons to your website at: [url]https://github.com/jekuer/add-to-calendar-button[/url]",
153153
"startDate":"2022-01-14",
154154
"endDate":"2022-01-18",
155155
"startTime":"10:15",
@@ -515,7 +515,7 @@ <h3>Example 7: Schema.org Event Markup</h3>
515515

516516

517517
<!-- load the button js -->
518-
<script type="application/javascript" src="./assets/js/atcb.min.js?v=1.5.1" defer></script>
518+
<script type="application/javascript" src="./assets/js/atcb.min.js?v=1.6.0" defer></script>
519519

520520

521521
</body>

npm_dist/atcb_npm.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Add-to-Calendar Button
44
* ++++++++++++++++++++++
55
*/
6-
const atcbVersion = '1.5.1';
6+
const atcbVersion = '1.6.0';
77
/* Creator: Jens Kuerschner (https://jenskuerschner.de)
88
* Project: https://github.com/jekuer/add-to-calendar-button
99
* License: MIT with “Commons Clause” License Condition v1.0
@@ -501,8 +501,9 @@ function atcb_generate_teams(data) {
501501
let formattedDate = atcb_generate_time(data, 'delimiters', 'microsoft');
502502
url += '&startTime=' + formattedDate['start'] + '&endTime=' + formattedDate['end'];
503503
// add details (if set)
504+
let locationString = '';
504505
if (data['location'] != null && data['location'] != '') {
505-
let locationString = encodeURIComponent(data['location']);
506+
locationString = encodeURIComponent(data['location']);
506507
url += '&location=' + locationString; // workaround putting the location into the description, since the native field is not supported yet
507508
locationString += ' // ';
508509
}
@@ -543,7 +544,7 @@ function atcb_generate_ical(data) {
543544
"END:VEVENT",
544545
"END:VCALENDAR"
545546
];
546-
let dlurl = 'data:text/calendar;base64,'+btoa(ics_lines.join('\r\n').replace(/[\u00A0-\u2666]/g, function(c) { return '&#' + c.charCodeAt(0) + ';'; })); // includes a fix to not throw an error with non-Latin1 characters. However, still needs improvement, since it shows up encoded in the iCal file.
547+
let dlurl = 'data:text/calendar;charset=utf-8,'+encodeURIComponent(ics_lines.join('\r\n'));
547548
try {
548549
if (!window.ActiveXObject) {
549550
let save = document.createElement('a');

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "add-to-calendar-button",
3-
"version": "1.5.1",
3+
"version": "1.6.0",
44
"description": "A convenient JavaScript snippet, which lets you create beautiful buttons, where people can add events to their calendars.",
55
"main": "npm_dist/atcb_npm.js",
66
"types": "index.d.ts",

0 commit comments

Comments
 (0)