PageSourceSearch

https://insiderone.com/wp-content/themes/insiderone/assets/js/jotform-forms.js?ver=1790871007

js insiderone.com collected 2026-10-02 04:17:08 UTC 18,703 bytes, 415 lines download raw bytes

1/* Shared Jotform embed. Public metadata only; API keys and delivery stay server-side. */
2(function () {
3    'use strict';
4    const selector = '[data-insider-jotform]';
5    const origin = 'https://form.jotform.com';
6    const newsletterForms = new Set(['262705912100042', '262705847445061', '262706248269061', '262705776019059', '262706002621041']);
7    const eventThemeForms = new Set(["262705785380969", "262705405616960", "262705813117959", "262705163195963", "262705492963062", "262706328039055", "262705871001955", "262706340789061", "262705656291058", "262705406765966", "262705955275971", "262706959015059", "262705752049056", "262707030711043"]);
8    // Forms whose Jotform embed_layout options include gmc-desktop/gmc-compact/gmc-mobile.
9    const gmcDarkForms = new Set(['262573258327059']);
10    const frames = new Map();
11    // Google libphonenumber country calling codes; labels match the Jotform dropdown.
12    const phoneCountries = {
13        "AC": "Ascension Island (+247)",
14        "AD": "Andorra (+376)",
15        "AE": "United Arab Emirates (+971)",
16        "AF": "Afghanistan (+93)",
17        "AG": "Antigua & Barbuda (+1)",
18        "AI": "Anguilla (+1)",
19        "AL": "Albania (+355)",
20        "AM": "Armenia (+374)",
21        "AO": "Angola (+244)",
22        "AR": "Argentina (+54)",
23        "AS": "American Samoa (+1)",
24        "AT": "Austria (+43)",
25        "AU": "Australia (+61)",
26        "AW": "Aruba (+297)",
27        "AX": "Åland Islands (+358)",
28        "AZ": "Azerbaijan (+994)",
29        "BA": "Bosnia & Herzegovina (+387)",
30        "BB": "Barbados (+1)",
31        "BD": "Bangladesh (+880)",
32        "BE": "Belgium (+32)",
33        "BF": "Burkina Faso (+226)",
34        "BG": "Bulgaria (+359)",
35        "BH": "Bahrain (+973)",
36        "BI": "Burundi (+257)",
37        "BJ": "Benin (+229)",
38        "BL": "St. Barthélemy (+590)",
39        "BM": "Bermuda (+1)",
40        "BN": "Brunei (+673)",
41        "BO": "Bolivia (+591)",
42        "BQ": "Caribbean Netherlands (+599)",
43        "BR": "Brazil (+55)",
44        "BS": "Bahamas (+1)",
45        "BT": "Bhutan (+975)",
46        "BW": "Botswana (+267)",
47        "BY": "Belarus (+375)",
48        "BZ": "Belize (+501)",
49        "CA": "Canada (+1)",
50        "CC": "Cocos (Keeling) Islands (+61)",
51        "CD": "Congo - Kinshasa (+243)",
52        "CF": "Central African Republic (+236)",
53        "CG": "Congo - Brazzaville (+242)",
54        "CH": "Switzerland (+41)",
55        "CI": "Côte d’Ivoire (+225)",
56        "CK": "Cook Islands (+682)",
57        "CL": "Chile (+56)",
58        "CM": "Cameroon (+237)",
59        "CN": "China (+86)",
60        "CO": "Colombia (+57)",
61        "CR": "Costa Rica (+506)",
62        "CU": "Cuba (+53)",
63        "CV": "Cape Verde (+238)",
64        "CW": "Curaçao (+599)",
65        "CX": "Christmas Island (+61)",
66        "CY": "Cyprus (+357)",
67        "CZ": "Czechia (+420)",
68        "DE": "Germany (+49)",
69        "DJ": "Djibouti (+253)",
70        "DK": "Denmark (+45)",
71        "DM": "Dominica (+1)",
72        "DO": "Dominican Republic (+1)",
73        "DZ": "Algeria (+213)",
74        "EC": "Ecuador (+593)",
75        "EE": "Estonia (+372)",
76        "EG": "Egypt (+20)",
77        "EH": "Western Sahara (+212)",
78        "ER": "Eritrea (+291)",
79        "ES": "Spain (+34)",
80        "ET": "Ethiopia (+251)",
81        "FI": "Finland (+358)",
82        "FJ": "Fiji (+679)",
83        "FK": "Falkland Islands (+500)",
84        "FM": "Micronesia (+691)",
85        "FO": "Faroe Islands (+298)",
86        "FR": "France (+33)",
87        "GA": "Gabon (+241)",
88        "GB": "United Kingdom (+44)",
89        "GD": "Grenada (+1)",
90        "GE": "Georgia (+995)",
91        "GF": "French Guiana (+594)",
92        "GG": "Guernsey (+44)",
93        "GH": "Ghana (+233)",
94        "GI": "Gibraltar (+350)",
95        "GL": "Greenland (+299)",
96        "GM": "Gambia (+220)",
97        "GN": "Guinea (+224)",
98        "GP": "Guadeloupe (+590)",
99        "GQ": "Equatorial Guinea (+240)",
100        "GR": "Greece (+30)",
101        "GT": "Guatemala (+502)",
102        "GU": "Guam (+1)",
103        "GW": "Guinea-Bissau (+245)",
104        "GY": "Guyana (+592)",
105        "HK": "Hong Kong SAR China (+852)",
106        "HN": "Honduras (+504)",
107        "HR": "Croatia (+385)",
108        "HT": "Haiti (+509)",
109        "HU": "Hungary (+36)",
110        "ID": "Indonesia (+62)",
111        "IE": "Ireland (+353)",
112        "IL": "Israel (+972)",
113        "IM": "Isle of Man (+44)",
114        "IN": "India (+91)",
115        "IO": "British Indian Ocean Territory (+246)",
116        "IQ": "Iraq (+964)",
117        "IR": "Iran (+98)",
118        "IS": "Iceland (+354)",
119        "IT": "Italy (+39)",
120        "JE": "Jersey (+44)",
121        "JM": "Jamaica (+1)",
122        "JO": "Jordan (+962)",
123        "JP": "Japan (+81)",
124        "KE": "Kenya (+254)",
125        "KG": "Kyrgyzstan (+996)",
126        "KH": "Cambodia (+855)",
127        "KI": "Kiribati (+686)",
128        "KM": "Comoros (+269)",
129        "KN": "St. Kitts & Nevis (+1)",
130        "KP": "North Korea (+850)",
131        "KR": "South Korea (+82)",
132        "KW": "Kuwait (+965)",
133        "KY": "Cayman Islands (+1)",
134        "KZ": "Kazakhstan (+7)",
135        "LA": "Laos (+856)",
136        "LB": "Lebanon (+961)",
137        "LC": "St. Lucia (+1)",
138        "LI": "Liechtenstein (+423)",
139        "LK": "Sri Lanka (+94)",
140        "LR": "Liberia (+231)",
141        "LS": "Lesotho (+266)",
142        "LT": "Lithuania (+370)",
143        "LU": "Luxembourg (+352)",
144        "LV": "Latvia (+371)",
145        "LY": "Libya (+218)",
146        "MA": "Morocco (+212)",
147        "MC": "Monaco (+377)",
148        "MD": "Moldova (+373)",
149        "ME": "Montenegro (+382)",
150        "MF": "St. Martin (+590)",
151        "MG": "Madagascar (+261)",
152        "MH": "Marshall Islands (+692)",
153        "MK": "North Macedonia (+389)",
154        "ML": "Mali (+223)",
155        "MM": "Myanmar (Burma) (+95)",
156        "MN": "Mongolia (+976)",
157        "MO": "Macao SAR China (+853)",
158        "MP": "Northern Mariana Islands (+1)",
159        "MQ": "Martinique (+596)",
160        "MR": "Mauritania (+222)",
161        "MS": "Montserrat (+1)",
162        "MT": "Malta (+356)",
163        "MU": "Mauritius (+230)",
164        "MV": "Maldives (+960)",
165        "MW": "Malawi (+265)",
166        "MX": "Mexico (+52)",
167        "MY": "Malaysia (+60)",
168        "MZ": "Mozambique (+258)",
169        "NA": "Namibia (+264)",
170        "NC": "New Caledonia (+687)",
171        "NE": "Niger (+227)",
172        "NF": "Norfolk Island (+672)",
173        "NG": "Nigeria (+234)",
174        "NI": "Nicaragua (+505)",
175        "NL": "Netherlands (+31)",
176        "NO": "Norway (+47)",
177        "NP": "Nepal (+977)",
178        "NR": "Nauru (+674)",
179        "NU": "Niue (+683)",
180        "NZ": "New Zealand (+64)",
181        "OM": "Oman (+968)",
182        "PA": "Panama (+507)",
183        "PE": "Peru (+51)",
184        "PF": "French Polynesia (+689)",
185        "PG": "Papua New Guinea (+675)",
186        "PH": "Philippines (+63)",
187        "PK": "Pakistan (+92)",
188        "PL": "Poland (+48)",
189        "PM": "St. Pierre & Miquelon (+508)",
190        "PR": "Puerto Rico (+1)",
191        "PS": "Palestinian Territories (+970)",
192        "PT": "Portugal (+351)",
193        "PW": "Palau (+680)",
194        "PY": "Paraguay (+595)",
195        "QA": "Qatar (+974)",
196        "RE": "Réunion (+262)",
197        "RO": "Romania (+40)",
198        "RS": "Serbia (+381)",
199        "RU": "Russia (+7)",
200        "RW": "Rwanda (+250)",
201        "SA": "Saudi Arabia (+966)",
202        "SB": "Solomon Islands (+677)",
203        "SC": "Seychelles (+248)",
204        "SD": "Sudan (+249)",
205        "SE": "Sweden (+46)",
206        "SG": "Singapore (+65)",
207        "SH": "St. Helena (+290)",
208        "SI": "Slovenia (+386)",
209        "SJ": "Svalbard & Jan Mayen (+47)",
210        "SK": "Slovakia (+421)",
211        "SL": "Sierra Leone (+232)",
212        "SM": "San Marino (+378)",
213        "SN": "Senegal (+221)",
214        "SO": "Somalia (+252)",
215        "SR": "Suriname (+597)",
216        "SS": "South Sudan (+211)",
217        "ST": "São Tomé & Príncipe (+239)",
218        "SV": "El Salvador (+503)",
219        "SX": "Sint Maarten (+1)",
220        "SY": "Syria (+963)",
221        "SZ": "Eswatini (+268)",
222        "TA": "Tristan da Cunha (+290)",
223        "TC": "Turks & Caicos Islands (+1)",
224        "TD": "Chad (+235)",
225        "TG": "Togo (+228)",
226        "TH": "Thailand (+66)",
227        "TJ": "Tajikistan (+992)",
228        "TK": "Tokelau (+690)",
229        "TL": "Timor-Leste (+670)",
230        "TM": "Turkmenistan (+993)",
231        "TN": "Tunisia (+216)",
232        "TO": "Tonga (+676)",
233        "TR": "Türkiye (+90)",
234        "TT": "Trinidad & Tobago (+1)",
235        "TV": "Tuvalu (+688)",
236        "TW": "Taiwan (+886)",
237        "TZ": "Tanzania (+255)",
238        "UA": "Ukraine (+380)",
239        "UG": "Uganda (+256)",
240        "US": "United States (+1)",
241        "UY": "Uruguay (+598)",
242        "UZ": "Uzbekistan (+998)",
243        "VA": "Vatican City (+39)",
244        "VC": "St. Vincent & Grenadines (+1)",
245        "VE": "Venezuela (+58)",
246        "VG": "British Virgin Islands (+1)",
247        "VI": "U.S. Virgin Islands (+1)",
248        "VN": "Vietnam (+84)",
249        "VU": "Vanuatu (+678)",
250        "WF": "Wallis & Futuna (+681)",
251        "WS": "Samoa (+685)",
252        "XK": "Kosovo (+383)",
253        "YE": "Yemen (+967)",
254        "YT": "Mayotte (+262)",
255        "ZA": "South Africa (+27)",
256        "ZM": "Zambia (+260)",
257        "ZW": "Zimbabwe (+263)"
258    };
259    let countryPromise;
260    let serial = 0;
261
262    function country() {
263        if (!countryPromise) {
264            countryPromise = (async function () {
265                const controller = new AbortController();
266                const timeout = setTimeout(() => controller.abort(), 3500);
267                try {
268                    const response = await fetch('/cdn-cgi/trace', {cache: 'no-store', credentials: 'omit', signal: controller.signal});
269                    const trace = response.ok ? await response.text() : '';
270                    const code = (trace.match(/^loc=([A-Z]{2})\r?$/m) || [])[1] || '';
271                    return ['XX', 'ZZ', 'AA'].includes(code) ? '' : code;
272                } catch (_) {
273                    return ''; // Localhost/non-Cloudflare sites and unknown countries still show the form.
274                } finally {
275                    clearTimeout(timeout);
276                }
277            })();
278        }
279        return countryPromise;
280    }
281
282    async function mount(host) {
283        const id = host.dataset.insiderJotform;
284        if (host.dataset.jotformMounted || !/^\d{15}$/.test(id)) return;
285        host.dataset.jotformMounted = 'true';
286        const query = new URLSearchParams(location.search);
287        const params = new URLSearchParams();
288        ['utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_country', 'utm_lead_source', 'utm_lead_source_medium'].forEach(key => {
289            const value = query.get(key);
290            if (value) params.set(key, value.slice(0, 255));
291        });
292        const pageURL = location.origin + location.pathname;
293        params.set('page_url', pageURL);
294        // The form's own viewport is only the iframe, so pass the website's layout explicitly.
295        let layout = window.innerWidth <= 391 ? 'mobile'
296            : (window.matchMedia('(max-aspect-ratio: 9/7) and (max-width: 767px)').matches ? 'compact' : 'desktop');
297        // Referral's original GMC widget uses one column below 1024px.
298        if (id === '262705946530056') {
299            layout = window.innerWidth < 768 ? 'mobile' : (window.innerWidth < 1024 ? 'compact' : 'desktop');
300        }
301        const footer = host.closest('footer');
302        if (newsletterForms.has(id) && footer && host.closest('.footer-newsletter-form')) {
303            const tone = footer.classList.contains('footer-light') || footer.classList.contains('footer-lunar') ? 'light' : 'dark';
304            const footerLayout = window.innerWidth <= 767 ? 'mobile' : (window.innerWidth <= 1023 ? 'compact' : 'desktop');
305            layout = 'footer-' + tone + '-' + footerLayout;
306        }
307        if (eventThemeForms.has(id) && host.closest('.insiderone-generic-event-hero-banner-container.is-light-mode')) {
308            layout = 'event-light-' + layout;
309        }
310        // Light-styled forms placed in the dark GMC form widget get their dark gmc-* variant.
311        if (gmcDarkForms.has(id) && host.closest('.insiderone-gmc-form')) {
312            layout = 'gmc-' + layout;
313        }
314        params.set('embed_layout', layout);
315        params.set('isIframeEmbed', '1');
316        params.set('parentURL', pageURL);
317        // Mappings saved in Theme Settings also set form_language (their original behaviour). Shipped mappings
318        // leave the hidden form_language field to the value configured on each Jotform form.
319        if (host.dataset.formLanguage) params.set('form_language', host.dataset.formLanguage);
320        // Select the form's Jotform translation for this page.
321        const displayLanguage = (host.dataset.displayLanguage || '').replace(
322            /^([a-z]{2})-([a-z]{2})$/i,
323            (_, language, region) => language.toLowerCase() + '-' + region.toUpperCase()
324        );
325        if (/^[a-z]{2}(?:-[A-Z]{2})?$/.test(displayLanguage)) params.set('language', displayLanguage);
326        // Preserve the existing homepage -> demo email handoff, only for a configured field.
327        let email = '';
328        const emailField = host.dataset.emailPrefillField;
329        if (emailField && /^[a-zA-Z][a-zA-Z0-9_]*$/.test(emailField)) {
330            try { email = sessionStorage.getItem('email') || ''; } catch (_) {}
331            if (email.length <= 254 && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) params.set(emailField, email);
332            else email = '';
333        }
334        // Never use caller-supplied visitor_country or utm_country as IP geolocation.
335        const code = await country();
336        if (code) params.set('visitor_country', code);
337        // Prefill only the country selector. Never prefill a telephone answer with a bare dial code.
338        if (phoneCountries[code]) params.set('phone_country', phoneCountries[code].replace(/\+/g, '{+}')); // Jotform's literal-plus prefill escape.
339        if (!host.isConnected) { delete host.dataset.jotformMounted; return; }
340        const frame = document.createElement('iframe');
341        frame.id = 'InsiderJotform-' + id + '-' + (++serial);
342        frame.title = host.dataset.formTitle || 'Contact form';
343        frame.referrerPolicy = 'strict-origin-when-cross-origin';
344        frame.style.cssText = 'display:block;width:100%;max-width:100%;height:850px;border:0;background:transparent';
345        frame.src = origin + '/' + id + '?' + params.toString();
346        if (email) frame.addEventListener('load', function () {
347            try { if (sessionStorage.getItem('email') === email) sessionStorage.removeItem('email'); } catch (_) {}
348        }, {once: true});
349        frames.set(frame, {host, id, pageURL});
350        host.appendChild(frame);
351    }
352
353    // Jotform's embed message protocol; source checks also isolate repeated instances of the same form.
354    // Do not accept arbitrary script-loading, navigation or CSS instructions from message payloads.
355    window.addEventListener('message', function (event) {
356        // A successful POST moves the iframe from form.jotform.com to submit.jotform.com.
357        const isSubmission = event.data && typeof event.data === 'object' && event.data.action === 'submission-completed';
358        if (event.origin !== origin && !(event.origin === 'https://submit.jotform.com' && isSubmission)) return;
359        for (const [frame, info] of frames) {
360            if (!frame.isConnected) { frames.delete(frame); continue; }
361            if (event.source !== frame.contentWindow) continue;
362            // The thank-you page confirms submission; loading or clicking Submit does not.
363            if (isSubmission) {
364                const submittedForm = event.data.formID || event.data.formId;
365                if (String(submittedForm || '') !== info.id) break;
366                if (!info.submitted) {
367                    info.submitted = true;
368                    info.host.dispatchEvent(new CustomEvent('insider:jotform-submitted', {
369                        bubbles: true,
370                        detail: {formId: info.id, hubspotFormId: info.host.dataset.hubspotForm || ''}
371                    }));
372                }
373                break;
374            }
375            if (typeof event.data === 'string') {
376                const parts = event.data.split(':');
377                if (parts[0] === 'setHeight' || parts[0] === 'setMinHeight') {
378                    const height = Number(parts[1]);
379                    const minimumHeight = newsletterForms.has(info.id) ? 32 : 100;
380                    if (Number.isFinite(height) && height >= minimumHeight && height <= 20000) {
381                        frame.style[parts[0] === 'setHeight' ? 'height' : 'minHeight'] = Math.ceil(height) + 'px';
382                    }
383                } else if (parts[0] === 'scrollIntoView') {
384                    frame.scrollIntoView({block: 'start', behavior: 'smooth'});
385                } else if (parts[0] === 'collapseErrorPage') {
386                    frame.style.height = Math.min(frame.clientHeight, window.innerHeight) + 'px';
387                }
388                // Jotform expects a parent URL response; never forward the whole query or arbitrary referrer.
389                if (['setHeight', 'setMinHeight', 'scrollIntoView', 'getUrls'].includes(parts[0])) {
390                    frame.contentWindow.postMessage(JSON.stringify({type: 'urls', value: {docurl: encodeURIComponent(info.pageURL), referrer: ''}}), origin);
391                }
392            } else if (event.data && event.data.formId === info.id) {
393                const field = {NVA_VALIDATION_ERROR_POSITION: 'validationErrorY', NVA_CAPTCHA_CHALLENGE_POSITION: 'challengeCenterY'}[event.data.type];
394                const y = field && event.data[field];
395                if (typeof y === 'number' && Number.isFinite(y) && y >= 0 && y <= frame.clientHeight) {
396                    window.scrollTo({top: Math.max(0, window.scrollY + frame.getBoundingClientRect().top + y - window.innerHeight / 2), behavior: 'smooth'});
397                }
398            }
399            break;
400        }
401    });
402
403    function scan(root) {
404        if (root.nodeType !== 1 && root.nodeType !== 9) return;
405        if (root.matches && root.matches(selector)) mount(root);
406        root.querySelectorAll(selector).forEach(mount);
407    }
408    function start() {
409        scan(document);
410        new MutationObserver(records => records.forEach(record => record.addedNodes.forEach(scan)))
411            .observe(document.body, {childList: true, subtree: true});
412    }
413    if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', start, {once: true});
414    else start();
415})();

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.