mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Filter: Clean & escape language settings. See #1505
This commit is contained in:
parent
08a9089718
commit
df1afccdda
@ -367,7 +367,12 @@
|
||||
|
||||
var options, string, txt, $header, column, val, fxn, noSelect,
|
||||
c = table.config,
|
||||
wo = c.widgetOptions;
|
||||
wo = c.widgetOptions,
|
||||
escRegExp = function(prefix, str, suffix) {
|
||||
str = str.trim().replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
// don't include prefix/suffix if str is empty
|
||||
return str === '' ? '' : (prefix || '') + str + (suffix || '');
|
||||
};
|
||||
c.$table.addClass( 'hasFilters' );
|
||||
c.lastSearch = [];
|
||||
|
||||
@ -383,13 +388,13 @@
|
||||
$.extend( tsfRegex, {
|
||||
child : new RegExp( c.cssChildRow ),
|
||||
filtered : new RegExp( wo.filter_filteredRow ),
|
||||
alreadyFiltered : new RegExp( '(\\s+(' + ts.language.or + '|-|' + ts.language.to + ')\\s+)', 'i' ),
|
||||
toTest : new RegExp( '\\s+(-|' + ts.language.to + ')\\s+', 'i' ),
|
||||
toSplit : new RegExp( '(?:\\s+(?:-|' + ts.language.to + ')\\s+)', 'gi' ),
|
||||
andTest : new RegExp( '\\s+(' + ts.language.and + '|&&)\\s+', 'i' ),
|
||||
andSplit : new RegExp( '(?:\\s+(?:' + ts.language.and + '|&&)\\s+)', 'gi' ),
|
||||
orTest : new RegExp( '(\\||\\s+' + ts.language.or + '\\s+)', 'i' ),
|
||||
orSplit : new RegExp( '(?:\\s+(?:' + ts.language.or + ')\\s+|\\|)', 'gi' ),
|
||||
alreadyFiltered : new RegExp( '(\\s+(-' + escRegExp('|', ts.language.or) + escRegExp('|', ts.language.to) + ')\\s+)', 'i' ),
|
||||
toTest : new RegExp( '\\s+(-' + escRegExp('|', ts.language.to) + ')\\s+', 'i' ),
|
||||
toSplit : new RegExp( '(?:\\s+(?:-' + escRegExp('|', ts.language.to) + ')\\s+)', 'gi' ),
|
||||
andTest : new RegExp( '\\s+(' + escRegExp('', ts.language.and, '|') + '&&)\\s+', 'i' ),
|
||||
andSplit : new RegExp( '(?:\\s+(?:' + escRegExp('', ts.language.and, '|') + '&&)\\s+)', 'gi' ),
|
||||
orTest : new RegExp( '(\\|' + escRegExp('|\\s+', ts.language.or, '\\s+') + ')', 'i' ),
|
||||
orSplit : new RegExp( '(?:\\|' + escRegExp('|\\s+(?:', ts.language.or, ')\\s+') + ')', 'gi' ),
|
||||
iQuery : new RegExp( val, 'i' ),
|
||||
igQuery : new RegExp( val, 'ig' ),
|
||||
operTest : /^[<>]=?/,
|
||||
|
Loading…
Reference in New Issue
Block a user