From fd9bab82b4245193e2c7226993d84be1ae73ed90 Mon Sep 17 00:00:00 2001 From: Denys Fedoryshchenko Date: Wed, 1 May 2024 09:06:13 +0300 Subject: [PATCH] viewer.html: Adjust few features according feedback 1)Remove green line on click 2)Change sort order of kernels Signed-off-by: Denys Fedoryshchenko --- api/templates/viewer.html | 45 --------------------------------------- 1 file changed, 45 deletions(-) diff --git a/api/templates/viewer.html b/api/templates/viewer.html index dba7a8ba..754c724e 100644 --- a/api/templates/viewer.html +++ b/api/templates/viewer.html @@ -262,8 +262,6 @@ nodeinfohtml += ""; nodeinfo.innerHTML = nodeinfohtml; console.log(data); - // green line - getgreenline(); } }; request.onerror = function() { @@ -521,49 +519,6 @@ } } - function nodegreenline(lineNumber) { - // get nodeinfo div - var div = document.getElementById('nodeinfo'); - // make this line green - var lines = div.innerHTML.split("\n"); - // remove old green - for (var i = 0; i < lines.length; i++) { - if (lines[i].indexOf("background-color: #ccffcc") != -1) { - lines[i] = lines[i].replace("background-color: #ccffcc", ""); - } - } - var line = lines[lineNumber - 1]; - var linehtml = "" + line + ""; - lines[lineNumber - 1] = linehtml; - div.innerHTML = lines.join("\n"); - console.log("div.innerHTML: " + div.innerHTML); - } - - function getgreenline() { - // get url - var url = window.location.href; - // do we have #line=123 in the url? then highlight the line - if (url.indexOf("#line=") != -1) { - var line = url.split("#line=")[1]; - // convert to int - line = parseInt(line); - nodegreenline(line); - } - } - - // TODO: not very clean as doesnt remove span on re-click - function nodeclick(event) { - event.preventDefault(); - var div = document.getElementById('nodeinfo'); - var y = event.clientY - div.getBoundingClientRect().top; // Y position within the div - var lineHeight = parseInt(window.getComputedStyle(div).lineHeight); - var lineNumber = Math.floor(y / lineHeight) + 1; // Add 1 because lines are 1-indexed - nodegreenline(lineNumber); - // add to url the line number as #line=123 - var currenturl = window.location.href; - var newurl = currenturl.split("#")[0] + "#line=" + lineNumber; - window.history.pushState("", "", newurl); - } function onLoad() { // do we have a node id in the url?