From b849b8d461479cf6530c77b97b094807840ce0d7 Mon Sep 17 00:00:00 2001
From: Yuchen Pei <hi@ypei.me>
Date: Wed, 12 Oct 2022 19:11:20 +1100
Subject: adding force display noscript.

---
 html/display_panel/content/display-panel.html |  1 +
 html/display_panel/content/main_panel.js      | 13 ++++++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

(limited to 'html/display_panel')

diff --git a/html/display_panel/content/display-panel.html b/html/display_panel/content/display-panel.html
index 7d1fdf5..5d99e19 100644
--- a/html/display_panel/content/display-panel.html
+++ b/html/display_panel/content/display-panel.html
@@ -53,6 +53,7 @@
           </div>
           <button id="complain">Complain to site owner</button>
          	<button id="report-tab">Show this report in a new tab</button>
+         	<button id="force-noscript">Force display noscript</button>
           <button id="open-options">Settings...</button>
           <button id="autotest">Automated self test...</button>
         </div>
diff --git a/html/display_panel/content/main_panel.js b/html/display_panel/content/main_panel.js
index 7a5e2c3..dc3ee2d 100644
--- a/html/display_panel/content/main_panel.js
+++ b/html/display_panel/content/main_panel.js
@@ -83,17 +83,24 @@ document.querySelector("#info").addEventListener("click", e => {
   myPort.postMessage({ [action]: entry, site, tabId: currentReport.tabId });
 });
 
-document.querySelector("#report-tab").onclick = e => {
+document.querySelector("#report-tab").onclick = _ => {
   myPort.postMessage({ report_tab: currentReport });
   close();
 }
 
-document.querySelector("#complain").onclick = e => {
+document.querySelector("#complain").onclick = _ => {
   myPort.postMessage({ invoke_contact_finder: currentReport });
   close();
 }
 
-document.querySelector("#open-options").onclick = e => {
+document.querySelector("#force-noscript").onclick = async _ => {
+  await browser.tabs.sendMessage(currentReport.tabId, {
+    action: 'forceNoscript'
+  });
+  document.querySelector("#force-noscript").disabled = true;
+}
+
+document.querySelector("#open-options").onclick = _ => {
   browser.runtime.openOptionsPage();
   close();
 }
-- 
cgit v1.2.3