Skip to content

Commit

Permalink
Polish: Make The Popup Follow the Active Tab Context (#33)
Browse files Browse the repository at this point in the history
Currently the Popup only takes the opener page into account. Let's make
it follow pages, while switching. Should make it better to demo


https://github.com/user-attachments/assets/e65c1d8c-d052-4c97-9792-8bd0cd5ad31a
  • Loading branch information
strseb authored Aug 21, 2024
1 parent 67e1e86 commit 0543a9e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/ui/browserAction/popupPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,16 @@ export class BrowserActionPopup extends LitElement {
super();
this.pageURL = null;
this._siteContext = null;
browser.tabs.onUpdated.addListener(() => this.updatePage());
browser.tabs.onActivated.addListener(() => this.updatePage());
vpnController.state.subscribe((s) => (this.vpnState = s));
this.updatePage();
}
updatePage() {
Utils.getCurrentTab().then(async (tab) => {
if (!Utils.isValidForProxySetting(tab.url)) {
this.pageURL = null;
this._siteContext = null;
return;
}
const hostname = Utils.getFormattedHostname(tab.url);
Expand All @@ -61,8 +69,8 @@ export class BrowserActionPopup extends LitElement {
this._siteContext = proxyHandler.siteContexts.value.get(this.pageURL);
}
});
vpnController.state.subscribe((s) => (this.vpnState = s));
}

connectedCallback() {
super.connectedCallback();
}
Expand Down

0 comments on commit 0543a9e

Please sign in to comment.