Skip to content

Commit

Permalink
Add more social links
Browse files Browse the repository at this point in the history
  • Loading branch information
corbindavenport committed Aug 11, 2023
1 parent 7a49dff commit 1b8853b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
21 changes: 21 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,20 @@
Mastodon
</button>
</div>
<!-- Facebook -->
<div class="col-12 col-sm-6 col-md-4">
<button type="button" class="btn btn-light w-100 mt-3" id="facebook-share-btn" aria-label="Share">
<i class="bi bi-facebook me-2"></i>
Facebook
</button>
</div>
<!-- LinkedIn -->
<div class="col-12 col-sm-6 col-md-4">
<button type="button" class="btn btn-light w-100 mt-3" id="linkedin-share-btn" aria-label="Share">
<i class="bi bi-linkedin me-2"></i>
LinkedIn
</button>
</div>
<!-- Twitter / X-->
<div class="col-12 col-sm-6 col-md-4">
<button type="button" class="btn btn-light w-100 mt-3" id="x-share-btn" aria-label="Share">
Expand All @@ -186,6 +200,13 @@
Telegram
</button>
</div>
<!-- Substack Notes -->
<div class="col-12 col-sm-6 col-md-4">
<button type="button" class="btn btn-light w-100 mt-3" id="substack-share-btn" aria-label="Share">
<i class="bi bi-bookmark-fill me-2"></i>
Substack Notes
</button>
</div>
</div>
</div>
</div>
Expand Down
18 changes: 18 additions & 0 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,18 @@ document.getElementById('mastodon-share-btn').addEventListener('click', function
}
})

// Facebook button
document.getElementById('facebook-share-btn').addEventListener('click', function () {
var link = 'https://www.facebook.com/sharer.php?u=' + encodeURIComponent(document.getElementById('link-output').value)
window.open(link, '_blank')
})

// LinkedIn button
document.getElementById('linkedin-share-btn').addEventListener('click', function () {
var link = 'https://www.linkedin.com/sharing/share-offsite/?url=' + encodeURIComponent(document.getElementById('link-output').value)
window.open(link, '_blank')
})

// Twitter / X button
document.getElementById('x-share-btn').addEventListener('click', function () {
var link = 'https://twitter.com/intent/tweet?url=' + encodeURIComponent(document.getElementById('link-output').value)
Expand All @@ -163,6 +175,12 @@ document.getElementById('telegram-share-btn').addEventListener('click', function
window.open(link, '_blank')
})

// Substack Notes button
document.getElementById('substack-share-btn').addEventListener('click', function () {
var link = 'https://substack.com/notes?action=compose&message=' + encodeURIComponent(document.getElementById('link-output').value)
window.open(link, '_blank')
})

// Show Shortcut prompt on iOS
if (ifiOS()) {
document.getElementById('apple-shortcut-btn').style.display = 'block'
Expand Down

0 comments on commit 1b8853b

Please sign in to comment.