PageSourceSearch

https://agricarb.com/etc.clientlibs/wnt/designs/clientlibs/custome…nsights.dbf3e05123b7f4c73256abf806f98df0.js

js agricarb.com collected 2026-10-08 09:24:55 UTC 2,749 bytes, 71 lines download raw bytes

1document.addEventListener("d365mkt-beforeformload", function () {});
2document.addEventListener("d365mkt-formrender", function () {});
3document.addEventListener("d365mkt-formsubmit", function () {});
4
5document.addEventListener("d365mkt-afterformload", function () {
6    const setValue = (logicalName, value) => {
7        const el =
8            document.querySelector(`[name="${logicalName}"]`) ||
9            document.getElementById(logicalName);
10        if (!el) return;
11        el.value = value ?? "";
12        el.dispatchEvent(new Event("input", { bubbles: true }));
13        el.dispatchEvent(new Event("change", { bubbles: true }));
14    };
15
16    const params = new URLSearchParams(window.location.search);
17    setValue("pg_referrerurl", document.referrer);
18    setValue("pg_utmsource", params.get("utm_source"));
19    setValue("pg_utmcampaign", params.get("utm_campaign"));
20    setValue("pg_utmmedium", params.get("utm_medium"));
21    setValue("pg_utmcontent", params.get("utm_content"));
22    setValue("pg_utmterm", params.get("utm_term"));
23
24    document.querySelectorAll("[data-form-id]").forEach((container) => {
25    const subtopicPre = container.getAttribute("data-subtopic");
26    if (subtopicPre) setValue("pg_subtopic", subtopicPre);
27  });
28
29    const MULTI_NAME = "documentdownload";
30    const TARGET_NAME = "pg_subtopic";
31    const MAXLEN = 100;
32
33    const computeSubtopic = () => {
34        const boxes = document.querySelectorAll(`input[name="${MULTI_NAME}"]:checked`);
35        const labels = Array.from(boxes).map(cb => {
36            return (cb.getAttribute("title") || cb.value || "").trim();
37        }).filter(Boolean);
38        const unique = labels.filter((v, i, a) => a.indexOf(v) === i);
39        return unique.join(", ").slice(0, MAXLEN);
40    };
41
42    const setSubtopicCombined = (extra) => {
43        const combined = [subtopicPre, extra].filter(s => s && String(s).trim()).join(", ");
44        setValue(TARGET_NAME, combined || "");
45    };
46
47    const bindMultiChange = () => {
48        const boxes = document.querySelectorAll(`input[name="${MULTI_NAME}"]`);
49        if (!boxes.length) return false;
50
51        boxes.forEach(cb => {
52            if (cb.__subtopicBound) return;
53            cb.__subtopicBound = true;
54            cb.addEventListener("change", () => {
55                setSubtopicCombined(computeSubtopic());
56            });
57        });
58
59        setSubtopicCombined(computeSubtopic());
60        return true;
61    };
62
63    if (!bindMultiChange()) {
64        const mo = new MutationObserver(bindMultiChange);
65        mo.observe(document.documentElement, { childList: true, subtree: true });
66    }
67});
68
69document.addEventListener("d365mkt-afterformsubmit", function (event) {
70    if (!event.detail || !event.detail.successful) return;
71});

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.