var cookiesConsentByTypeDef = { "personalad":false, "lastvisited":false}; var cookiesConsentByType = {}; function getCookieConsentValidValues( lCookiesConsentByType ) { var tmp = {}; for (const property in cookiesConsentByTypeDef) { if ( lCookiesConsentByType[property] === undefined ) { return {}; } if ( lCookiesConsentByType[property] === true ) { tmp[property] = lCookiesConsentByType[property]; } else { tmp[property] = false; } } return tmp; } function isCookiesConsentSet() { try{ cookieConsent = atob(readCookie('cookiesconsent')); } catch(e){ cookieConsent = null; } if ( cookieConsent === null ) { return false; } try { cookiesConsentByType = JSON.parse(cookieConsent); cookiesConsentByType = getCookieConsentValidValues( cookiesConsentByType ); } catch(e) { createAjaxCookie('cookiesconsent', '', 0); return false; } if ( Object.keys(cookiesConsentByType).length === 0 ) { createAjaxCookie('cookiesconsent', '', 0); return false; } return true; } function getCookiesConsent( type ) { try{ cookieConsent = atob(readCookie('cookiesconsent')); } catch(e){ cookieConsent = null; } if ( cookieConsent === null ) { return null; } try { cookiesConsentByType = JSON.parse(cookieConsent); } catch(e) { createAjaxCookie('cookiesconsent', '', 0); return false; } if ( cookiesConsentByType[type] === undefined ) return null; if ( cookiesConsentByType[type] === true ) return true; return false; } function getConsentMain() { jQuery.ajax({ url: '/consent/consent_main.php', async: true, type: 'GET', cache: false, data: '', dataType: "text", success: function(text) { $('#consent_main').html(text); $('#consent_main').show(); $('#consent-info').show(); $("#button_i_accept").focus(); }, error: function(req,stat,err) { show_message('Грешка'); } }); }