border-radius: 8px;
background: hsl(216deg 50% 60%);
}
+
+ &::highlight(yellow) {
+ background-color: yellow;
+ }
}
svg {
inline-size: 20px;
vertical-align: middle;
margin-inline-start: 4px;
+ cursor: pointer;
}
</style>
</head>
}
}
+ function highlightAddress(tree, address) {
+ const highlight = new Highlight();
+ for (const e of [...tree.querySelectorAll('*')]) {
+ if (e.tagName !== 'LI' || e.textContent.substring(0, 42) !== address) {
+ continue;
+ }
+ const textNode = e.childNodes[0];
+ const range = new Range();
+ range.setStart(textNode, 0);
+ range.setEnd(textNode, 42);
+ highlight.add(range);
+ }
+ CSS.highlights.set('yellow', highlight);
+ }
+
form.addEventListener('submit', async e => {
e.preventDefault();
tree.innerHTML = '';
allAddresses.length = 0;
await insertTreeNode(tree, safe.replace(/^.+:/, '').toLowerCase(), rpc);
+ document.querySelectorAll('svg').forEach(svg => {
+ svg.addEventListener('mouseover', e => highlightAddress(tree, svg.closest('li').textContent.substring(0, 42)));
+ svg.addEventListener('mouseout', e => CSS.highlights.clear());
+ });
e.target.removeAttribute('data-loading');
});