From 003876d507112ebe2575086514d5a388f78dedd9 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Tue, 8 Mar 2022 18:15:23 +0100 Subject: present appropriate error message when using popup in Private Browsing mode --- html/repo_query.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'html/repo_query.js') diff --git a/html/repo_query.js b/html/repo_query.js index 7cfd6fe..601a0aa 100644 --- a/html/repo_query.js +++ b/html/repo_query.js @@ -160,11 +160,20 @@ function RepoEntry(query_view, repo_url) { const container_ids = ["repos_list_container", "install_view_container"]; -function RepoQueryView(tab_id, on_view_show, on_view_hide) { +function RepoQueryView(tab, on_view_show, on_view_hide) { Showable.call(this, on_view_show, on_view_hide); Object.assign(this, clone_template("repo_query")); - this.tab_id = tab_id; + this.tab_id = tab.id; +#IF MOZILLA + this.incognito = tab.incognito; + if (this.incognito) { + [...this.top_text.childNodes].forEach(n => n.remove()); + this.top_text.append( + clone_template("repo_query_private_mode_error").main_span + ); + } +#ENDIF const show_container = name => { for (const cid of container_ids) { @@ -175,7 +184,7 @@ function RepoQueryView(tab_id, on_view_show, on_view_hide) { } this.install_view = new InstallView( - tab_id, + this.tab_id, () => show_container("install_view_container"), () => show_container("repos_list_container") ); @@ -186,6 +195,13 @@ function RepoQueryView(tab_id, on_view_show, on_view_hide) { if (!show_super()) return; +#IF MOZILLA + if (this.incognito) { + this.repo_entries = []; + return; + } +#ENDIF + this.url = url; this.url_span.innerText = url; -- cgit v1.2.3