1 2 window.tls = window.tls || {}; 3 window.tls.utils = window.tls.utils || {}; 4 5 /** 6 * Reads cookie value as string 7 */ 8 window.tls.utils.GetCookie = function(cookieName) { 9 var name = cookieName + "="; 10 var decodedCookie = decodeURIComponent(document.cookie); 11 var ca = decodedCookie.split(';'); 12 13 for (var i = 0; i < ca.length; i++) { 14 var c = ca[i]; 15 while (c.charAt(0) == ' ') { 16 c = c.substring(1); 17 } 18 19 if (c.indexOf(name) == 0) { 20 return c.substring(name.length, c.length); 21 } 22 } 23 24 return ""; 25 } 26 27 /** 28 * Reads and parsed cookie value as JSON 29 */ 30 window.tls.utils.GetCookieAsParsedJson = function(cookieName) { 31 var cookieValue = window.tls.utils.GetCookie(cookieName); 32 var parsed = JSON.parse(cookieValue); 33 return parsed; 34 } 35 36 /** 37 * Reads DataLayer value 38 */ 39 window.tls.utils.GetDataLayerValue = function (keyVal) { 40 for (var i = 0; i < window.dataLayer.length; i++) { 41 if (dataLayer[i][keyVal] !== undefined) { 42 return dataLayer[i][keyVal]; 43 } 44 } 45 } 46 47 /** 48 * Checks if current browser is mobile, based on the mobile CSS breakpoint 49 */ 50 window.tls.utils.IsMobile = function () { 51 return window.matchMedia("only screen and (max-width: 959px)").matches; 52 } 53
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.