PageSourceSearch

https://incode.com/js/behaviors/product-cta.js

js incode.com collected 2026-10-02 03:55:48 UTC 1,982 bytes, 56 lines download raw bytes

1(function() {
2    if (window.__b_productCta) return;
3    window.__b_productCta = true;
4    function init() {
5        var reduceMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
6        var ctafx = document.querySelector("[data-pr-ctafx]");
7        var card = ctafx && ctafx.querySelector(".pr-cta__card");
8        if (!ctafx || !card || reduceMotion) return;
9        var ticking = false;
10        function measure() {
11            var t = 0;
12            var l = 0;
13            var el = card;
14            while (el && el !== ctafx) {
15                t += el.offsetTop;
16                l += el.offsetLeft;
17                el = el.offsetParent;
18            }
19            ctafx.style.setProperty("--pr-cta-t", t + "px");
20            ctafx.style.setProperty("--pr-cta-l", l + "px");
21            ctafx.style.setProperty("--pr-cta-r", ctafx.clientWidth - l - card.offsetWidth + "px");
22            ctafx.style.setProperty("--pr-cta-b", ctafx.clientHeight - t - card.offsetHeight + "px");
23        }
24        function update() {
25            ticking = false;
26            var rect = ctafx.getBoundingClientRect();
27            var vh = window.innerHeight;
28            var p = (vh - rect.top) / (vh * .7);
29            p = Math.max(0, Math.min(1, p));
30            p = p * p * (3 - 2 * p);
31            ctafx.style.setProperty("--pr-ctap", p.toFixed(3));
32        }
33        measure();
34        update();
35        ctafx.classList.add("is-ctafx");
36        window.addEventListener("scroll", function() {
37            if (!ticking) {
38                ticking = true;
39                window.requestAnimationFrame(update);
40            }
41        }, {
42            passive: true
43        });
44        window.addEventListener("resize", function() {
45            measure();
46            update();
47        }, {
48            passive: true
49        });
50    }
51    if (document.readyState === "loading") {
52        document.addEventListener("DOMContentLoaded", init);
53    } else {
54        init();
55    }
56})();

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.