PageSourceSearch

https://moderndive.com/libs/gitbook-2.6.7/js/plugin-clipboard.js

js moderndive.com collected 2026-09-24 10:04:18 UTC 1,113 bytes, 33 lines download raw bytes

1gitbook.require(["gitbook", "jQuery"], function(gitbook, $) {
2
3  var copyButton = '<button type="button" class="copy-to-clipboard-button" title="Copy to clipboard" aria-label="Copy to clipboard"><i class="fa fa-copy"></i></button>';
4  var clipboard;
5
6  gitbook.events.bind("page.change", function() {
7
8    if (!ClipboardJS.isSupported()) return;
9
10    // the page.change event is thrown twice: before and after the page changes
11    if (clipboard) {
12      // clipboard is already defined but we are on the same page
13      if (clipboard._prevPage === window.location.pathname) return;
14      // clipboard is already defined and url path change
15      // we can deduct that we are before page changes
16      clipboard.destroy(); // destroy the previous events listeners
17      clipboard = undefined; // reset the clipboard object
18      return;
19    }
20
21    $(copyButton).prependTo("div.sourceCode");
22
23    clipboard = new ClipboardJS(".copy-to-clipboard-button", {
24      text: function(trigger) {
25        return trigger.parentNode.textContent;
26      }
27    });
28
29    clipboard._prevPage = window.location.pathname
30
31  });
32
33});

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.