PageSourceSearch

https://eciks.org/wp-content/plugins/generateperf/js/social-share.js?ver=3.1.2

js eciks.org collected 2026-09-24 20:34:09 UTC 3,929 bytes, 87 lines download raw bytes

1class generateperfSocialShare {
2    constructor() {
3        this.touchEvent = 'click';
4        this.shareUrls = this.generateShareUrls();
5        this.initEventListeners();
6    }
7
8    generateShareUrls() {
9        return {
10            twitter: `https://x.com/intent/tweet?url=${generateperf_social_share.url}&text=${generateperf_social_share.title}`,
11            x: `https://x.com/intent/tweet?url=${generateperf_social_share.url}&text=${generateperf_social_share.title}`,
12            facebook: `https://www.facebook.com/sharer.php?u=${generateperf_social_share.url}&quote=${generateperf_social_share.title}`,
13            flipboard: `https://share.flipboard.com/bookmarklet/popout?v=2&t=${new Date().getTime()}&url=${generateperf_social_share.url}&title=${generateperf_social_share.title}&utm_campaign=widgets&utm_medium=web&utm_source=profile_badge`,
14            linkedin: `https://www.linkedin.com/shareArticle?url=${generateperf_social_share.url}&title=${generateperf_social_share.title}`,
15            pinterest: `https://www.pinterest.fr/pin/create/button/?url=${generateperf_social_share.url}&description=${generateperf_social_share.title}&media=${generateperf_social_share.image}`,
16            whatsapp: `https://wa.me/?text=${generateperf_social_share.title}%20:%20${generateperf_social_share.url}`,
17            telegram: `https://t.me/share/url?url=${generateperf_social_share.url}&text=${generateperf_social_share.title}`,
18            snapchat: `https://snapchat.com/scan?attachmentUrl=${generateperf_social_share.url}`,
19            reddit: `http://www.reddit.com/submit?url=${generateperf_social_share.url}&title=${generateperf_social_share.title}`,
20            ninegag: `https://9gag.com/submit?url=${generateperf_social_share.image}`,
21            threads: `barcelona://create?text=${generateperf_social_share.title} ${generateperf_social_share.url}`,
22        };
23    }
24
25    initEventListeners() {
26        document.addEventListener(this.touchEvent, this.handleShareDelegated.bind(this), { passive: true });
27    }
28
29    handleShareDelegated(e) {
30        const el = e.target.closest("[data-share-url]");
31        if (!el) return;
32
33        const service = el.dataset.shareUrl;
34        let url = this.shareUrls[service];
35
36        if (service === "native") {
37            this.handleNativeShare(el);
38        } else if (service === "copy-link") {
39            this.handleCopyLink(el);
40        } else if (url) {
41            window.open(url, "_blank").focus();
42        }
43    }
44
45    handleShareClick(e) {
46        const service = e.currentTarget.dataset.shareUrl;
47        let url = this.shareUrls[service];
48
49        if (service === "native") {
50            this.handleNativeShare(e.currentTarget);
51        } else if (service === "copy-link") {
52            this.handleCopyLink(e.currentTarget);
53        } else if (url) {
54            window.open(url, "_blank").focus();
55        }
56    }
57
58    handleNativeShare(element) {
59        if (navigator.share) {
60            navigator.share({
61                title: generateperf_social_share.title,
62                url: generateperf_social_share.url,
63            });
64        } else {
65            window.requestAnimationFrame(() => {
66                const zone = document.querySelector('.social-share');
67                if (!zone) return;
68                const clone = zone.cloneNode(true);
69                Overlay.open(clone.outerHTML);
70            });
71        }
72    }
73
74    handleCopyLink(element) {
75        if (!element.dataset.orig) element.dataset.orig = encodeURI(element.innerHTML);
76        window.requestAnimationFrame(() => {
77            element.innerHTML = generateperf_social_share.copied;
78        });
79
80        navigator.clipboard.writeText(decodeURIComponent(generateperf_social_share.url));
81        setTimeout(() => { element.innerHTML = decodeURI(element.dataset.orig); }, 1500);
82    }
83}
84
85document.addEventListener("DOMContentLoaded", function() {
86    new generateperfSocialShare();
87});

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.