Improves filter. See readme and config.js.

This commit is contained in:
Lars Jung 2012-08-03 00:03:27 +02:00
parent eaf6ad3fcb
commit 9e6c612513
4 changed files with 16 additions and 5 deletions

2
.gitignore vendored
View file

@ -2,3 +2,5 @@
build build
local local
*.sublime-* *.sublime-*
test

View file

@ -35,6 +35,7 @@ It profits from these great projects:
* adds no JavaScript fallback to PHP version * adds no JavaScript fallback to PHP version
* fixes duplicate tree entries and empty main views * fixes duplicate tree entries and empty main views
* adds Google Analytics support (async) * adds Google Analytics support (async)
* improves filter (now case-insensitive, now only checks if chars in right order)
* adds `hu` translation by [Rodolffo](http://github.com/Rodolffo) * adds `hu` translation by [Rodolffo](http://github.com/Rodolffo)
* updates to [jQuery.qrcode](http://larsjung.de/qrcode/) 0.2 * updates to [jQuery.qrcode](http://larsjung.de/qrcode/) 0.2
* updates to [jQuery.scrollpanel](http://larsjung.de/scrollpanel/) 0.1 * updates to [jQuery.scrollpanel](http://larsjung.de/scrollpanel/) 0.1

View file

@ -84,7 +84,11 @@ var H5AI_CONFIG = {
/* /*
* Allow filtering the displayed files and folders. * Allow filtering the displayed files and folders.
* Note: filters will be treated as JavaScript regular expressions * Will check entries for right order of characters, i.e.
* "ab" matches "ab", "axb", "xaxbx" but not "ba".
* Space separated sequences get OR-ed.
*
* Filters will be treated as JavaScript regular expressions
* if you prefix them with "re:". * if you prefix them with "re:".
*/ */
"filter": { "filter": {
@ -129,7 +133,7 @@ var H5AI_CONFIG = {
* see: http://support.google.com/googleanalytics/bin/topic.py?hl=en&topic=27612 * see: http://support.google.com/googleanalytics/bin/topic.py?hl=en&topic=27612
*/ */
"google-analytics": { "google-analytics": {
"enabled": false, "enabled": true,
"gaq": [] "gaq": []
}, },

View file

@ -61,7 +61,6 @@ modulejs.define('ext/filter', ['_', '$', 'core/settings', 'core/resource'], func
escapeRegExp = function (sequence) { escapeRegExp = function (sequence) {
return sequence.replace(/[\-\[\]{}()*+?.,\\$\^|#\s]/g, '\\$&'); return sequence.replace(/[\-\[\]{}()*+?.,\\$\^|#\s]/g, '\\$&');
// return sequence.replace(/[|()\[{.+*?^$\\]/g,"\\$0");
}, },
parseFilterSequence = function (sequence) { parseFilterSequence = function (sequence) {
@ -72,10 +71,15 @@ modulejs.define('ext/filter', ['_', '$', 'core/settings', 'core/resource'], func
sequence = $.map($.trim(sequence).split(/\s+/), function (part) { sequence = $.map($.trim(sequence).split(/\s+/), function (part) {
return escapeRegExp(part); return _.map(part.split(''), function (char) {
return escapeRegExp(char);
}).join('.*?');
// return escapeRegExp(part);
}).join('|'); }).join('|');
return new RegExp(sequence); return new RegExp(sequence, 'i');
}, },
update = function () { update = function () {