FEATURE intropducing the file
This commit is contained in:
parent
5d86737b30
commit
219ebd65a4
30
resources/js/single-revue.js
Normal file
30
resources/js/single-revue.js
Normal 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);
|
||||||
|
});
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user