From 7ba276a82118f376f17fb4ace5c518a6218a3eda Mon Sep 17 00:00:00 2001 From: tophf Date: Thu, 30 Mar 2017 04:28:16 +0300 Subject: [PATCH] regexp tester: autoupdate on tab navigations --- edit.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/edit.js b/edit.js index df0808c5..98627761 100644 --- a/edit.js +++ b/edit.js @@ -1644,6 +1644,15 @@ function showRegExpTester(event, section = getSectionForChild(this)) { } return rxData; }); + chrome.tabs.onUpdated.addListener(function _(tabId, info) { + if (document.querySelector('.regexp-report')) { + if (info.url) { + showRegExpTester(event, section); + } + } else { + chrome.tabs.onUpdated.removeListener(_); + } + }); chrome.tabs.query({}, tabs => { const supported = tabs.map(tab => tab.url) .filter(url => RX_SUPPORTED_URLS.test(url));