diff options
| author | Danilo M. <danix@danix.xyz> | 2026-04-22 12:42:56 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-04-22 12:42:56 +0200 |
| commit | 631547a75142326a7c71bdf123e1475217a5ad73 (patch) | |
| tree | f3cfef6b3c5b42bf626fc823ddcf63b8dcf4cdbb /assets/js/share-sidebar.js | |
| parent | 77ccbe72fad5a4870185fff374f75471c16a9043 (diff) | |
| download | danixxyz-theme-631547a75142326a7c71bdf123e1475217a5ad73.tar.gz danixxyz-theme-631547a75142326a7c71bdf123e1475217a5ad73.zip | |
chore: replace with extracted danix.xyz-hacker theme (danix2-hugo-theme)
Diffstat (limited to 'assets/js/share-sidebar.js')
| -rw-r--r-- | assets/js/share-sidebar.js | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/assets/js/share-sidebar.js b/assets/js/share-sidebar.js deleted file mode 100644 index 81e5f6c..0000000 --- a/assets/js/share-sidebar.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * share-sidebar.js - * Social sharing sidebar with copy-to-clipboard - */ - -export function initShareSidebar() { - 'use strict'; - - const sidebar = document.getElementById('share-sidebar'); - const copyBtn = document.getElementById('share-copy'); - - if (!sidebar) return; - - // Share button handlers - const shareBtns = sidebar.querySelectorAll('.share-btn[data-platform]'); - shareBtns.forEach((btn) => { - btn.addEventListener('click', () => { - const platform = btn.getAttribute('data-platform'); - const url = sidebar.getAttribute('data-url'); - const title = sidebar.getAttribute('data-title'); - - const shareUrls = { - whatsapp: `https://wa.me/?text=${encodeURIComponent(title + ' ' + url)}`, - telegram: `https://t.me/share/url?url=${encodeURIComponent(url)}&text=${encodeURIComponent(title)}`, - linkedin: `https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(url)}`, - twitter: `https://twitter.com/intent/tweet?url=${encodeURIComponent(url)}&text=${encodeURIComponent(title)}`, - facebook: `https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(url)}`, - reddit: `https://reddit.com/submit?url=${encodeURIComponent(url)}&title=${encodeURIComponent(title)}`, - email: `mailto:?subject=${encodeURIComponent(title)}&body=${encodeURIComponent(url)}`, - }; - - if (shareUrls[platform]) { - window.open(shareUrls[platform], '_blank'); - } - }); - }); - - // Copy to clipboard - if (copyBtn) { - copyBtn.addEventListener('click', () => { - const url = sidebar.getAttribute('data-url'); - navigator.clipboard.writeText(url).then(() => { - const originalText = copyBtn.innerHTML; - copyBtn.innerHTML = '✓'; - setTimeout(() => { - copyBtn.innerHTML = originalText; - }, 2000); - }); - }); - } -} |
