mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-31 15:28:19 -04:00
Improves filter. See readme and config.js.
This commit is contained in:
parent
eaf6ad3fcb
commit
9e6c612513
4 changed files with 16 additions and 5 deletions
|
@ -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": []
|
||||
},
|
||||
|
||||
|
|
|
@ -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 () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue