1function LGPDAgreementManager() { 2 var STATUS_CONSENTIDO = 1; 3 var STATUS_PENDENTE = 2; 4 var STATUS_BASICO = 3; 5 var VALOR_BASICO = "basico"; 6 var VALOR_ACEITO = "aceito"; 7 8 return { 9 isPending: isPending, 10 statusConsentimento: statusConsentimento, 11 salvaConsentimento: salvaConsentimento, 12 bloqueiaCookiesJs: bloqueiaCookiesJs, 13 }; 14 15 function isPending() { 16 return ( 17 statusConsentimento() === STATUS_PENDENTE && window.isconsentimentoativo 18 ); 19 } 20 21 function statusConsentimento() { 22 if (temConsentimentoCookie()) { 23 var valorConsentimento = valorConsentimentoCookie().status; 24 25 if (valorConsentimento === VALOR_ACEITO) { 26 return STATUS_CONSENTIDO; 27 } else if (valorConsentimento === VALOR_BASICO) { 28 return STATUS_BASICO; 29 } 30 } 31 32 return STATUS_PENDENTE; 33 } 34 35 function temConsentimentoCookie() { 36 var cookies = document.cookie.split(";"); 37 for (var i = 0; i < cookies.length; i++) { 38 var cookie = cookies[i]; 39 if (cookie.indexOf("consentimento-lgpd", 0) > -1) { 40 return true; 41 } 42 } 43 return false; 44 } 45 46 function valorConsentimentoCookie() { 47 var cookies = document.cookie.split(";"); 48 for (var i = 0; i < cookies.length; i++) { 49 var cookie = cookies[i]; 50 if (cookie.indexOf("consentimento-lgpd", 0) > -1) { 51 return JSON.parse(atob(decodeURIComponent(cookie.split("=")[1]))); 52 } 53 } 54 return null; 55 } 56 57 function salvaConsentimento(acao) { 58 return $.ajax({ 59 type: "POST", 60 url: "/_service/lgpd/consentimento/" + acao, 61 context: this, 62 }); 63 } 64 65 function bloqueiaCookiesJs() { 66 document.__defineGetter__("cookie", function () { 67 return ""; 68 }); 69 document.__defineSetter__("cookie", function () {}); 70 } 71}
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.