FEATURE intropducing the file

This commit is contained in:
Antoine M 2025-06-10 15:00:56 +02:00
parent 5d86737b30
commit 219ebd65a4

View File

@ -0,0 +1,30 @@
export default function singleRevue() {
const isSingleRevue = document.querySelector(
'.page--single-revue'
);
if (!isSingleRevue) return;
const socialsButtons = isSingleRevue.querySelectorAll(
'.socials-buttons__button'
);
// socialsButtons.forEach((button) => {
// button.addEventListener('click', () => {
// alert('clicked');
// });
// });
const shareButton = isSingleRevue.querySelector(
'.socials-buttons__button--share'
);
shareButton.addEventListener('click', () => {
const url = window.location.href;
const title = document.title;
const text = 'Check out this article: ' + url;
const shareUrl =
'https://www.facebook.com/sharer/sharer.php?u=' +
encodeURIComponent(url);
// window.open(shareUrl, '_blank');
console.log(url, title, text, shareUrl);
});
}