PageSourceSearch

https://minoko.com.ua/catalog/view/javascript/salesdrive.js

js minoko.com.ua collected 2026-10-07 19:41:50 UTC 6,976 bytes, 176 lines download raw bytes

1(function () {
2    function getCookie(name) {
3        var matches = document.cookie.match(new RegExp(
4            "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, "\\$1") + "=([^;]*)"
5        ))
6        return matches ? decodeURIComponent(matches[1]) : undefined
7    }
8
9    function setCookie(name, value, props) {
10        props = props || {}
11        var exp = props.expires
12        if (typeof exp == "number" && exp) {
13            var d = new Date()
14            d.setTime(d.getTime() + exp * 1000 * 86400)
15            exp = props.expires = d
16        }
17        if (exp && exp.toUTCString) {
18            props.expires = exp.toUTCString()
19        }
20
21        value = decodeURIComponent(value)
22        var updatedCookie = name + "=" + value
23        for (var propName in props) {
24            updatedCookie += "; " + propName
25            var propValue = props[propName]
26            if (propValue !== true) {
27                updatedCookie += "=" + propValue
28            }
29        }
30        document.cookie = updatedCookie
31    }
32
33    function parseURL(url) {
34        var a = document.createElement("a");
35        a.href = url;
36        return {
37            source: url,
38            protocol: a.protocol.replace(":", ""),
39            host: a.hostname,
40            port: a.port,
41            query: a.search,
42            params: (function () {
43                var ret = {},
44                    seg = a.search.replace(/^\?/, "").split("&"),
45                    len = seg.length, i = 0, s;
46                for (; i < len; i++) {
47                    if (!seg[i]) {
48                        continue;
49                    }
50                    s = seg[i].split("=");
51                    ret[s[0]] = s[1];
52                }
53                return ret;
54            })(),
55            file: (a.pathname.match(/\/([^\/?#]+)$/i) || [, ""])[1],
56            hash: a.hash.replace("#", ""),
57            path: a.pathname.replace(/^([^\/])/, "/$1"),
58            relative: (a.href.match(/tps?:\/\/[^\/]+(.+)/) || [, ""])[1],
59            segments: a.pathname.replace(/^\//, "").split("/")
60        };
61    }
62
63    function parseGetParams() {
64        var $_GET = {};
65        var __GET = window.location.search.substring(1).split("&");
66        for (var i = 0; i < __GET.length; i++) {
67            var getVar = __GET[i].split("=");
68            $_GET[getVar[0]] = typeof (getVar[1]) == "undefined" ? "" : decodeURIComponent(getVar[1]);
69        }
70
71        return $_GET;
72    }
73
74    function setCookieThisDomain(hostname_arr, i) {
75        var this_domain_tmp = hostname_arr.slice(i).join(".");
76        var cookie_param = {expires: 365, path: "/", domain: "." + this_domain_tmp}
77        setCookie("prodex24cur_domain", this_domain_tmp, cookie_param);
78        var tmp_m = getCookie("prodex24cur_domain");
79        if (typeof (tmp_m) == "undefined") {
80            i--;
81            if (i < 0)
82                return;
83
84            setCookieThisDomain(hostname_arr, i);
85        }
86    }
87
88    var hostname = location.host || location.hostname;
89    var hostname_arr = hostname.split(".");
90    var len = hostname_arr.length - 2;
91    setCookieThisDomain(hostname_arr, len);
92    this_domain = getCookie("prodex24cur_domain");
93    var cookie_param = {expires: 365, path: "/", domain: "." + this_domain};
94
95    var refer = document.referrer || location.referrer;
96
97    var get = parseGetParams();
98    if (typeof (get.utm_expid) != "undefined") {
99        //setCookie("prodex24experiment", get.utm_expid, cookie_param);
100    }
101
102    var myURL = parseURL(refer);
103    myURLhost = myURL.host;
104
105
106    if (typeof (get.utm_source) != "undefined" || typeof (get.utm_medium) != "undefined" || typeof (get.utm_campaign) != "undefined" || typeof (get.utm_content) != "undefined" || typeof (get.utm_term) != "undefined" || typeof (get.yclid) != "undefined" || typeof (get.gclid) != "undefined") {
107        setCookie("prodex24source", get.utm_source || "", cookie_param);
108        if (typeof (get.utm_source) == "undefined") {
109            if (typeof (get.gclid) != "undefined") {
110                setCookie("prodex24source", "google", cookie_param);
111            }
112        }
113
114        setCookie("prodex24medium", get.utm_medium || "", cookie_param);
115        if (typeof (get.utm_medium) == "undefined") {
116            if (typeof (get.yclid) != "undefined") {
117                setCookie("prodex24medium", "cpc", cookie_param);
118            }
119            if (typeof (get.gclid) != "undefined") {
120                setCookie("prodex24medium", "cpc", cookie_param);
121            }
122        }
123        setCookie("prodex24campaign", get.utm_campaign || "", cookie_param);
124        setCookie("prodex24content", get.utm_content || "", cookie_param);
125        setCookie("prodex24term", get.utm_term || "", cookie_param);
126
127        if (refer && myURLhost.indexOf(window.location.hostname) == -1 && window.location.hostname.indexOf(myURLhost) == -1) {
128            setCookie("prodex24source_full", refer || "", cookie_param);
129        }
130    } else if (refer) {
131        if (myURLhost.indexOf(window.location.hostname) == -1 && window.location.hostname.indexOf(myURLhost) == -1) {
132            setCookie("prodex24source_full", refer, cookie_param);
133            var domain = myURL.host.replace(/^www\./i, "");
134            setCookie("prodex24source", domain, cookie_param);
135
136            if (typeof (get.gclid) != "undefined") {
137                setCookie("prodex24medium", "cpc", cookie_param);
138            } else if (/^(((google|search\.yahoo|yandex|bing)(\.[^.]+)+)|(rambler\.ru)|(ukr\.net)|(mail\.ru))$/i.test(domain)) {
139                setCookie("prodex24medium", "organic", cookie_param);
140            } else {
141                setCookie("prodex24medium", "referral", cookie_param);
142            }
143
144            setCookie("prodex24campaign", "", cookie_param);
145            setCookie("prodex24content", "", cookie_param);
146            setCookie("prodex24term", "", cookie_param);
147
148        }
149    }
150
151
152    // if (myURLhost == 'l.facebook.com' || myURLhost == 'm.facebook.com' || myURLhost == 'instagram.com' || myURLhost == 'l.instagram.com') {
153    //
154    //     setCookie("prodex24medium", "referral", cookie_param);
155    //     setCookie("prodex24source", "fb", cookie_param);
156    //     setCookie("prodex24campaign", "120241379323500060", cookie_param);
157    //
158    //
159    //     setCookie("utm_medium", "referral", cookie_param);
160    //     setCookie("utm_source", "fb", cookie_param);
161    //     setCookie("utm_campaign", "120241379323500060", cookie_param);
162    //
163    // }
164    // if (myURLhost.includes('facebook') || myURLhost.includes('instagram')) {
165    //     setCookie("prodex24medium", "referral", cookie_param);
166    //     setCookie("prodex24source", "fb", cookie_param);
167    //     setCookie("prodex24campaign", "120241379323500060", cookie_param);
168    //
169    //
170    //     setCookie("utm_medium", "referral", cookie_param);
171    //     setCookie("utm_source", "fb", cookie_param);
172    //     setCookie("utm_campaign", "120241379323500060", cookie_param);
173    // }
174
175
176})();

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.