Turn calendar download link into an icon, vendor font awesome for that.
This commit is contained in:
parent
281a987904
commit
01054e1419
2895 changed files with 3114 additions and 16 deletions
15
assets/js/calendar.js
Normal file
15
assets/js/calendar.js
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue