From 1f847b755aa73d34a13712fe555931ba353ae02e Mon Sep 17 00:00:00 2001 From: didierfred <didierfred@gmail.com> Date: Wed, 2 May 2018 14:46:06 +0200 Subject: [PATCH] Reload Config UI if start or stop --- popup/menu.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/popup/menu.js b/popup/menu.js index 91a5ce5..bef74f7 100644 --- a/popup/menu.js +++ b/popup/menu.js @@ -37,8 +37,31 @@ function start_modify() document.getElementById("start_stop").value = "Start"; } + // reload config tab , to get the start/stop information correct + var promise_tabs = browser.tabs.query({currentWindow: true}); + promise_tabs.then(reloadConfigTab); + + } + + +function reloadConfigTab(tabs) + { + var config_tab; + + // search for config tab + for (let tab of tabs) + { + if (tab.url.startsWith(browser.extension.getURL(""))) config_tab = tab; + } + + // config tab exits , reload it + if (config_tab) browser.tabs.reload(config_tab.id); + + } + + function start_config() { var promise_tabs = browser.tabs.query({currentWindow: true}); -- GitLab