aboutsummaryrefslogtreecommitdiff
path: root/html/display_panel
diff options
context:
space:
mode:
authorhackademix <giorgio@maone.net>2019-02-12 21:11:20 +0100
committerhackademix <giorgio@maone.net>2019-02-12 21:11:20 +0100
commit1f0ce1cd447770b981032152cf13276968350f0a (patch)
treebacc391d8986aa62c3a23dd1c4a66649bbd73ca2 /html/display_panel
parentf5c4a44831ebb6d40aa75060c400b9180f32f127 (diff)
UI: contextual view-source links for inline scripts and intrinsic events.
Diffstat (limited to 'html/display_panel')
-rw-r--r--html/display_panel/content/main_panel.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/html/display_panel/content/main_panel.js b/html/display_panel/content/main_panel.js
index 2509545..f662b35 100644
--- a/html/display_panel/content/main_panel.js
+++ b/html/display_panel/content/main_panel.js
@@ -111,11 +111,16 @@ function createList(data, group){
container.classList.add("empty");
}
// generate list
+ let viewSourceToHuman = /^view-source:(.*)#line(\d+)\(([^)]*)\)/;
for (let entry of entries) {
let [scriptId, reason] = entry;
let li = liTemplate.cloneNode(true);
let a = li.querySelector("a");
a.href = scriptId.split("(")[0];
+ if (scriptId.startsWith("view-source:")) {
+ a.target ="LibreJS-ViewSource";
+ scriptId = scriptId.replace(viewSourceToHuman, "$3 at line $2 of $1");
+ }
a.textContent = scriptId;
li.querySelector(".reason").textContent = reason;
let bySite = !!reason.match(/https?:\/\/[^/]+\/\*/);