diff --git a/popup/popup.js b/popup/popup.js index 66733d8..a34132e 100644 --- a/popup/popup.js +++ b/popup/popup.js @@ -150,20 +150,18 @@ function smoothTextChange(element, newText) { }); // update current & best dates chrome.storage.onChanged.addListener((changes, area) => { - if (area === 'local' && changes.ctx_consulates) { + if (changes.ctx_consulates) { const newConsulates = changes.ctx_consulates.newValue; - for (let c in newConsulates) { - if (newConsulates[c].currentDate) { - let el = document.getElementById(`currentDate-${c}`); - if (el && el.innerText != newConsulates[c].currentDate) - smoothTextChange(el, newConsulates[c].currentDate); - } - if (newConsulates[c].bestDate) { - let el = document.getElementById(`bestDate-${c}`); - if (el && el.innerText != newConsulates[c].bestDate) - smoothTextChange(el, newConsulates[c].bestDate); - } + if (newConsulates[c].currentDate) { + let el = document.getElementById(`currentDate-${cId}`); + if (el && el.innerText != newConsulates[c].currentDate) + smoothTextChange(el, newConsulates[c].currentDate); + } + if (newConsulates[c].bestDate) { + let el = document.getElementById(`bestDate-${cId}`); + if (el && el.innerText != newConsulates[c].bestDate) + smoothTextChange(el, newConsulates[c].bestDate); } } });