1document.addEventListener("DOMContentLoaded", function(copyFull) { 2 if (document.querySelector('.wp-block-brc-click-to-copy')) { 3 //copys inner html of target div. 4 //event button 5 var copyBtn = $('.click-to-copy__btn'); 6 copyBtn.on('click', function(event) { 7 var $this = $(this); 8 //find the element that has the text you want. 9 var content = $this.prev('.click-to-copy__content'); 10 //creates new range object and sets text as boundaries. 11 var range = document.createRange(); 12 range.selectNode(content[0]); 13 window.getSelection().addRange(range); 14 document.getElementsByTagName('div').item(0); 15 range = document.createRange(); 16 referenceNode = document.getElementsByTagName("div")[0]; 17 range.selectNodeContents(referenceNode); 18 try { 19 // Now that we've selected the text, execute the copy command 20 var successful = document.execCommand('copy'); 21 /*var msg = successful ? 'successful' : 'unsuccessful'; 22 console.log('Copy email command was ' + msg);*/ 23 //handle success 24 $(this).after('<span class="click-to-copy__btn--success">Copied!</span>'); 25 setTimeout(function() { 26 $('.click-to-copy__btn--success').addClass('show'); 27 setTimeout(function() { 28 $('.click-to-copy__btn--success').fadeOut(function() { 29 $('.click-to-copy__btn--success').remove(); 30 }); 31 }, 2000); 32 }, 0); 33 } catch (err) { 34 //console.log('Oops, unable to copy'); 35 } 36 //clear out range for next event. 37 window.getSelection().removeAllRanges(); 38 }); 39 }; 40});
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.