PageSourceSearch

https://www.qima.vn/js/head.js?v220

js qima.vn collected 2026-10-08 04:42:19 UTC 4,051 bytes, 104 lines download raw bytes

1/**
2* This file is for JS that needs to be in the head tag rather that the footer
3*/
4
5//Set a Cookie
6function setCookie(c_name, value, exdays) { // Everything in one cookie: AI_Cookie (for GDPR)
7	if(exdays == null || exdays == undefined) exdays = 730;
8	var cookie = {};
9	// Get the AI_Cookie if it exists and json decode it into an array
10	var i, x, y, ARRcookies=document.cookie.split(";");
11	for (i=0; i<ARRcookies.length; i++) {
12		x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
13		y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
14		x=x.replace(/^\s+|\s+$/g,"");
15		if (x == "AI_Cookie") {
16			try {
17				cookie = JSON.parse(unescape(y));
18			} catch(e) {
19				cookie = null;
20			}
21			if(cookie == null) cookie = {};
22		}
23	}
24	
25	// Add the new cookie data to the array/obj
26	var exdate = new Date();
27	exdate.setDate(exdate.getDate() + exdays);
28	expiry = exdate.getFullYear() + "-" + (exdate.getMonth() + 1) + "-" + exdate.getDate();
29	cookie[c_name] = {"val": value, "exp": expiry};
30	
31	// JSON encode the cookie and set it again
32	var cdate = new Date();
33	cdate.setDate(cdate.getDate() + 730);
34	var c_value=JSON.stringify(cookie) + "; expires="+cdate.toUTCString() + ";path=/;secure";
35	document.cookie="AI_Cookie=" + c_value;
36}
37
38function getCookie(c_name) {
39	var i, x, y, ARRcookies=document.cookie.split(";");
40	for (i=0; i<ARRcookies.length; i++) {
41		x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
42		y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
43		x=x.replace(/^\s+|\s+$/g,"");
44		if (x == "AI_Cookie") { // If we found an existing AI_Cookie
45			try {
46				cookie = JSON.parse(unescape(y));
47			} catch(e) {
48				return null;
49			}
50			for(key in cookie) { // sort through all the cookies stored in the AI_Cookie
51				if(key == c_name){ // If we found the cookie name inside the AI_Cookie
52					var tdate = new Date()
53					var edate = new Date(cookie[key]["exp"]);
54					if(tdate >= edate) { // Check if the cookie has expired
55						return null; // if the cookie has expired
56					} else {
57						return unescape(cookie[key]["val"]); // if the cookie hasn't expired, return the value
58					}
59				}
60			}
61			return null; // If the cookie name isn't found inside the AI_Cookie
62		}
63	}
64	return null; // If the AI_Cookie isn't found
65}
66
67function getNormalCookie(c_name){
68	var i,x,y,ARRcookies=document.cookie.split(";");
69	for (i=0;i<ARRcookies.length;i++) {
70		x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
71		y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
72		x=x.replace(/^\s+|\s+$/g,"");
73		if (x==c_name) return unescape(y);
74	}
75	return null;
76}
77// This seems to be unused.
78function setNormalCookie(c_name,value,exdays){
79	var exdate=new Date();
80	exdate.setDate(exdate.getDate() + exdays);
81	var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString())+"; path=/";
82	document.cookie=c_name + "=" + c_value;
83}
84
85//Function called by Test & Target when a location is detected on a page with contactPhoneDrop mbox
86function LocalizedPhoneHandler(country) {
87    country = country.toUpperCase();    
88    $(document).ready(function(){
89        //For Navigation
90        phone = $('.selectOffice[iso-code="'+country+'"]').attr("phone");
91        if(phone != "undefined") $('.selectPhone').html(phone);
92
93        //For Contact Us Page Sidebox
94        newPhone = $('option[country="'+country+'"]','.ContactNumberSelect2').attr("phone");
95        $('.ui-link2','.ContactNumberPhone2').attr("href","tel:"+newPhone).text(newPhone);
96        if(typeof afterLocalizedPhoneHandler === "function") afterLocalizedPhoneHandler(country);
97
98        // $('option[country="'+country+'"]','.ContactNumberSelect2').attr("selected","selected");
99
100        //setCookie("tnt-country", CountryCodes['country'], 365); // Set a cookie with the value passed from Test & Target so it can be used by other things
101        euCountries = ["AT","BE","BG","HR","CY","CZ","DK","EE","FI","FR","DE","GR","HU","IE","IT","LV","LT","LU","MT","NL","PL","PT","RO","SK","SI","ES","SE","GB"];
102        if(euCountries.indexOf(country) != -1) setCookie("showEU","true",90);
103    });
104}

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.