1function initClipboard() { 2 if (window._clipboard) { 3 window._clipboard.destroy(); 4 } 5 6 window._clipboard = new ClipboardJS(".btn-copy", { 7 text: function (trigger) { 8 return trigger.getAttribute("data-clipboard-text"); 9 }, 10 }); 11 12 // Show tooltip feedback 13 window._clipboard.on("success", function (e) { 14 const el = $(e.trigger); 15 16 // Change tooltip text to "Copied!" 17 el.attr("data-original-title", "Copied!").tooltip("show"); 18 19 // Revert back to original tooltip 20 setTimeout(function () { 21 el.attr("data-original-title", "Click to copy"); 22 }, 1500); 23 24 e.clearSelection(); 25 }); 26 27 window._clipboard.on("error", function (e) { 28 const el = $(e.trigger); 29 el.attr("data-original-title", "Failed").tooltip("show"); 30 setTimeout(function () { 31 el.attr("data-original-title", "Click to copy"); 32 }, 1500); 33 }); 34 35 // Initialize Bootstrap tooltips 36 $(".btn-copy").tooltip(); 37} 38 39$(document).on("ready turbolinks:load", initClipboard); 40$(document).on("ajax:complete", initClipboard);
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.