1import { t } from './data.js'; 2 3/** Native share ([data-native-share], removed without support) + copy-link with feedback. */ 4export default function init() { 5 const btns = document.querySelectorAll('[data-native-share]'); 6 if (navigator.share) { 7 btns.forEach((b) => b.addEventListener('click', () => { 8 navigator.share({ title: document.title, url: b.dataset.nativeShare || location.href }).catch(() => {}); 9 })); 10 } else { 11 btns.forEach((b) => b.remove()); 12 } 13 document.querySelectorAll('[data-copy-link]').forEach((b) => b.addEventListener('click', async () => { 14 try { 15 await navigator.clipboard.writeText(b.dataset.copyLink || location.href); 16 const label = b.querySelector('[data-copy-label]'); 17 if (label) { const old = label.textContent; label.textContent = t('copied', 'Link copied â'); setTimeout(() => { label.textContent = old; }, 1800); } 18 } catch { /* clipboard blocked */ } 19 })); 20}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.