diff --git a/.gitignore b/.gitignore index 97b30e70..fc2bd57b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ build local *.sublime-* + +test diff --git a/README.md b/README.md index d185c806..eb76137b 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ It profits from these great projects: * adds no JavaScript fallback to PHP version * fixes duplicate tree entries and empty main views * 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) * updates to [jQuery.qrcode](http://larsjung.de/qrcode/) 0.2 * updates to [jQuery.scrollpanel](http://larsjung.de/scrollpanel/) 0.1 diff --git a/src/_h5ai/config.js b/src/_h5ai/config.js index 5589798c..88e6dc61 100644 --- a/src/_h5ai/config.js +++ b/src/_h5ai/config.js @@ -84,7 +84,11 @@ var H5AI_CONFIG = { /* * 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:". */ "filter": { @@ -129,7 +133,7 @@ var H5AI_CONFIG = { * see: http://support.google.com/googleanalytics/bin/topic.py?hl=en&topic=27612 */ "google-analytics": { - "enabled": false, + "enabled": true, "gaq": [] }, diff --git a/src/_h5ai/js/inc/ext/filter.js b/src/_h5ai/js/inc/ext/filter.js index 2af67a7b..ec75b5ce 100644 --- a/src/_h5ai/js/inc/ext/filter.js +++ b/src/_h5ai/js/inc/ext/filter.js @@ -61,7 +61,6 @@ modulejs.define('ext/filter', ['_', '$', 'core/settings', 'core/resource'], func escapeRegExp = function (sequence) { return sequence.replace(/[\-\[\]{}()*+?.,\\$\^|#\s]/g, '\\$&'); - // return sequence.replace(/[|()\[{.+*?^$\\]/g,"\\$0"); }, parseFilterSequence = function (sequence) { @@ -72,10 +71,15 @@ modulejs.define('ext/filter', ['_', '$', 'core/settings', 'core/resource'], func 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('|'); - return new RegExp(sequence); + return new RegExp(sequence, 'i'); }, update = function () {