Skip to content

Commit a130266

Browse files
committed
Merge pull request php-debugbar#218 from tonglil/lowercase-file-matching
Enable caseless searching in the "Files" toolbar
2 parents 1de37ab + d38a266 commit a130266

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/DebugBar/Resources/widgets.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,12 +318,19 @@ if (typeof(PhpDebugBar) == 'undefined') {
318318

319319
this.bindAttr(['exclude', 'search'], function() {
320320
var data = this.get('data'),
321-
exclude = this.get('exclude'),
321+
exclude = this.get('exclude'),
322322
search = this.get('search'),
323+
caseless = false,
323324
fdata = [];
324325

326+
if (search && search === search.toLowerCase()) {
327+
caseless = true;
328+
}
329+
325330
for (var i = 0; i < data.length; i++) {
326-
if ((!data[i].label || $.inArray(data[i].label, exclude) === -1) && (!search || data[i].message.indexOf(search) > -1)) {
331+
var message = caseless ? data[i].message.toLowerCase() : data[i].message;
332+
333+
if ((!data[i].label || $.inArray(data[i].label, exclude) === -1) && (!search || message.indexOf(search) > -1)) {
327334
fdata.push(data[i]);
328335
}
329336
}

0 commit comments

Comments
 (0)