Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Improves filter. See readme and config.js.

  • Loading branch information...
commit 9e6c61251386e956e3f8c2365b54be94e54bb82b 1 parent eaf6ad3
@lrsjng authored
View
2  .gitignore
@@ -2,3 +2,5 @@
build
local
*.sublime-*
+
+test
View
1  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
View
8 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": []
},
View
10 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 () {
Please sign in to comment.
Something went wrong with that request. Please try again.