Skip to content
Permalink
Browse files

[VarDumper] implement expand all on ALT+click

  • Loading branch information...
larsborn authored and nicolas-grekas committed Mar 15, 2015
1 parent 37c137a commit 12c1febd11b7909c5c212406890c5a9aa65e8ccb
Showing with 35 additions and 1 deletion.
  1. +35 −1 src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php
@@ -119,7 +119,40 @@ protected function getDumpHeader()
doc.documentElement.firstChild.appendChild(refStyle);
function toggle(a) {
function expandAll(a) {
toggle(a, true);
var samp = a.nextSibling;
for (var i = 0; i < samp.children.length; i++) {
var child = samp.children[i];
if (child.tagName !== 'A') {
continue;
}
if (! /\bsf-dump-compact\b/.test(child.nextSibling.className)) {
continue
}
expandAll(child);
}
}
var altKeyPressed = false;
function keysPressed(e) {
if (e.keyCode === 18) {
altKeyPressed = true;
}
}
function keysReleased(e) {
if (e.keyCode === 18) {
altKeyPressed = false;
}
}
window.addEventListener('keydown', keysPressed, false);
window.addEventListener('keyup', keysReleased, false);
function toggle(a, ignoreAltKey) {
if (! ignoreAltKey && altKeyPressed) {
expandAll(a);
return true;
}
var s = a.nextSibling || {};
if ('sf-dump-compact' == s.className) {
@@ -210,6 +243,7 @@ function a(e, f) {
} else {
a.innerHTML += ' ';
}
a.title = 'hold ALT and click to expand all children';
a.innerHTML += '<span>▼</span>';
a.className += ' sf-dump-toggle';
if ('sf-dump' != elt.parentNode.className) {

0 comments on commit 12c1feb

Please sign in to comment.
You can’t perform that action at this time.