Skip to content

Commit 83eabbf

Browse files
Highlight selectors that don`t belong to selected data
1 parent a870d7c commit 83eabbf

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

index.html

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
--selector-active-text-color: black;
2424
--selector-background-color: #EEE;
2525
--selector-active-background-color: #FFCB80;
26+
--selector-passive-background-color: #EEDDCC;
2627
--selector-hover-text-color: black;
2728
--selector-hover-background-color: #FDB;
2829

@@ -54,6 +55,7 @@
5455
--selector-background-color: #444;
5556
--selector-active-text-color: white;
5657
--selector-active-background-color: #088;
58+
--selector-passive-background-color: #566;
5759
--selector-hover-text-color: black;
5860
--selector-hover-background-color: white;
5961

@@ -128,6 +130,11 @@
128130
background: var(--selector-active-background-color);
129131
}
130132

133+
.selector-passive {
134+
color: var(--selector-active-text-color);
135+
background: var(--selector-passive-background-color);
136+
}
137+
131138
a, a:visited {
132139
text-decoration: none;
133140
color: var(--link-color);
@@ -143,7 +150,7 @@
143150
background: var(--selector-background-color);
144151
}
145152

146-
.selector-active:hover {
153+
.selector-active:hover, .selector-passive:hover {
147154
background: var(--selector-hover-background-color);
148155
}
149156

@@ -630,6 +637,25 @@ <h2>Detailed Comparison</h2>
630637
document.getElementById('selector-tuned-no').className = selectors.tuned.no ? 'selector selector-active' : 'selector';
631638
}
632639

640+
function findPassiveSelectors(filtered_data) {
641+
function process(name, container) {
642+
const filtered = new Set(filtered_data.map(elem => elem[name]).flat().map(x => String(x)));
643+
for (let elem of container.childNodes) {
644+
if (elem.tagName == 'A') {
645+
if (elem.classList.contains('selector-active') && !filtered.has(elem.innerText)) {
646+
elem.className = 'selector selector-passive';
647+
} else if (elem.classList.contains('selector-passive') && filtered.has(elem.innerText)) {
648+
elem.className = 'selector selector-active';
649+
}
650+
}
651+
}
652+
}
653+
process('system', systems);
654+
process('tags', types);
655+
process('machine', machines);
656+
process('cluster_size', cluster_sizes);
657+
}
658+
633659
function clearElement(elem)
634660
{
635661
while (elem.firstChild) {
@@ -958,7 +984,6 @@ <h2>Detailed Comparison</h2>
958984
sorted_indices.map(idx => {
959985
const curr_size = filtered_data[idx].data_size;
960986
const baseline_size = Math.min(...filtered_data.map(elem => elem.data_size).filter(x => x));
961-
console.log(baseline_size);
962987
const ratio = curr_size !== null ? curr_size / baseline_size : null;
963988

964989
let td = document.createElement('td');
@@ -1016,6 +1041,8 @@ <h2>Detailed Comparison</h2>
10161041

10171042
details_body.appendChild(tr);
10181043
}
1044+
1045+
findPassiveSelectors(filtered_data);
10191046
}
10201047

10211048
function isSubsequence(str, subseq) {
@@ -1116,8 +1143,8 @@ <h2>Detailed Comparison</h2>
11161143
if (!selectors.tuned) {
11171144
selectors.tuned = {"no": true, "yes": false};
11181145
}
1119-
render();
11201146
updateSelectors();
1147+
render();
11211148
};
11221149

11231150
if (window.location.hash) {
@@ -1132,8 +1159,8 @@ <h2>Detailed Comparison</h2>
11321159
} catch {}
11331160
}
11341161

1135-
render();
11361162
updateSelectors();
1163+
render();
11371164

11381165
</script>
11391166
</body>

0 commit comments

Comments
 (0)