PageSourceSearch

https://brain-beats.in/blog/js/main.js

js brain-beats.in collected 2026-10-09 22:09:43 UTC 690 bytes, 25 lines download raw bytes

1
2// assets/js/post.js
3var codeBlocks = document.querySelectorAll('pre.highlight');
4
5codeBlocks.forEach(function (codeBlock) {
6  var copyButton = document.createElement('button');
7  copyButton.className = 'copy';
8  copyButton.type = 'button';
9  copyButton.ariaLabel = 'Copy code to clipboard';
10  copyButton.innerText = 'Copy';
11
12  codeBlock.append(copyButton);
13
14  copyButton.addEventListener('click', function () {
15    var code = codeBlock.querySelector('code').innerText.trim();
16    window.navigator.clipboard.writeText(code);
17
18    copyButton.innerText = 'Copied';
19    var fourSeconds = 4000;
20
21    setTimeout(function () {
22      copyButton.innerText = 'Copy';
23    }, fourSeconds);
24  });
25});

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.