PageSourceSearch

https://www.videojet.com/wp-content/themes/videojet-2023/assets/js/custom.js?ver=1790229887

js videojet.com collected 2026-09-25 18:52:02 UTC 7,090 bytes, 271 lines download raw bytes

1document.addEventListener('DOMContentLoaded', function () {
2    const faq = document.querySelector('#faq-question-1');
3
4    //console.log('FAQ element:', faq);
5
6    if (!faq) {
7        //console.error('#faq-question-1 not found');
8        return;
9    }
10
11    faq.classList.add('faq-q-open');
12    faq.classList.add('faq-arrow-down');
13    faq.classList.remove('faq-arrow-right');
14
15   // console.log('Class added: faq-q-open');
16});
17
18/* ==========================
19   Marketo Tracking
20   ========================== */
21(function () {
22    'use strict';
23
24    if (typeof MktoForms2 === 'undefined') return;
25
26    // ==========================
27    // Country Dial Codes
28    // ==========================
29    const countryDialCodes = {
30        US: '+1',
31        BR: '+55',
32        CL: '+56',
33        AR: '+54',
34        MX: '+52',
35        CN: '+86',
36        IN: '+91',
37        JP: '+81',
38        PK: '+92',
39        SG: '+65',
40        KR: '+82',
41        TH: '+66',
42        VN: '+84',
43        CZ: '+420',
44        FR: '+33',
45        DE: '+49',
46        IE: '+353',
47        IT: '+39',
48        NL: '+31',
49        NO: '+47',
50        PL: '+48',
51        PT: '+351',
52        SK: '+421',
53        ES: '+34',
54        SE: '+46',
55        CH: '+41',
56        TR: '+90',
57        GB: '+44',
58        KE: '+254',
59        AE: '+971',
60        SA: '+966'
61    };
62
63    // ==========================
64    // Videojet Domain Mapping
65    // ==========================
66    function getCountryFromHostname() {
67        // Country code is now passed from server-side via videojetSettings
68        // This avoids using window.location.hostname which triggers VIP security warnings
69        if (typeof videojetSettings !== 'undefined' && videojetSettings.countryCode) {
70            return videojetSettings.countryCode;
71        }
72
73        return '';
74    }
75
76    // ==========================
77    // Country Field Mapping
78    // ==========================
79    function getCountryCode(country) {
80
81        if (!country) return '';
82
83        const c = String(country).trim().toUpperCase();
84
85        const map = {
86            'UNITED STATES': 'US',
87            'USA': 'US',
88            'US': 'US',
89            'BRAZIL': 'BR',
90            'BR': 'BR',
91            'CHILE': 'CL',
92            'CL': 'CL',
93            'ARGENTINA': 'AR',
94            'AR': 'AR',
95            'MEXICO': 'MX',
96            'MX': 'MX',
97            'CHINA': 'CN',
98            'CN': 'CN',
99            'INDIA': 'IN',
100            'IN': 'IN',
101            'JAPAN': 'JP',
102            'JP': 'JP',
103            'PAKISTAN': 'PK',
104            'PK': 'PK',
105            'SINGAPORE': 'SG',
106            'SG': 'SG',
107            'KOREA': 'KR',
108            'SOUTH KOREA': 'KR',
109            'KR': 'KR',
110            'THAILAND': 'TH',
111            'TH': 'TH',
112            'VIETNAM': 'VN',
113            'VN': 'VN',
114            'CZECH REPUBLIC': 'CZ',
115            'CZ': 'CZ',
116            'FRANCE': 'FR',
117            'FR': 'FR',
118            'GERMANY': 'DE',
119            'DE': 'DE',
120            'IRELAND': 'IE',
121            'IE': 'IE',
122            'ITALY': 'IT',
123            'IT': 'IT',
124            'NETHERLANDS': 'NL',
125            'NL': 'NL',
126            'NORWAY': 'NO',
127            'NO': 'NO',
128            'POLAND': 'PL',
129            'PL': 'PL',
130            'PORTUGAL': 'PT',
131            'PT': 'PT',
132            'SLOVAKIA': 'SK',
133            'SK': 'SK',
134            'SPAIN': 'ES',
135            'ES': 'ES',
136            'SWEDEN': 'SE',
137            'SE': 'SE',
138            'SWITZERLAND': 'CH',
139            'CH': 'CH',
140            'TURKEY': 'TR',
141            'TR': 'TR',
142            'UNITED KINGDOM': 'GB',
143            'UK': 'GB',
144            'GB': 'GB',
145            'KENYA': 'KE',
146            'KE': 'KE',
147            'UAE': 'AE',
148            'UNITED ARAB EMIRATES': 'AE',
149            'AE': 'AE',
150            'SAUDI ARABIA': 'SA',
151            'SA': 'SA'
152        };
153
154        return map[c] || c;
155    }
156
157    // ==========================
158    // SHA256
159    // ==========================
160    function hashString(value) {
161        return CryptoJS.SHA256(
162            String(value || '').trim().toLowerCase()
163        ).toString(CryptoJS.enc.Hex);
164    }
165
166    // ==========================
167    // Phone Normalization
168    // ==========================
169    function normalizePhone(phone, countryCode) {
170
171        if (!phone) return '';
172
173        let p = String(phone).trim();
174
175        p = p.replace(/[^\d+]/g, '');
176
177        if (p.startsWith('+')) {
178            return p;
179        }
180
181        const dialCode = countryDialCodes[countryCode];
182
183        if (!dialCode) {
184            return p;
185        }
186
187        if (p.startsWith('0')) {
188            p = p.substring(1);
189        }
190
191        return dialCode + p;
192    }
193
194    // ==========================
195    // Marketo Forms
196    // ==========================
197    MktoForms2.whenReady(function (form) {
198
199        if (form.__videojetTrackingBound) {
200            return;
201        }
202
203        form.__videojetTrackingBound = true;
204
205        form.onSuccess(function (values, followUpUrl) {
206
207            try {
208
209                const fullName =
210                    values.fullname ||
211                    values.FullName ||
212                    values.Name ||
213                    '';
214
215                const nameParts = fullName.trim().split(/\s+/);
216
217                const firstName = nameParts.shift() || '';
218                const lastName = nameParts.join(' ') || '';
219
220                const rawPhone =
221                    values.Phone ||
222                    values.phone ||
223                    values.MobilePhone ||
224                    values.PhoneNumber ||
225                    values.mobile ||
226                    '';
227
228                const countryCode =
229                    getCountryCode(values.Country) ||
230                    getCountryFromHostname();
231
232                const normalizedPhone =
233                    normalizePhone(rawPhone, countryCode);
234
235                window.dataLayer = window.dataLayer || [];
236
237                window.dataLayer.push({
238                    event: 'form_submit',
239                    marketoFormId: form.getId(),
240                    leadsUserData: {
241                        sha256_email_address: hashString(
242                            values.Email || ''
243                        ),
244                        sha256_phone_number: hashString(
245                            normalizedPhone
246                        ),
247                        address: {
248                            sha256_first_name: hashString(firstName),
249                            sha256_last_name: hashString(lastName),
250                            country: countryCode || 'NA'
251                        },
252                        custom_fields: {
253                            reason_for_contact:
254                                values.ReasonforContact || ''
255                        }
256                    }
257                });
258
259            } catch (e) {
260                console.error(
261                    'Videojet Marketo Tracking Error:',
262                    e
263                );
264            }
265
266            // Allow Marketo redirect / thank-you page
267            return true;
268        });
269    });
270
271})();

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.