Skip to content

Commit

Permalink
update share message
Browse files Browse the repository at this point in the history
  • Loading branch information
Jadit19 committed Nov 23, 2023
1 parent 47737fd commit e560411
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions _includes/header_custom.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
</script>

<script>
const shareFunction = async () => {
const shareFunction = async heading => {
if (navigator.canShare) {
try {
const text = `Read about ${heading} on Astronomy Club IITK Wiki: ${window.location.href}`
navigator.share({
title: document.title,
url: window.location.href
url: window.location.href,
text: text
})
} catch (err) {
console.error('[ERROR]: ', err)
Expand All @@ -26,7 +28,7 @@
shareElement.classList.add('fa-solid')
shareElement.classList.add('fa-share')
shareElement.classList.add('fa-sm')
shareElement.onclick = shareFunction
shareElement.onclick = () => {}

document.querySelector('h2').appendChild(shareElement)
})
Expand Down

0 comments on commit e560411

Please sign in to comment.