PageSourceSearch

https://www.thenibble.com/inc/readmore.js

js thenibble.com collected 2026-10-02 07:34:31 UTC 1,554 bytes, 44 lines download raw bytes

1function addLink() {
2    //Get the selected text and append the extra info
3    var selection = window.getSelection(),
4        pagelink = '<br /><br /> Read more at: ' + document.location.href,
5        copytext = selection + pagelink,
6        newdiv = document.createElement('div');
7
8    //hide the newly created container
9    newdiv.style.position = 'absolute';
10    newdiv.style.left = '-99999px';
11
12    //insert the container, fill it with the extended text, and define the new selection
13    document.body.appendChild(newdiv);
14    newdiv.innerHTML = copytext;
15    selection.selectAllChildren(newdiv);
16
17    window.setTimeout(function () {
18        document.body.removeChild(newdiv);
19    }, 100);
20}
21
22document.addEventListener('copy', addLink);
23
24
25// Function to check page height and hide a div
26function hideDivIfLongPage() {
27    // Get the height of the entire document
28    const pageHeight = document.documentElement.scrollHeight;
29    
30    // Select the div you want to hide. Replace 'yourDivId' with the actual ID of your div.
31    const divToHide = document.getElementById('MoreItems');
32
33    // Check if the div exists and if the page height is greater than 2600 pixels
34 if (pageHeight <= 2600) {
35        // Hide the div by setting its display style to 'none'
36        divToHide.style.visibility = 'visible';
37    }
38}
39
40// Call the function when the page loads
41window.onload = hideDivIfLongPage;
42
43// Optional: Call the function on window resize in case the page height changes
44window.onresize = hideDivIfLongPage;

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.