Improve group highlighting in generated HTML output

Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
Clifford Wolf 2017-12-21 02:09:28 +01:00
parent b9ede7cab9
commit b510c6b96a
1 changed files with 9 additions and 3 deletions

View File

@ -293,6 +293,7 @@ for segtype in sorted(segbits.keys()):
var grp2bits = { }; var grp2bits = { };
var bit2grp = { } var bit2grp = { }
var highlight_bits = [ ]; var highlight_bits = [ ];
var highlight_cache = { };
function ome(bit) { function ome(bit) {
// console.log("ome: " + bit); // console.log("ome: " + bit);
@ -301,9 +302,12 @@ function ome(bit) {
for (i in grp2bits[grp]) { for (i in grp2bits[grp]) {
b = grp2bits[grp][i]; b = grp2bits[grp][i];
// console.log(" -> " + b); // console.log(" -> " + b);
el = document.getElementById("bit" + b); if (!(b in highlight_cache)) {
el.style.fontWeight = "bold"; el = document.getElementById("bit" + b);
highlight_bits.push(b); highlight_cache[b] = el.bgColor;
el.bgColor = "#ffffff"
highlight_bits.push(b);
}
} }
} }
} }
@ -313,6 +317,8 @@ function oml() {
for (i in highlight_bits) { for (i in highlight_bits) {
b = highlight_bits[i]; b = highlight_bits[i];
el = document.getElementById("bit" + b); el = document.getElementById("bit" + b);
el.bgColor = highlight_cache[b];
delete highlight_cache[b];
el.style.fontWeight = "normal"; el.style.fontWeight = "normal";
} }
highlight_bits.length = 0; highlight_bits.length = 0;