15 lines
641 B
JavaScript
15 lines
641 B
JavaScript
// Calendar shortcode: on Android, the calendar links add the date in Google Calendar instead of
|
|
// downloading the .ics file, because the Google Calendar app there can't open .ics files.
|
|
{
|
|
const isAndroid =
|
|
navigator.userAgentData?.platform === 'Android' || /\bAndroid\b/i.test(navigator.userAgent);
|
|
|
|
if (isAndroid) {
|
|
for (const link of document.querySelectorAll('a.tour-calendar[data-google-href]')) {
|
|
link.href = link.dataset.googleHref;
|
|
link.removeAttribute('download');
|
|
link.title = link.dataset.googleTitle;
|
|
link.querySelector('.visually-hidden').textContent = link.dataset.googleLabel;
|
|
}
|
|
}
|
|
}
|