PageSourceSearch

https://aidarwinawards.org/js/actions.js

js aidarwinawards.org collected 2026-09-25 20:30:31 UTC 1,721 bytes, 56 lines download raw bytes

1document.addEventListener('DOMContentLoaded', function () {
2  // Delegate for share buttons
3  document.body.addEventListener('click', function (e) {
4    const shareBtn = e.target.closest('.share-button');
5    if (shareBtn) {
6      const url = shareBtn.getAttribute('data-share-url') || window.location.href;
7      
8      // Track share button click with Umami
9      if (typeof umami !== 'undefined') {
10        // Extract nominee name from URL for better tracking
11        const nomineeMatch = url.match(/nominees\/([^.]+)\.html/);
12        const nomineeName = nomineeMatch ? nomineeMatch[1] : 'unknown';
13        
14        umami.track('share-nominee', { 
15          nominee: nomineeName,
16          url: url,
17          page: window.location.pathname
18        });
19      }
20      
21      copyToClipboard(url);
22      showToast('Link copied to clipboard!');
23      e.preventDefault();
24    }
25    const openBtn = e.target.closest('.open-new-window-button, .comment-button');
26    if (openBtn) {
27      const url = openBtn.getAttribute('data-open-url');
28      if (url) window.open(url, '_blank', 'noopener');
29      e.preventDefault();
30    }
31  });
32});
33
34function copyToClipboard(text) {
35  if (navigator.clipboard) {
36    navigator.clipboard.writeText(text);
37  } else {
38    // fallback
39    const textarea = document.createElement('textarea');
40    textarea.value = text;
41    document.body.appendChild(textarea);
42    textarea.select();
43    document.execCommand('copy');
44    document.body.removeChild(textarea);
45  }
46}
47
48function showToast(message) {
49  const toast = document.getElementById('toast');
50  if (!toast) return;
51  toast.textContent = message;
52  toast.style.opacity = '1';
53  setTimeout(() => {
54    toast.style.opacity = '0';
55  }, 1800);
56}

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.