1/* Check for disable-clipbboard parameter to be passed in */ 2var _disable_clipboard_tst = $('[data-clipboard]').first().attr('data-clipboard'); 3var _disable_clipboard = ( 4 (_disable_clipboard_tst === undefined) || 5 (_disable_clipboard_tst === "") 6 ) ? 7 false : (_disable_clipboard_tst.toLowerCase() == 'true'); 8/* console.log("_disable_clipboard: " + _disable_clipboard); */ 9var __unique_identifier = 164; 10 11 12jQuery(document).ready(function ($) { 13 //Only add copy to clipboard support if enabled 14 if (_disable_clipboard !== true) { 15 // for each codeblock, add a button to the bottom and mark both codeblock and button with a unique identifier 16 $("table.highlighttable").each(function () { 17 wrapCodeBlock($(this)); 18 }); 19 } 20 21 function wrapCodeBlock(codeBlock) { 22 console.log("located a codeblock"); 23 var this_id = "copy_" + __unique_identifier; 24 codeBlock.find("td.code").children("div.highlight").attr('id', this_id); 25 codeBlock.wrap('<div class="code-toolbar"></div>'); 26 codeBlock.after('<div class="toolbar"><div class="toolbar-item"><button class="btn" data-clipboard-action="copy" data-clipboard-target="#' + this_id + '">Copy</button></div></div>'); 27 __unique_identifier += 38; 28 } 29 30}); 31 32 33// Clipboard.js initiator 34var clipboard = new ClipboardJS('.btn'); 35 36clipboard.on('success', function (e) { 37 console.log(e); 38 $(e.trigger).text("Copied!"); 39 e.clearSelection(); 40 setTimeout(function () { 41 $(e.trigger).text("Copy"); 42 }, 2500); 43}); 44 45clipboard.on('error', function (e) { 46 $(e.trigger).text("Not Supported"); 47 setTimeout(function () { 48 $(e.trigger).text("Copy"); 49 }, 2500); 50});
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.