From 26e4800ddf9b4384a083f066f2a396b8e5e6c079 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Tue, 1 Feb 2022 08:22:34 +0100 Subject: more improvements for abrowser&librewolf --- html/popup.html | 4 ++++ html/popup.js | 23 +++++++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) (limited to 'html') diff --git a/html/popup.html b/html/popup.html index bb30425..d0a6cb9 100644 --- a/html/popup.html +++ b/html/popup.html @@ -70,6 +70,10 @@ #info_form label+span, .top_but_container { padding-bottom: 0.5em; } + + #info_form .long_msg { + white-space: normal; + } diff --git a/html/popup.js b/html/popup.js index 532feba..ddc0f51 100644 --- a/html/popup.js +++ b/html/popup.js @@ -83,6 +83,8 @@ function show_page_info(page_info) { if (page_info.payload) { if ("error" in page_info) { + let long_msg = true; + if (page_info.error.haketilo_error_type === "missing") payload_text = `None (error: resource with id '${page_info.error.id}' missing from the database)`; else if (page_info.error.haketilo_error_type === "circular") @@ -91,6 +93,11 @@ function show_page_info(page_info) { payload_text = `None (error: failure reading Haketilo internal database)`; else if (page_info.error.haketilo_error_type === "other") payload_text = `None (error: unknown failure occured)`; + else + long_msg = false; + + if (long_msg) + by_id("injected_payload").classList.add("long_msg"); } else { payload_text = page_info.payload.identifier; } @@ -100,19 +107,23 @@ function show_page_info(page_info) { const scripts_fate = page_info.allow ? "allowed" : "blocked"; - let mapping_text; + let mapping_text, long_msg = true; - if (page_info.mapping === "~allow") + if (page_info.mapping === "~allow") { mapping_text = `None (scripts ${scripts_fate} by a rule)`; - else if ("error" in page_info - && page_info.error.haketilo_error_type ==="deciding_policy") + } else if ("error" in page_info && + page_info.error.haketilo_error_type === "deciding_policy") { mapping_text = `None (error occured when determining policy)`; - else if (page_info.mapping) + } else if (page_info.mapping) { mapping_text = page_info.mapping; - else + long_msg = false; + } else { mapping_text = `None (scripts ${scripts_fate} by default policy)`; + } by_id("mapping_used").innerText = mapping_text; + if (long_msg) + by_id("mapping_used").classList.add("long_msg"); } } -- cgit v1.2.3