31 lines
878 B
JavaScript
31 lines
878 B
JavaScript
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);
|
|
});
|
|
}
|