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/popup.js | 6 +++--- html/repo_query.html | 11 +++++++++-- html/repo_query.js | 22 +++++++++++++++++++--- test/haketilo_test/unit/test_repo_query.py | 16 +++++++++++----- 4 files changed, 42 insertions(+), 13 deletions(-) diff --git a/html/popup.js b/html/popup.js index 5a5db6c..52df3ae 100644 --- a/html/popup.js +++ b/html/popup.js @@ -132,8 +132,8 @@ function repo_query_showing(show) { by_id(`${id}_container`).classList[["add", "remove"][show ^ i]]("hide"); } -function prepare_repo_query_view(tab_id, page_info) { - const repo_query_view = new RepoQueryView(tab_id, +function prepare_repo_query_view(tab, page_info) { + const repo_query_view = new RepoQueryView(tab, () => repo_query_showing(true), () => repo_query_showing(false)); by_id("repo_query_container").prepend(repo_query_view.main_div); @@ -163,7 +163,7 @@ async function main() { if (page_info) { show_page_info(page_info); if (!page_info.privileged) - prepare_repo_query_view(tab_id, page_info); + prepare_repo_query_view(tab, page_info); } else { by_id("loading_info").innerText = "Page info not avaialable. Try reloading the page."; diff --git a/html/repo_query.html b/html/repo_query.html index 67158cc..8692c3b 100644 --- a/html/repo_query.html +++ b/html/repo_query.html @@ -105,9 +105,16 @@ }