PageSourceSearch

https://eepymep.netlify.app/js/command-copy.js

js eepymep.netlify.app collected 2026-10-03 10:41:10 UTC 1,427 bytes, 45 lines download raw bytes

1/**
2 * command-copy.js — Click-to-copy functionality for command cards
3 * ──────────────────────────────────────────────────────────────
4 * Adds click event to command cards that copies the command text
5 * to clipboard and shows visual feedback.
6 */
7
8(function() {
9  'use strict';
10
11  // Wait for DOM to be ready
12  if (document.readyState === 'loading') {
13    document.addEventListener('DOMContentLoaded', init);
14  } else {
15    init();
16  }
17
18  function init() {
19    const commandCards = document.querySelectorAll('.command-card');
20    
21    commandCards.forEach(card => {
22      card.addEventListener('click', async function() {
23        const commandName = this.querySelector('.command-name');
24        if (!commandName) return;
25        
26        const commandText = commandName.textContent.trim();
27        
28        try {
29          // Copy to clipboard
30          await navigator.clipboard.writeText(commandText);
31          
32          // Visual feedback
33          this.classList.add('copied');
34          
35          // Remove feedback after 2 seconds
36          setTimeout(() => {
37            this.classList.remove('copied');
38          }, 2000);
39        } catch (err) {
40          console.error('Failed to copy command:', err);
41        }
42      });
43    });
44  }
45})();

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.