1(function (global) { 2 'use strict'; 3 4 var timeoutKey = '__serpclixCopyFeedbackTimeout'; 5 6 function fallbackCopy(text) { 7 var input = document.createElement('textarea'); 8 input.value = text; 9 input.setAttribute('readonly', ''); 10 input.style.position = 'fixed'; 11 input.style.opacity = '0'; 12 document.body.appendChild(input); 13 input.select(); 14 try { document.execCommand('copy'); } catch (e) {} 15 document.body.removeChild(input); 16 } 17 18 function showCopiedState(btn) { 19 if (!btn) return; 20 btn.classList.add('is-copied'); 21 if (btn[timeoutKey]) clearTimeout(btn[timeoutKey]); 22 btn[timeoutKey] = setTimeout(function () { 23 btn.classList.remove('is-copied'); 24 btn[timeoutKey] = null; 25 }, 1200); 26 } 27 28 function copyText(text, btn) { 29 if (!text) return; 30 if (navigator.clipboard && navigator.clipboard.writeText) { 31 navigator.clipboard.writeText(text) 32 .then(function () { showCopiedState(btn); }) 33 .catch(function () { 34 fallbackCopy(text); 35 showCopiedState(btn); 36 }); 37 return; 38 } 39 fallbackCopy(text); 40 showCopiedState(btn); 41 } 42 43 function bind(root) { 44 root = root || document; 45 if (!root || root.__serpclixCopyBound) return; 46 root.__serpclixCopyBound = true; 47 root.addEventListener('click', function (e) { 48 var btn = e.target && e.target.closest ? e.target.closest('.copy-btn[data-copy]') : null; 49 if (!btn) return; 50 e.preventDefault(); 51 e.stopPropagation(); 52 copyText(btn.getAttribute('data-copy') || '', btn); 53 }); 54 } 55 56 global.SerpclixCopyFeedback = { 57 bind: bind, 58 copyText: copyText 59 }; 60})(typeof window !== 'undefined' ? window : this);
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.