mirror of
https://github.com/Mottie/tablesorter.git
synced 2025-01-12 15:24:21 +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,
|
var options, string, txt, $header, column, val, fxn, noSelect,
|
||||||
c = table.config,
|
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.$table.addClass( 'hasFilters' );
|
||||||
c.lastSearch = [];
|
c.lastSearch = [];
|
||||||
|
|
||||||
@ -383,13 +388,13 @@
|
|||||||
$.extend( tsfRegex, {
|
$.extend( tsfRegex, {
|
||||||
child : new RegExp( c.cssChildRow ),
|
child : new RegExp( c.cssChildRow ),
|
||||||
filtered : new RegExp( wo.filter_filteredRow ),
|
filtered : new RegExp( wo.filter_filteredRow ),
|
||||||
alreadyFiltered : new RegExp( '(\\s+(' + ts.language.or + '|-|' + ts.language.to + ')\\s+)', 'i' ),
|
alreadyFiltered : new RegExp( '(\\s+(-' + escRegExp('|', ts.language.or) + escRegExp('|', ts.language.to) + ')\\s+)', 'i' ),
|
||||||
toTest : new RegExp( '\\s+(-|' + ts.language.to + ')\\s+', 'i' ),
|
toTest : new RegExp( '\\s+(-' + escRegExp('|', ts.language.to) + ')\\s+', 'i' ),
|
||||||
toSplit : new RegExp( '(?:\\s+(?:-|' + ts.language.to + ')\\s+)', 'gi' ),
|
toSplit : new RegExp( '(?:\\s+(?:-' + escRegExp('|', ts.language.to) + ')\\s+)', 'gi' ),
|
||||||
andTest : new RegExp( '\\s+(' + ts.language.and + '|&&)\\s+', 'i' ),
|
andTest : new RegExp( '\\s+(' + escRegExp('', ts.language.and, '|') + '&&)\\s+', 'i' ),
|
||||||
andSplit : new RegExp( '(?:\\s+(?:' + ts.language.and + '|&&)\\s+)', 'gi' ),
|
andSplit : new RegExp( '(?:\\s+(?:' + escRegExp('', ts.language.and, '|') + '&&)\\s+)', 'gi' ),
|
||||||
orTest : new RegExp( '(\\||\\s+' + ts.language.or + '\\s+)', 'i' ),
|
orTest : new RegExp( '(\\|' + escRegExp('|\\s+', ts.language.or, '\\s+') + ')', 'i' ),
|
||||||
orSplit : new RegExp( '(?:\\s+(?:' + ts.language.or + ')\\s+|\\|)', 'gi' ),
|
orSplit : new RegExp( '(?:\\|' + escRegExp('|\\s+(?:', ts.language.or, ')\\s+') + ')', 'gi' ),
|
||||||
iQuery : new RegExp( val, 'i' ),
|
iQuery : new RegExp( val, 'i' ),
|
||||||
igQuery : new RegExp( val, 'ig' ),
|
igQuery : new RegExp( val, 'ig' ),
|
||||||
operTest : /^[<>]=?/,
|
operTest : /^[<>]=?/,
|
||||||
|
Loading…
Reference in New Issue
Block a user