aboutsummaryrefslogtreecommitdiff
path: root/html/display_panel/content/main_panel.js
diff options
context:
space:
mode:
authorRuben Rodriguez <ruben@fsf.org>2019-04-29 17:55:18 -0400
committerRuben Rodriguez <ruben@fsf.org>2019-04-29 17:55:18 -0400
commitef4efa91207e1ad42b4a0bf1d54a14e5c1bea298 (patch)
tree5d67683fdf4f6e2de356bfcb6096820cd380b143 /html/display_panel/content/main_panel.js
parentc6fafeed2ace4abd083b8e33d0846987dc9333fc (diff)
parentb4ab7ef958d7d3d0761650b1404bf286d05f26cd (diff)
Merge branch 'master' of ssh://pagure.io/librejs
Diffstat (limited to 'html/display_panel/content/main_panel.js')
-rw-r--r--html/display_panel/content/main_panel.js29
1 files changed, 24 insertions, 5 deletions
diff --git a/html/display_panel/content/main_panel.js b/html/display_panel/content/main_panel.js
index 83c3a6b..b96143b 100644
--- a/html/display_panel/content/main_panel.js
+++ b/html/display_panel/content/main_panel.js
@@ -59,6 +59,7 @@ document.querySelector("#info").addEventListener("click", e => {
setTimeout(close, 100);
return;
}
+ if (button.tagName !== "BUTTON") button = button.closest("button");
if (button.matches(".toggle-source")) {
let parent = button.parentNode;
if (!parent.querySelector(".source").textContent) {
@@ -69,10 +70,13 @@ document.querySelector("#info").addEventListener("click", e => {
return;
}
if (!button.matches(".buttons > button")) return;
+ let domain = button.querySelector(".domain");
+
let li = button.closest("li");
let entry = li && li._scriptEntry || [currentReport.url, "Page's site"];
let action = button.className;
- let site = button.name === "*";
+ let site = domain ? domain.textContent : button.name === "*" ? currentReport.site : "";
+
if (site) {
([action] = action.split("-"));
}
@@ -94,13 +98,14 @@ document.querySelector("#open-options").onclick = e => {
close();
}
-document.querySelector("#reload").onclick = async e => {
+document.body.addEventListener("click", async e => {
+ if (!e.target.matches(".reload")) return;
let {tabId} = currentReport;
if (tabId) {
await browser.tabs.reload(tabId);
myPort.postMessage({"update": true, tabId});
}
-};
+});
/*
* Takes in the [[file_id, reason],...] array and the group name for one group
@@ -169,8 +174,8 @@ function createList(data, group){
*/
function refreshUI(report) {
currentReport = report;
-
- document.querySelector("#site").className = report.siteStatus || "";
+ let {siteStatus, listedSite} = report;
+ document.querySelector("#site").className = siteStatus || "";
document.querySelector("#site h2").textContent =
`This site ${report.site}`;
@@ -194,6 +199,20 @@ function refreshUI(report) {
b.disabled = true;
}
+ if (siteStatus && siteStatus !== "unknown") {
+ let siteContainer = document.querySelector("#site");
+ let statusLabel = siteStatus;
+ if (listedSite && listedSite !== report.site) {
+ statusLabel += ` via ${listedSite}`;
+ siteContainer.querySelector(".forget").disabled = true;
+ }
+ let status = siteContainer.querySelector(".status");
+ status.classList.add(siteStatus);
+ status.textContent = statusLabel;
+ } else {
+ document.querySelector("#site .status").textContent = "";
+ }
+
let noscript = scriptsCount === 0;
document.body.classList.toggle("empty", noscript);
}