Skip to content

Commit

Permalink
Dumper: hash highlighting on mouseover
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Apr 13, 2020
1 parent 13cfb6d commit 8ec7417
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Tracy/Bar/assets/bar.css
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,14 @@ body#tracy-debug .tracy-panel { /* in popup window */
display: none;
}

#tracy-debug .tracy-dump-highlight {
background: #C22;
color: white;
border-radius: 2px;
padding: 0 2px;
margin: 0 -2px;
}


/* toggle */
#tracy-debug .tracy-toggle:after {
Expand Down
8 changes: 8 additions & 0 deletions src/Tracy/Dumper/assets/dumper.css
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ pre.tracy-dump a:focus {
display: none;
}

.tracy-dump-highlight {
background: #C22;
color: white;
border-radius: 2px;
padding: 0 2px;
margin: 0 -2px;
}

span[data-tracy-href] {
border-bottom: 1px dotted rgba(0, 0, 0, .2);
}
Expand Down
19 changes: 19 additions & 0 deletions src/Tracy/Dumper/assets/dumper.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,25 @@
}
});

document.addEventListener('mouseover', (e) => {
let dump;
if (e.target.matches('.tracy-dump-hash') && (dump = e.target.closest('.tracy-dump'))) {
dump.querySelectorAll('.tracy-dump-hash').forEach((el) => {
if (el.textContent === e.target.textContent) {
el.classList.add('tracy-dump-highlight');
}
});
}
});

document.addEventListener('mouseout', (e) => {
if (e.target.matches('.tracy-dump-hash')) {
document.querySelectorAll('.tracy-dump-hash.tracy-dump-highlight').forEach((el) => {
el.classList.remove('tracy-dump-highlight');
});
}
});

Tracy.Toggle.init();
}
}
Expand Down

0 comments on commit 8ec7417

Please sign in to comment.