Skip to content

Commit b49e46a

Browse files
s4muelbarryvdh
authored andcommitted
truncate the filename part in the dataset title if its too long (php-debugbar#391)
fixes php-debugbar#386 i had the same issue, very annoying indeed. firefox doesn't crash. i tried to disable the hardware acceleration in chrome, seemed promising, but did't solve that. i suppose this PR is not the quality for a permanent fix (sorry for that), but i hope someone more skilled can improve the PR.
1 parent 4048ff4 commit b49e46a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/DebugBar/Resources/debugbar.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,13 @@ if (typeof(PhpDebugBar) == 'undefined') {
379379
} else {
380380
filename = uri.substr(uri.lastIndexOf('/') + 1);
381381
}
382+
383+
// truncate the filename in the label, if it's too long
384+
var maxLength = 150;
385+
if (filename.length > maxLength) {
386+
filename = filename.substr(0, maxLength) + '...';
387+
}
388+
382389
var label = "#" + nb + " " + filename + suffix + ' (' + data['__meta']['datetime'].split(' ')[1] + ')';
383390
return label;
384391
}

0 commit comments

Comments
 (0)