PageSourceSearch

https://www.incode.com/js/behaviors/share-buttons.js

js incode.com collected 2026-10-02 03:55:50 UTC 1,840 bytes, 40 lines download raw bytes

1(function() {
2    "use strict";
3    if (window.__b_share_buttons) return;
4    window.__b_share_buttons = true;
5    function init() {
6        document.querySelectorAll("[data-share-buttons]").forEach(function(root) {
7            var encoded = encodeURIComponent(window.location.href);
8            var encodedTitle = encodeURIComponent(root.getAttribute("data-share-title") || document.title);
9            var hrefs = {
10                linkedin: "https://www.linkedin.com/sharing/share-offsite/?url=" + encoded,
11                x: "https://twitter.com/intent/tweet?url=" + encoded + "&text=" + encodedTitle,
12                facebook: "https://www.facebook.com/sharer/sharer.php?u=" + encoded
13            };
14            root.querySelectorAll("[data-share]").forEach(function(a) {
15                var key = a.getAttribute("data-share");
16                if (hrefs[key]) a.setAttribute("href", hrefs[key]);
17            });
18            var copy = root.querySelector("[data-share-copy]");
19            if (!copy) return;
20            var timer = null;
21            copy.addEventListener("click", function() {
22                if (!navigator.clipboard) return;
23                navigator.clipboard.writeText(window.location.href).then(function() {
24                    copy.classList.add("is-copied");
25                    copy.setAttribute("aria-label", "Link copied");
26                    if (timer) clearTimeout(timer);
27                    timer = setTimeout(function() {
28                        copy.classList.remove("is-copied");
29                        copy.setAttribute("aria-label", "Copy link");
30                    }, 1800);
31                }).catch(function() {});
32            });
33        });
34    }
35    if (document.readyState === "loading") {
36        document.addEventListener("DOMContentLoaded", init);
37    } else {
38        init();
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.