Skip to content

Commit

Permalink
bar: replaced attribute 'rel' with 'data-tracy-action' for closing & …
Browse files Browse the repository at this point in the history
…open-to-window links
  • Loading branch information
dg committed Apr 8, 2019
1 parent 843c47c commit bca664d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/Tracy/Bar/assets/bar.js
Expand Up @@ -62,9 +62,9 @@


elem.querySelectorAll('.tracy-icons a').forEach((link) => { elem.querySelectorAll('.tracy-icons a').forEach((link) => {
link.addEventListener('click', (e) => { link.addEventListener('click', (e) => {
if (link.rel === 'close') { if (link.dataset.tracyAction === 'close') {
this.toPeek(); this.toPeek();
} else if (link.rel === 'window') { } else if (link.dataset.tracyAction === 'window') {
this.toWindow(); this.toWindow();
} }
e.preventDefault(); e.preventDefault();
Expand Down Expand Up @@ -258,7 +258,7 @@
initTabs(elem) { initTabs(elem) {
elem.querySelectorAll('a').forEach((link) => { elem.querySelectorAll('a').forEach((link) => {
link.addEventListener('click', (e) => { link.addEventListener('click', (e) => {
if (link.rel === 'close') { if (link.dataset.tracyAction === 'close') {
this.close(); this.close();


} else if (link.rel) { } else if (link.rel) {
Expand All @@ -284,7 +284,7 @@
}); });


link.addEventListener('mouseenter', (e) => { link.addEventListener('mouseenter', (e) => {
if (e.buttons || !link.rel || link.rel === 'close' || elem.classList.contains('tracy-dragged')) { if (e.buttons || !link.rel || elem.classList.contains('tracy-dragged')) {
return; return;
} }


Expand All @@ -311,7 +311,7 @@
link.addEventListener('mouseleave', () => { link.addEventListener('mouseleave', () => {
clearTimeout(this.displayTimeout); clearTimeout(this.displayTimeout);


if (link.rel && link.rel !== 'close' && !elem.classList.contains('tracy-dragged')) { if (link.rel && !elem.classList.contains('tracy-dragged')) {
Debug.panels[link.rel].blur(); Debug.panels[link.rel].blur();
} }
}); });
Expand Down
2 changes: 1 addition & 1 deletion src/Tracy/Bar/assets/bar.phtml
Expand Up @@ -32,6 +32,6 @@ namespace Tracy;
<?php } endforeach ?> <?php } endforeach ?>


<?php if ($type === 'main'): ?> <?php if ($type === 'main'): ?>
<li><a href="#" rel="close" title="close debug bar">&times;</a></li> <li><a href="#" data-tracy-action="close" title="close debug bar">&times;</a></li>
<?php endif ?> <?php endif ?>
</ul> </ul>
4 changes: 2 additions & 2 deletions src/Tracy/Bar/assets/panels.phtml
Expand Up @@ -18,8 +18,8 @@ use Tracy\Helpers;


$icons = ' $icons = '
<div class="tracy-icons"> <div class="tracy-icons">
<a href="#" rel="window" title="open in window">&curren;</a> <a href="#" data-tracy-action="window" title="open in window">&curren;</a>
<a href="#" rel="close" title="close window">&times;</a> <a href="#" data-tracy-action="close" title="close window">&times;</a>
</div> </div>
'; ';


Expand Down
4 changes: 2 additions & 2 deletions tests/Tracy/expected/Debugger.barDump().expect
Expand Up @@ -17,6 +17,6 @@ in file %a% on line %d%" data-tracy-href="editor:%a%"><span class="tracy-dump-st




<div class="tracy-icons"> <div class="tracy-icons">
<a href="#" rel="window" title="open in window">&curren;</a> <a href="#" data-tracy-action="window" title="open in window">&curren;</a>
<a href="#" rel="close" title="close window">&times;</a> <a href="#" data-tracy-action="close" title="close window">&times;</a>
</div> </div>

0 comments on commit bca664d

Please sign in to comment.