PageSourceSearch

https://www.myfico.com/www/js/custom/myf.cookie.privacy.js

js myfico.com collected 2026-10-02 09:48:42 UTC 26,940 bytes, 780 lines download raw bytes

1var utilOsanoHelper = {
2    sanitizeString: function (str) {
3        if (typeof str !== "undefined" && str !== null) {
4            str = str.replace(/[^a-z0-9 \.,=?_-]/gim, "");
5            return str.trim();
6        }
7	    return "";
8    },
9	getCookie: function (a, sanitize = true) {
10		//Use a new cookie method with RegEx support
11		//https://stackoverflow.com/questions/5639346/what-is-the-shortest-function-for-reading-a-cookie-by-name-in-javascript?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
12		var b = document.cookie.match('(^|;)\\s*' + sanitizeString(a) + '\\s*=\\s*([^;]+)');
13		var val = b ? b.pop() : '';
14		return sanitize ? sanitizeString(val) : val;
15	},
16	//set cookie
17	setCookie: function (cname, cvalue, exptime, timeType) {
18		var d = new Date();
19
20		//check unit type
21		if (typeof timeType !== "undefined" && timeType !== null && timeType !== "") {
22			if (timeType == "min") { 
23				//convert in minutes
24				d.setTime(d.getTime() + (exptime * 60 * 1000));
25			} else if (timeType == "hr") {
26				//convert in hours
27				d.setTime(d.getTime() + (exptime * 60 * 60 * 1000));
28			}			
29		} else {
30			//convert in days
31			d.setTime(d.getTime() + (exptime * 24 * 60 * 60 * 1000));
32		}
33		var expires = "expires=" + d.toUTCString() + ";";
34		if (exptime === 0) {
35			expires = "expires=0;";
36
37			//dont set expire value for IE if its a session cookie
38			var ua = window.navigator.userAgent;
39			var msie = ua.indexOf("MSIE "); //check for general ie
40			var trident = ua.indexOf('Trident/'); //check for ie11
41			var edge = ua.indexOf('Edge/'); //check for ie12+ edge
42			if (msie > 0 || trident > 0 || edge > 0) // If Internet Explorer, return version number
43			{
44				expires = "";
45			}
46		}
47		cname = sanitizeString(cname);
48		cvalue = sanitizeString(cvalue);
49		document.cookie = cname + "=" + cvalue + "; " + expires + " domain=.myfico.com; path=/; secure=true";
50	},
51	deleteCookieWithDomain: function (name) {
52		document.cookie = name + '=; Path=/; domain=.myfico.com; Expires=Thu, 01 Jan 1970 00:00:01 GMT;';
53	},
54    setJSONCookie: function (name, jsonObject, days = 365) {
55        try {
56            const jsonString = JSON.stringify(jsonObject);
57            const encodedValue = encodeURIComponent(jsonString);
58            
59            const date = new Date();
60            date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
61            const expires = `expires=${date.toUTCString()}`;
62            
63            document.cookie = `${name}=${encodedValue};${expires};path=/`;
64            return true;
65        } catch (error) {
66            console.error('Error setting JSON cookie:', error);
67            return false;
68        }
69    },
70    getJSONCookie: function (name) {
71        try {
72            const nameEQ = name + "=";
73            const cookies = document.cookie.split(';');
74            
75            for (let i = 0; i < cookies.length; i++) {
76                let cookie = cookies[i].trim();
77                if (cookie.indexOf(nameEQ) === 0) {
78                    const encodedValue = cookie.substring(nameEQ.length);
79                    const jsonString = decodeURIComponent(encodedValue);
80                    return JSON.parse(jsonString);
81                }
82            }
83            return null;
84        } catch (error) {
85            console.error('Error getting JSON cookie:', error);
86            return null;
87        }
88    },
89    replaceEntireCookie: function (cookieName, newValue, days = 365) {
90        // Simply set the new complete value, replacing everything
91        return this.setJSONCookie(cookieName, newValue, days);
92    },
93    compareJSON: function (obj1, obj2) {
94        return JSON.stringify(obj1) === JSON.stringify(obj2);
95    },
96    consentCookieName: "myFICOOsanoConsent"
97};
98
99
100// Block network calls immediately
101(function() {
102    const blockedDomains = ['doubleclick.net'];
103    const osanoConsentData = window.Osano && window.Osano.cm && window.Osano.cm.getConsent();
104    const isMarketingDeny = (osanoConsentData && osanoConsentData.MARKETING && osanoConsentData.MARKETING.toLowerCase() === "deny") || false;
105    
106    const urlParams = new URLSearchParams(window.location.search);
107    const isDisabled = urlParams && urlParams.get('osanofix') === "false";
108
109    //disable blocking if pass thru qs
110    if (isDisabled) {
111        if (isLogEnabled()) { console.log('Disabled -- No network blocked') }
112        return
113    }
114
115    if (isMarketingDeny === false )  {
116        if (isLogEnabled()) { console.log('Marketing is not blocked -- continue') }
117        return
118    }
119    
120    const originals = {
121        xhr: window.XMLHttpRequest,
122        fetch: window.fetch
123    };
124
125    function shouldBlock(url) {
126        try {
127            const urlObj = new URL(url);
128            const isDomainBlocked = blockedDomains.some(domain => 
129                urlObj.hostname.includes(domain)
130            );
131            return isDomainBlocked && isMarketingDeny;
132        } catch (e) {
133            // If URL parsing fails, check string includes
134            return blockedDomains.some(domain => url.includes(domain) && isMarketingDeny);
135        }
136    }
137
138    // Replace XMLHttpRequest constructor
139    window.XMLHttpRequest = function XMLHttpRequest() {
140        const xhr = new originals.xhr();
141        const origOpen = xhr.open;
142        
143        xhr.open = function(method, url) {
144            try {
145                if (shouldBlock(url)) {
146                    if (isLogEnabled()) console.log('BLOCKED network url: ', url);
147
148                    // Return a template xhr
149                    return Object.assign(this, {
150                        send() { },
151                        setRequestHeader() {},
152                        readyState: 4,
153                        status: 200
154                    });
155                }
156                return origOpen.apply(this, arguments);
157            } catch (error) {
158                // Fallback to default
159                try {
160                    return origOpen.apply(this, arguments);
161                } catch (fallbackError) {
162                    return false;
163                }
164            }
165        };
166        
167        return xhr;
168    };
169
170    // Replace fetch function
171    if (window.fetch) {
172        window.fetch = function(input) {
173            try {
174                const url = typeof input === 'string' ? input : input.url;
175                if (shouldBlock(url)) {
176                    if (isLogEnabled()) console.log('BLOCKED network fetch url: ', url);
177                    return Promise.resolve(new Response('', { status: 200 }));
178                }
179                return originals.fetch.apply(this, arguments);
180            } catch (error) {
181                // Fallback to default
182                if (originals.fetch) {
183                    return originals.fetch.apply(this, arguments);
184                }
185                return Promise.reject(error);
186            }
187        };
188    }
189    if (isLogEnabled()) console.log('blocking started');
190})();
191
192if (window.Osano && window.Osano.cm) {
193    document.addEventListener('click', function(event) {
194        if (event.target.classList.contains('osano-cm-manage')) {
195            fireOsanoCs('osano_banner_manage_preferences');
196        }
197    });
198
199    window.Osano.cm.addEventListener("osano-cm-script-blocked", function (item) {
200        if (isLogEnabled()) console.log("Script blocked: " + item);
201    });
202    window.Osano.cm.addEventListener("osano-cm-cookie-blocked", function (item) {
203        if (isLogEnabled()) console.log("Cookie blocked: " + item);
204    });
205    window.Osano.cm.addEventListener("osano-cm-iframe-blocked", function (item) {
206        if (isLogEnabled()) console.log("iframe blocked: " + item);
207    });
208    window.Osano.cm.addEventListener('osano-cm-initialized', (consent) => {
209        //check to see if we need to hide pixel image
210        const data = consent || (window.Osano && window.Osano.cm && window.Osano.cm.getConsent())
211        hideBodyImgPixel(data);
212
213        //show footer cookie preference link when set to strict mode
214        if (isFooterChangeAllow()) {
215            var elements = document.querySelectorAll('.js-cp-link');
216
217            elements.forEach(function (el) {
218                el.classList.remove("hide");
219                el.removeAttribute('aria-hidden');
220            })
221
222            if (isLogEnabled()) console.log('[Osano] User is outside the US or in California. Dialog remains visible.');
223        }
224
225        //non state allowed
226        if (!isStateAllow() && isFooterChangeAllow()) {
227            //hide banner
228            hideBanner();
229
230            //show footer disclaimer
231            createOsanoFooterDisclaimer(".global-footer-section .legal-disclosures p:nth-child(5)");
232
233            if (isLogEnabled()) console.log('[Osano] User is in the US (outside California). Hiding dialog...');
234        } 
235        else if (!isStateAllow()) {
236            //when no footer flag and other states -- always hide banner
237            hideBanner();
238
239            if (isLogEnabled()) console.log('[Osano] User is in the US (outside California). Hiding dialog...');
240        }
241
242        //qs testing -- mimic hide banner
243        if (isFakeState()) {
244            hideBanner();
245            var elements = document.querySelectorAll('.js-cp-link');
246
247            elements.forEach(function (el) {
248                el.classList.add("hide");
249                el.removeAttribute('aria-hidden');
250            })
251
252            createOsanoFooterDisclaimer(".global-footer-section .legal-disclosures p:nth-child(5)");
253
254            if (isLogEnabled()) console.log('QA Test forcing to hide banner. Hiding dialog...');
255        }
256
257        //call api
258        if (consent) {
259            updateOsanoConsent(consent);
260        } else if (typeof consent === "undefined") {
261            updateOsanoConsent(window.Osano.cm.getConsent());
262        }
263
264
265        //fire delay clickstream event
266        if (isStateAllow()) {
267            let x = 0;
268            const numOfTry = 10;
269
270            //increased to 500*10 = 5sec
271            const intervalID = setInterval(function () {
272                //increase counter
273                x++
274                //clear after 10 tries
275                if (x == numOfTry) {
276                    window.clearInterval(intervalID);
277                }
278                //fire cs when banner is shown
279                if (typeof window.fireClickstreamEvent === 'function' && !isBannerHidden()) {
280                    fireOsanoCs('osano_banner_default', 'display');
281
282                    //add click listener to show behavior-ad email
283                    document.querySelectorAll('.osano-cm-button--type_manage').forEach(element => {
284                        element.addEventListener('click', function(event) {
285                            if (isLogEnabled()) console.log('Clicked:', event.target);
286                            insertFormToDrawer();
287                        });
288                    });
289
290                    window.clearInterval(intervalID);
291                }
292            }, 500, numOfTry);
293        }
294
295        //log GPC
296        checkGPC();
297    });
298
299    window.Osano.cm.addEventListener('osano-cm-consent-saved', (consent) => {
300        if (consent) {
301            // Fire one time
302            // clicking on accept button on banner
303            if (isStateAllow() && !isBannerHidden() && window.Osano.cm.getConsent()['OPT_OUT'] === 'DENY') {
304                fireOsanoCs('osano_banner_accept');
305                updateOsanoConsentAction(consent);
306            }
307
308            // Fire one time
309            // clicking on deny optional button on banner
310            if (isStateAllow() && !isBannerHidden() && window.Osano.cm.getConsent()['OPT_OUT'] === 'ACCEPT') {
311                fireOsanoCs('osano_banner_deny_optional');
312                updateOsanoConsentAction(consent);
313            }
314
315            
316
317            updateOsanoConsent(consent);
318        }
319    });
320
321    //add click event when drawer is open
322    window.Osano('onUiChanged', (component, stateChange) => {
323        if (component === 'drawer' && stateChange === 'show') {
324            if (isLogEnabled()) console.log('onUiChanged Preferences drawer has been opened.');
325            //listen to save button click
326            var button_save = document.querySelector(".osano-cm-save");
327            button_save.addEventListener("click", function (e) {
328                if (isStateAllow()) {
329                    const consent = window.Osano.cm.getConsent();
330                    if (consent) updateOsanoConsentAction(consent);
331                } 
332                fireOsanoCs('save_cookie_pref_button');
333            });
334        }
335    });
336};
337
338function fireOsanoCs(name, display) {
339    if (!name) return;
340
341    let disType = display || 'click';
342    const oid = getConsentMarketing();
343
344    const juri = isStateAllow(true);
345    if (typeof window.fireClickstreamEvent === 'function') {
346        fireClickstreamEvent({ 'type': disType, name: name, 'category': 'jurisdiction', 'subCategory': juri, 'objectId': oid });
347        if (isLogEnabled()) console.log('cs fired: ', name);
348    }
349}
350
351// get marketing consent value
352function getConsentMarketing() {
353    const mktConsent = window.Osano.cm.getConsent()['MARKETING']
354    if (mktConsent) {
355        if (mktConsent === 'ACCEPT') {
356            return 'a'
357        } else if (mktConsent === 'DENY') {
358            return 'd'
359        } else {
360            return 'na'
361        }
362    } else {
363        return 'na'
364    }
365}
366
367//check for drawer open
368function isDrawerOpen() {
369    const os_drawer = document.querySelector(".osano-cm-info--open");
370
371    if (os_drawer && os_drawer !== null) {
372        return true;
373    }
374    return false;
375}
376
377
378//check if banner is shown or hidden
379function isBannerHidden() {
380    const os_dialog = document.querySelector(".osano-cm-dialog");
381
382    if ((os_dialog && os_dialog.classList && os_dialog.classList.contains('osano-cm-dialog--hidden')) || os_dialog === null) {
383        return true;
384    }
385    return false;
386}
387
388
389function isStateAllow(getState) {
390    // Get the user's jurisdiction
391    let jurisdiction = window.Osano && window.Osano.cm && window.Osano.cm.jurisdiction;
392
393    //use qs to override to test other states
394    if (getQsFakeState() !== null) {
395        jurisdiction = getQsFakeState();
396    }
397
398    //Param getState: true will return the jurisdiction info
399    if (getState) {
400        return jurisdiction;
401    }
402
403    //Supported State: California QA (using querystring)
404    //else return boolean
405    if (jurisdiction && jurisdiction.startsWith('us') && (jurisdiction === 'us-ca')) {
406        return true;
407    }
408    return false;
409}
410
411function isOtherStateAllow(getState) {
412    // Get the user's jurisdiction
413    let jurisdiction = window.Osano && window.Osano.cm && window.Osano.cm.jurisdiction;
414
415    //use qs to override to test other states
416    if (getQsFakeState() !== null) {
417        jurisdiction = getQsFakeState();
418    }
419
420    //Param getState: true will return the jurisdiction info
421    if (getState) {
422        return jurisdiction;
423    }
424
425    //Supported State: Texas, Nebrasaka, Maryland QA (using querystring)
426    //else return boolean
427    if (jurisdiction && jurisdiction.startsWith('us') && (jurisdiction === 'us-tx' || jurisdiction === 'us-ne' || jurisdiction === 'us-md')) {
428        return true;
429    }
430    return false;
431}
432
433function isLogEnabled() {
434    const urlParams = new URLSearchParams(window.location.search);
435    return urlParams.get('testOsano') === "true";
436}
437
438function isFakeState() {
439    //for testing banner outside allowed states
440    const urlParams = new URLSearchParams(window.location.search);
441    return urlParams.get('isFake') === "true";
442}
443
444function getQsFakeState() {
445    //for testing banner outside allowed states -- override the current jurisdiction
446    const urlParams = new URLSearchParams(window.location.search);
447    return urlParams.get('isOverrideState');
448}
449
450function hideBanner() {
451    //add css for fallback
452    document.body.classList.add("osano-nonstate");
453
454    setTimeout(() => {
455        window.Osano.cm.hideDialog();
456    }, 0);
457
458}
459
460function isFooterChangeAllow() {
461    if (typeof isOsanoFooterAllow !== "undefined" && (isOsanoFooterAllow === 'true' || isOsanoFooterAllow === true)) {
462        return true
463    }
464    return false;
465}
466
467function createOsanoFooterDisclaimer(footerClassPlacement) {
468
469    if (!footerClassPlacement) return;
470
471    var elem = document.querySelector("#non-ca-tx");
472    if (elem && elem != null) {
473        document.getElementById("non-ca-tx").style.display = "block";
474        return;
475    }
476
477    //create paragraph
478    var para = document.createElement("p");
479    var node = document.createTextNode('You acknowledge that this website utilizes technologies such as cookies, deployed by us or our service providers, to enable essential site functionality, for analytics (including conversions), for personalization, and for targeted advertising.  You can choose to change your targeted advertising preferences by clicking ');
480    para.appendChild(node);
481
482    //create a tag
483    var customAtag = document.createElement('a');
484    var linkText = document.createTextNode("Cookie Preferences");
485    customAtag.appendChild(linkText);
486    customAtag.ariaLabel = "Cookie Preferences";
487    customAtag.className = "prop10Event cselem";
488    customAtag.href = "javascript:void";
489    customAtag.dataset.csClick = "click";
490    customAtag.dataset.csName = "footer.extra.cookie.preferences";
491    customAtag.addEventListener('click', function (e) {
492            e.preventDefault(); 
493            openOsanoDrawer();      
494        });
495    para.appendChild(customAtag);
496    
497    var nodePeriod = document.createTextNode('.');
498    para.appendChild(nodePeriod);
499
500    //append second to the last dislclaimer
501    var element = document.querySelector(footerClassPlacement);
502
503    if (element && element != null) {
504        element.before(para);
505    }
506}
507
508function openOsanoDrawer() {
509    if (window.Osano && window.Osano.cm) {
510        fireOsanoCs('footer.cookie.preferences');
511
512        window.Osano.cm.showDrawer();
513        insertFormToDrawer();
514    }
515}
516
517
518//fire when user take action from banner
519function updateOsanoConsentAction(consent) {
520    try {
521        if (consent) {
522
523            const xhttp = new XMLHttpRequest();
524            //update base on domain name
525            let domainName = getCookieDomainNameOverwrite();
526
527            const juri = isStateAllow(true);
528            const mktConsentVal = getConsentMarketing();
529            let param = "";
530
531            //pass juri information and marketing consent value
532            if (juri && mktConsentVal) {
533                param = "?jurisdiction=" + juri + "&action=" + mktConsentVal
534            }
535
536            //update cookie value when save from drawer
537            const shouldCallApi = checkOrCreateOsanoConsentCookie(utilOsanoHelper.consentCookieName, consent);
538
539            if (shouldCallApi) {
540
541                const updatedConsent = { ...consent };
542                utilOsanoHelper.replaceEntireCookie(utilOsanoHelper.consentCookieName, consent);
543
544                //Add state to api
545                if (juri) {
546                    updatedConsent.STATE = juri
547                }
548
549                xhttp.open("PUT", "https://" + domainName + "/v4/visitor/cookie/privacy/selection" + param, true)
550                xhttp.setRequestHeader('Content-type', 'application/json');
551                xhttp.withCredentials = true;
552                xhttp.send(JSON.stringify(updatedConsent));
553            }
554        }
555    } catch (exceptionVar) {
556        //console.log('try/catch error ', exceptionVar)
557    }
558}
559
560function getCookieDomainNameOverwrite() {
561    let domainName = 'api.myfico.com';
562    if (typeof apiWebServer === "string") {
563        domainName = apiWebServer;
564    }
565    if(window && window.myfico && window.myfico.globalVars && window.location && window.location.hostname){
566        //if secure-ui or www, use their domain
567        if(/^secure\./i.test(window.location.hostname) && window.myfico.globalVars.securewebserver){
568            domainName = window.myfico.globalVars.securewebserver;
569        }else if(/^www\./i.test(window.location.hostname) && window.myfico.globalVars.webserver){
570            domainName = window.myfico.globalVars.webserver;
571        }
572        if (domainName.startsWith('//')) {
573            domainName = domainName.slice(2);
574        }
575    }
576    return domainName;
577}
578
579function checkOrCreateOsanoConsentCookie(cookieName, updatedConsentVal, expirationDays = 365) {
580     // Check if cookie exists
581    const existingValue = utilOsanoHelper.getJSONCookie(cookieName);
582    
583    if (existingValue !== "" && existingValue !== null) {
584        //compare cookie value, if diff update cookie and call api
585        const isUpdateConsent = utilOsanoHelper.compareJSON(updatedConsentVal, existingValue);
586
587        //when value are diff
588        if (!isUpdateConsent) {
589            return true;
590        } 
591
592        return false; // Return existing JSON object
593    } else {
594        // Create new JSON cookie
595        const success = utilOsanoHelper.setJSONCookie(cookieName, updatedConsentVal, expirationDays);
596        if (success) {
597            return true;
598        } else {
599            return null;
600        }
601    }
602}
603
604
605//always fire
606function updateOsanoConsent(consent) {
607   
608    try {
609        if (consent) {
610            //check for cookie
611            const shouldCallApi = checkOrCreateOsanoConsentCookie(utilOsanoHelper.consentCookieName, consent);
612            const juri = isStateAllow(true);
613
614            //call api only when no cookie or different cookie value
615            if (shouldCallApi) {
616                const updatedConsent = { ...consent };
617                utilOsanoHelper.replaceEntireCookie(utilOsanoHelper.consentCookieName, consent);
618
619                //Add state to api
620                if (juri) {
621                    updatedConsent.STATE = juri
622                }
623
624                const xhttp = new XMLHttpRequest();
625
626                //update base on domain name
627                let domainName = getCookieDomainNameOverwrite();
628
629                xhttp.open("PUT", "https://" + domainName + "/v4/visitor/cookie/privacy", true)
630                xhttp.setRequestHeader('Content-type', 'application/json');
631                xhttp.withCredentials = true;
632                xhttp.send(JSON.stringify(updatedConsent));
633            }
634        }
635    } catch (exceptionVar) {
636        //console.log('try/catch error ', exceptionVar)
637    }
638} 
639
640function generateThreeDigitNumber() {
641  return Math.floor(Math.random() * 900) + 100;
642}
643
644function sendEmailBasedTech() {
645    try {
646        const xhttp = new XMLHttpRequest();
647
648        //update base on domain name
649        let domainName = 'api.myfico.com';
650        if (typeof apiWebServer === "string") {
651            domainName = apiWebServer;
652        }
653
654        const preferenceData = {
655            "emailAddress": $('#myEmailInput').val(),
656            "preferences": [
657                { "name": "behavior_targeting", "value": false }
658            ],
659            "tn": "tnv"+generateThreeDigitNumber()
660        }; 	
661
662        xhttp.open("PUT", "https://" + domainName + "/v4/users/profile/preferences/mktg", true)
663        xhttp.setRequestHeader('Content-type', 'application/json');
664        xhttp.withCredentials = true;
665        xhttp.send(JSON.stringify(preferenceData));
666    
667    } catch (exceptionVar) {
668        //console.log('try/catch error ', exceptionVar)
669    }
670} 
671
672function insertFormToDrawer() {
673    //insert targeted div
674    const targetDiv = document.querySelector(".osano-cm-list");
675
676    // create new div tag
677    const newDiv = document.createElement("div");
678    newDiv.classList.add("email-section-wrapper");
679
680    // create h2
681    const h2 = document.createElement("h2");
682    h2.textContent = "Behavioral Advertising Linked To Your Email Address:";
683    h2.classList.add("my-heading"); 
684    newDiv.appendChild(h2);
685
686    // create para
687    const myPara = document.createElement("p");
688    myPara.textContent = "You may have previously provided your email address to us. In some cases, we may use email addresses or other non-cookie personal information to deliver emails or targeted advertising via third parties. To request that your personal information is not used for these purposes, please enter your email address:";
689    myPara.classList.add("my-para"); 
690    newDiv.appendChild(myPara);
691
692    // create form
693    const form = document.createElement("form");
694    form.id = "myForm";
695
696    // create label
697    const label = document.createElement("label");
698    label.textContent = "Email: ";
699
700    // create input
701    const input = document.createElement("input");
702    input.type = "text";
703    input.id = "myEmailInput";
704    input.name = "myEmailInput";
705    input.placeholder = "";
706    //input.required = true;
707
708    // create button
709    const button = document.createElement("button");
710    button.type = "submit";
711    button.classList = "btn-primary";
712    button.textContent = "Submit";
713
714    // Append to form
715    form.appendChild(label);
716    form.appendChild(input);
717    form.appendChild(button);
718    newDiv.appendChild(form);
719
720    // create para
721    const mySuccess = document.createElement("p");
722    mySuccess.classList.add("my-success"); 
723    newDiv.appendChild(mySuccess);
724
725    const myError = document.createElement("p");
726    myError.classList.add("my-error"); 
727    newDiv.appendChild(myError);
728
729    // create para
730    const mySecPara = document.createElement("p");
731    mySecPara.textContent = 'Click "Save" to save your settings and close the window.';
732    mySecPara.classList.add("my-note-para"); 
733    newDiv.appendChild(mySecPara);
734
735    // Add validation logic
736    form.addEventListener("submit", function (e) {
737        e.preventDefault();
738
739        const validEmailRegex = RegExp(/^\s*[A-Za-z0-9_-]+([\.]?[A-Za-z0-9_-]+)*[@]\w+([\.-]?\w+)*(\.[a-zA-Z]{2,20})+\s*$/);
740    
741        if (input) {
742            if (input.value.trim() === "") {
743                myError.textContent = "Required";
744                input.focus();
745                return;
746            } else if (!validEmailRegex.test(input.value)) {
747                myError.textContent = "This email address is not val
747id. Please try again.";
748                return;
749            }
750
751            //TODO: add from submit
752            myError.textContent = "";
753            sendEmailBasedTech();
754            form.remove();
755            mySuccess.textContent = "Submitted successfully";
756            fireOsanoCs('osano_drawer_email_form_submit');
757        }
758
759    });
760    //append elements
761    targetDiv.after(newDiv);
762}
763
764function checkGPC() {
765    if (navigator.globalPrivacyControl) {
766        if (isLogEnabled()) console.log("GPC is enabled");
767    } else {
768        if (isLogEnabled()) console.log("GPC is not enabled.");
769    }
770}
771
772
773function hideBodyImgPixel (consent) {
774    // Marketing is denied, hide any img pixel
775    if (consent && consent.MARKETING && consent.MARKETING.toLowerCase() === "deny") {
776        const bodySelector = document.querySelector('body');
777        bodySelector.classList.add("myfico-osano-hide-marketing");
778        if (isLogEnabled()) console.log(`hide marketing pixel`);
779    } 
780}

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.