Max
July 30, 2024, 12:40pm
1
Hi again!
The thing is that Google Sites platform is built on iframes that’s why the Invite Via Email doesn’t work correctly.
To make it work, please use the code below in the Custom JS section on the Settings tab:
const SHARE_LINK = "https://4261f0250a2f46f3b5236328e2abc809.elf.site";
document.addEventListener("click", (event) => {
const mail = event.target.closest(".eapp-events-calendar-share-email-button");
if (mail) {
event.preventDefault();
event.stopPropagation();
const decodedMail = decodeURIComponent(mail.href);
const link = decodedMail.replace(/(Event Link:)[^#]*/g, `$1${SHARE_LINK}`);
window.open(link, "_blank");
}
});
Do not forget to replace the share link in the 1st line of the code with the share link of your widget.
Here is how you can get it:
Check it out and let me know if it worked
Thank you Max
Could you please have a look to my js section, I received error message when I validate
1 Like
Max
July 30, 2024, 2:27pm
3
I guess you’ve copied the 1st line by mistake:
I’ve removed it and the code has been successfully validated
Max
July 30, 2024, 2:47pm
6
Thank you so much for the feedback
Great idea, I’ve made this topic public so that other users could find this solution too!
Max, is there a solution to get the event description fully opened in order to read all the text?
As you can see on the picture, when the event raises there is a “see more”. I would appreciate not having it and better to see the entire text.
Maybe another CSS code?
1 Like
Max
July 30, 2024, 4:08pm
8
Sure! This code should do the trick:
.global-styles, .eapp-events-calendar-read-more-button {
display: none;
}
.global-styles, .eapp-events-calendar-read-more-content {
max-height: none !important;
}
.global-styles, .eapp-events-calendar-read-more-content:after {
display: none !important;
}
Try it out and let me know how it worked
Sorry to disturb you again.
Max, I think there is a little adjustment to do, the solution for inviting via email is working fine but the “copy link” not working. I think the link should be the same as the one inside “Invite by email”.
Can we have the same link in both buttons?
Thanks.
Michel
1 Like
Working fine “see more”
“Copy the link” close to “send via email” not working
1 Like
Max
July 30, 2024, 4:46pm
11
Your request is in the hands of our devs. I’ll update you tomorrow
Max
July 31, 2024, 12:48pm
12
Thank you for waiting!
We’ve adjusted the code, so you should get the same link from Copy and Invite via Email buttons:
const SHARE_LINK = "https://4261f0250a2f46f3b5236328e2abc809.elf.site";
const mailBtnSelector = ".eapp-events-calendar-share-email-button";
document.addEventListener("click", (event) => {
const mailLink = event.target?.closest(mailBtnSelector);
const copyLink = event.target?.closest(".eapp-events-calendar-share-link-button");
if (!mailLink && !copyLink) {
return;
}
event.preventDefault();
event.stopPropagation();
const mail = mailLink ?? copyLink.closest('.eapp-events-calendar-share-content')?.querySelector(mailBtnSelector);
const decodedMail = decodeURIComponent(mail?.href || '');
if (mailLink) {
const link = decodedMail.replace(/(Event Link:)[^#]*/g, `$1${SHARE_LINK}`);
window.open(link, "_blank");
return;
}
if (copyLink) {
const linkMatch = decodedMail.match(/Event Link:\s*(\S+)/);
const eventLink = linkMatch ? linkMatch[1].replace(/[^#]*/, SHARE_LINK) : '';
const copyLinkText = copyLink.querySelector('.eapp-events-calendar-share-link-copied');
const COPIED_SHOW_SELECTOR = 'eapp-events-calendar-share-link-show';
const tmp = document.createElement('textarea');
tmp.value = eventLink;
tmp.style.position = 'absolute';
tmp.style.left = '-9999px';
document.body.append(tmp);
tmp.select();
document.execCommand('copy');
copyLinkText?.classList?.add(COPIED_SHOW_SELECTOR);
setTimeout(() => copyLinkText?.classList?.remove(COPIED_SHOW_SELECTOR), 2000);
tmp.remove();
}
}, true);
Check your website and let me know if everything is fine now
Hi Max,
Should I replace the other code by this one or to add this new code below?
1 Like
I have replaced it and it’s working perfectly now. Please congratulate the dev team for me.
Thank you again.
Michel
2 Likes
Max
July 31, 2024, 2:36pm
15
Happy to hear that you are good now!
If anything else comes up, don’t hesitate to drop us a line. We’ll be happy to help