From 456b65af823b0a62dafe4ccb1b628e56be9cd51e Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Sat, 28 May 2022 11:00:48 +0300 Subject: Fixed Unify Settings not working for localStorage. Fixed other things --- src/pages/popup/popup.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/pages/popup') diff --git a/src/pages/popup/popup.js b/src/pages/popup/popup.js index 84dbab04..73890b07 100644 --- a/src/pages/popup/popup.js +++ b/src/pages/popup/popup.js @@ -90,11 +90,22 @@ utils.copyRaw(true).then(r => { } }) + utils.unify(true).then(r => { if (!r) document.getElementById('unify_div').style.display = 'none'; else { const unify = document.getElementById('unify'); - unify.addEventListener("click", () => browser.runtime.sendMessage({ function: 'unify' })); + unify.addEventListener("click", () => + browser.runtime.sendMessage({ function: 'unify' }, + response => { + if (response && response.response) { + const textElement = document.getElementById('unify').getElementsByTagName('h4')[0] + const oldHtml = textElement.innerHTML; + textElement.innerHTML = 'Unified'; + setTimeout(() => textElement.innerHTML = oldHtml, 1000); + } + }) + ); } }) @@ -113,7 +124,7 @@ browser.storage.local.get( for (const a of document.getElementsByTagName('a')) { a.addEventListener('click', e => { - if (!a.classList.includes('button')) { + if (!a.classList.contains('button')) { browser.tabs.create({ url: a.getAttribute('href') }); e.preventDefault(); } -- cgit 1.4.1