diff --git a/src/content_scripts/uCookie.js b/src/content_scripts/uCookie.js index d511070..c168155 100644 --- a/src/content_scripts/uCookie.js +++ b/src/content_scripts/uCookie.js @@ -1,4 +1,7 @@ /* eslint-disable no-underscore-dangle */ +/* global chrome */ +/* global browser */ + const TCF_VERSION_NUMBER = 2; let api; diff --git a/src/popup/popup.js b/src/popup/popup.js index 7086fe2..14054f6 100644 --- a/src/popup/popup.js +++ b/src/popup/popup.js @@ -1,5 +1,8 @@ +/* global chrome */ +/* global browser */ + let api; -if (chrome == undefined) { +if (chrome === undefined) { api = browser; } else { api = chrome; @@ -24,7 +27,7 @@ function fetch_data() { } else { message = { call: 'getTCData', manual: false }; } - api.tabs.sendMessage(tabs[0].id, message, handle_response); + api.tabs.sendMessage(tabs[0].id, message, handleResponse); } catch (error) { console.log('popup.js: error caught', error); } @@ -101,9 +104,9 @@ function update_with_consent_string_data(consent_string) { } } -function handle_response(message) { - if (message == undefined || message.response == null) { return; } - if (message.response == 'found') { +function handleResponse(message) { + if (!message || !message.response) { return; } + if (message.response === 'found') { cmpLocatorFound = true; fetch_data(); try { @@ -114,7 +117,12 @@ function handle_response(message) { } return; } + const res = message.response; + if (res.gdprApplies === false) { + document.getElementById('gdpr_applies_false').classList.remove('hidden'); + document.getElementById('cmplocator_found').classList.add('hidden'); + } console.log(res); if (res.tcString) { consent_string = decodeConsentString(res.tcString); diff --git a/src/popup/ucookie.html b/src/popup/ucookie.html index 052e93c..fd073c4 100644 --- a/src/popup/ucookie.html +++ b/src/popup/ucookie.html @@ -14,6 +14,14 @@ +