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 committed Aug 21, 2024
1 parent 485f8e0 commit 261b836
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 @@ -52,8 +52,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 @@ -62,8 +70,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 261b836

Please sign in to comment.