jquery-tablesorter 1.10.2 → 1.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.markdown +6 -3
- data/Rakefile +30 -16
- data/lib/jquery-tablesorter/version.rb +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/extras/jquery.quicksearch.js +191 -0
- data/vendor/assets/javascripts/jquery-tablesorter/extras/semver-mod.js +1026 -0
- data/vendor/assets/javascripts/jquery-tablesorter/extras/semver.js +1011 -0
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.js +2 -2
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-iso8601.js +34 -0
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-month.js +33 -0
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-two-digit-year.js +74 -0
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-weekday.js +33 -0
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date.js +36 -0
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-feet-inch-fraction.js +63 -0
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-file-type.js +73 -0
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-ignore-articles.js +47 -0
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-input-select.js +86 -0
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-ipv6.js +76 -0
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-metric.js +77 -0
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-build-table.js +441 -0
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-columnSelector.js +291 -0
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-cssStickyHeaders.js +67 -0
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-editable.js +89 -0
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-grouping.js +183 -0
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-pager.js +834 -0
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-repeatheaders.js +50 -0
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-scroller.js +241 -0
- metadata +24 -2
@@ -1,5 +1,5 @@
|
|
1
1
|
/**!
|
2
|
-
* TableSorter 2.15.
|
2
|
+
* TableSorter 2.15.5 - Client-side table sorting with ease!
|
3
3
|
* @requires jQuery v1.2.6+
|
4
4
|
*
|
5
5
|
* Copyright (c) 2007 Christian Bach
|
@@ -24,7 +24,7 @@
|
|
24
24
|
|
25
25
|
var ts = this;
|
26
26
|
|
27
|
-
ts.version = "2.15.
|
27
|
+
ts.version = "2.15.5";
|
28
28
|
|
29
29
|
ts.parsers = [];
|
30
30
|
ts.widgets = [];
|
@@ -0,0 +1,34 @@
|
|
1
|
+
/*! ISO-8601 date parser
|
2
|
+
* This parser will work with dates in ISO8601 format
|
3
|
+
* 2013-02-18T18:18:44+00:00
|
4
|
+
* Written by Sean Ellingham :https://github.com/seanellingham
|
5
|
+
* See https://github.com/Mottie/tablesorter/issues/247
|
6
|
+
*/
|
7
|
+
/*global jQuery: false */
|
8
|
+
;(function($){
|
9
|
+
"use strict";
|
10
|
+
|
11
|
+
var iso8601date = /^([0-9]{4})(-([0-9]{2})(-([0-9]{2})(T([0-9]{2}):([0-9]{2})(:([0-9]{2})(\.([0-9]+))?)?(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?$/;
|
12
|
+
$.tablesorter.addParser({
|
13
|
+
id : 'iso8601date',
|
14
|
+
is : function(s) {
|
15
|
+
return s.match(iso8601date);
|
16
|
+
},
|
17
|
+
format : function(s) {
|
18
|
+
var result = s.match(iso8601date);
|
19
|
+
if (result) {
|
20
|
+
var date = new Date(result[1], 0, 1);
|
21
|
+
if (result[3]) { date.setMonth(result[3] - 1); }
|
22
|
+
if (result[5]) { date.setDate(result[5]); }
|
23
|
+
if (result[7]) { date.setHours(result[7]); }
|
24
|
+
if (result[8]) { date.setMinutes(result[8]); }
|
25
|
+
if (result[10]) { date.setSeconds(result[10]); }
|
26
|
+
if (result[12]) { date.setMilliseconds(Number('0.' + result[12]) * 1000); }
|
27
|
+
return date;
|
28
|
+
}
|
29
|
+
return 0;
|
30
|
+
},
|
31
|
+
type : 'numeric'
|
32
|
+
});
|
33
|
+
|
34
|
+
})(jQuery);
|
@@ -0,0 +1,33 @@
|
|
1
|
+
/*! Month parser
|
2
|
+
* Demo: http://jsfiddle.net/Mottie/abkNM/477/
|
3
|
+
*/
|
4
|
+
/*jshint jquery:true */
|
5
|
+
;(function($){
|
6
|
+
"use strict";
|
7
|
+
|
8
|
+
var ts = $.tablesorter;
|
9
|
+
ts.dates = $.extend({}, ts.dates, {
|
10
|
+
// *** modify this array to change match the language ***
|
11
|
+
monthCased : [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ]
|
12
|
+
});
|
13
|
+
ts.dates.monthLower = ts.dates.monthCased.join(',').toLocaleLowerCase().split(',');
|
14
|
+
|
15
|
+
ts.addParser({
|
16
|
+
id: "month",
|
17
|
+
is: function(){
|
18
|
+
return false;
|
19
|
+
},
|
20
|
+
format: function(s, table) {
|
21
|
+
var j = -1, c = table.config;
|
22
|
+
s = c.ignoreCase ? s.toLocaleLowerCase() : s;
|
23
|
+
$.each(ts.dates[ 'month' + (c.ignoreCase ? 'Lower' : 'Cased') ], function(i,v){
|
24
|
+
if (j < 0 && s.match(v)) { j = i; }
|
25
|
+
});
|
26
|
+
// return s (original string) if there isn't a match
|
27
|
+
// (non-weekdays will sort separately and empty cells will sort as expected)
|
28
|
+
return j < 0 ? s : j;
|
29
|
+
},
|
30
|
+
type: "numeric"
|
31
|
+
});
|
32
|
+
|
33
|
+
})(jQuery);
|
@@ -0,0 +1,74 @@
|
|
1
|
+
/*! Two digit year parser
|
2
|
+
* Demo: http://jsfiddle.net/Mottie/abkNM/427/
|
3
|
+
*/
|
4
|
+
/*jshint jquery:true */
|
5
|
+
;(function($){
|
6
|
+
"use strict";
|
7
|
+
|
8
|
+
var ts = $.tablesorter,
|
9
|
+
|
10
|
+
// Make the date be within +/- range of the 2 digit year
|
11
|
+
// so if the current year is 2020, and the 2 digit year is 80 (2080 - 2020 > 50), it becomes 1980
|
12
|
+
// if the 2 digit year is 50 (2050 - 2020 < 50), then it becomes 2050.
|
13
|
+
range = 50;
|
14
|
+
|
15
|
+
ts.dates = $.extend({}, ts.dates, {
|
16
|
+
regxxxxyy: /(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{2})/,
|
17
|
+
regyyxxxx: /(\d{2})[\/\s](\d{1,2})[\/\s](\d{1,2})/
|
18
|
+
});
|
19
|
+
|
20
|
+
ts.formatDate = function(s, regex, format, table){
|
21
|
+
s = s
|
22
|
+
// replace separators
|
23
|
+
.replace(/\s+/g," ").replace(/[-.,]/g, "/")
|
24
|
+
// reformat xx/xx/xx to mm/dd/19yy;
|
25
|
+
.replace(regex, format);
|
26
|
+
var d = new Date(s),
|
27
|
+
y = d.getFullYear(),
|
28
|
+
rng = table && table.config.dateRange || range,
|
29
|
+
now = new Date().getFullYear();
|
30
|
+
// if date > 50 years old (set range), add 100 years
|
31
|
+
// this will work when people start using "50" and mean "2050"
|
32
|
+
while (now - y > rng) {
|
33
|
+
y += 100;
|
34
|
+
}
|
35
|
+
return d.setFullYear(y);
|
36
|
+
};
|
37
|
+
|
38
|
+
$.tablesorter.addParser({
|
39
|
+
id: "ddmmyy",
|
40
|
+
is: function() {
|
41
|
+
return false;
|
42
|
+
},
|
43
|
+
format: function(s, table) {
|
44
|
+
// reformat dd/mm/yy to mm/dd/19yy;
|
45
|
+
return ts.formatDate(s, ts.dates.regxxxxyy, "$2/$1/19$3", table);
|
46
|
+
},
|
47
|
+
type: "numeric"
|
48
|
+
});
|
49
|
+
|
50
|
+
$.tablesorter.addParser({
|
51
|
+
id: "mmddyy",
|
52
|
+
is: function() {
|
53
|
+
return false;
|
54
|
+
},
|
55
|
+
format: function(s, table) {
|
56
|
+
// reformat mm/dd/yy to mm/dd/19yy
|
57
|
+
return ts.formatDate(s, ts.dates.regxxxxyy, "$1/$2/19$3", table);
|
58
|
+
},
|
59
|
+
type: "numeric"
|
60
|
+
});
|
61
|
+
|
62
|
+
$.tablesorter.addParser({
|
63
|
+
id: "yymmdd",
|
64
|
+
is: function() {
|
65
|
+
return false;
|
66
|
+
},
|
67
|
+
format: function(s, table) {
|
68
|
+
// reformat yy/mm/dd to mm/dd/19yy
|
69
|
+
return ts.formatDate(s, ts.dates.regyyxxxx, "$2/$3/19$1", table);
|
70
|
+
},
|
71
|
+
type: "numeric"
|
72
|
+
});
|
73
|
+
|
74
|
+
})(jQuery);
|
@@ -0,0 +1,33 @@
|
|
1
|
+
/*! Weekday parser
|
2
|
+
* Demo: http://jsfiddle.net/Mottie/abkNM/477/
|
3
|
+
*/
|
4
|
+
/*jshint jquery:true */
|
5
|
+
;(function($){
|
6
|
+
"use strict";
|
7
|
+
|
8
|
+
var ts = $.tablesorter;
|
9
|
+
ts.dates = $.extend({}, ts.dates, {
|
10
|
+
// *** modify this array to change match the language ***
|
11
|
+
weekdayCased : [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ]
|
12
|
+
});
|
13
|
+
ts.dates.weekdayLower = ts.dates.weekdayCased.join(',').toLocaleLowerCase().split(',');
|
14
|
+
|
15
|
+
ts.addParser({
|
16
|
+
id: "weekday",
|
17
|
+
is: function(){
|
18
|
+
return false;
|
19
|
+
},
|
20
|
+
format: function(s, table) {
|
21
|
+
var j = -1, c = table.config;
|
22
|
+
s = c.ignoreCase ? s.toLocaleLowerCase() : s;
|
23
|
+
$.each(ts.dates[ 'weekday' + (c.ignoreCase ? 'Lower' : 'Cased') ], function(i,v){
|
24
|
+
if (j < 0 && s.match(v)) { j = i; }
|
25
|
+
});
|
26
|
+
// return s (original string) if there isn't a match
|
27
|
+
// (non-weekdays will sort separately and empty cells will sort as expected)
|
28
|
+
return j < 0 ? s : j;
|
29
|
+
},
|
30
|
+
type: "numeric"
|
31
|
+
});
|
32
|
+
|
33
|
+
})(jQuery);
|
@@ -0,0 +1,36 @@
|
|
1
|
+
/*!
|
2
|
+
* Extract dates using popular natural language date parsers
|
3
|
+
*/
|
4
|
+
/*jshint jquery:true */
|
5
|
+
;(function($){
|
6
|
+
"use strict";
|
7
|
+
|
8
|
+
/*! Sugar (http://sugarjs.com/dates#comparing_dates)
|
9
|
+
* demo: http://jsfiddle.net/Mottie/abkNM/551/
|
10
|
+
*/
|
11
|
+
$.tablesorter.addParser({
|
12
|
+
id: "sugar",
|
13
|
+
is: function() {
|
14
|
+
return false;
|
15
|
+
},
|
16
|
+
format: function(s) {
|
17
|
+
return Date.create ? Date.create(s).getTime() || s : new Date(s).getTime() || s;
|
18
|
+
},
|
19
|
+
type: "numeric"
|
20
|
+
});
|
21
|
+
|
22
|
+
/*! Datejs (http://www.datejs.com/)
|
23
|
+
* demo: http://jsfiddle.net/Mottie/abkNM/550/
|
24
|
+
*/
|
25
|
+
$.tablesorter.addParser({
|
26
|
+
id: "datejs",
|
27
|
+
is: function() {
|
28
|
+
return false;
|
29
|
+
},
|
30
|
+
format: function(s) {
|
31
|
+
return Date.parse && Date.parse(s) || s;
|
32
|
+
},
|
33
|
+
type: "numeric"
|
34
|
+
});
|
35
|
+
|
36
|
+
})(jQuery);
|
@@ -0,0 +1,63 @@
|
|
1
|
+
/*! Distance parser
|
2
|
+
* This parser will parser numbers like 5'10" (5 foot 10 inches)
|
3
|
+
* and 31½ into sortable values.
|
4
|
+
* Demo: http://jsfiddle.net/Mottie/abkNM/154/
|
5
|
+
*/
|
6
|
+
/*global jQuery: false */
|
7
|
+
;(function($){
|
8
|
+
"use strict";
|
9
|
+
|
10
|
+
var ts = $.tablesorter;
|
11
|
+
ts.symbolRegex = /[\u215b\u215c\u215d\u215e\u00bc\u00bd\u00be]/g;
|
12
|
+
ts.processFractions = function(n, table) {
|
13
|
+
if (n) {
|
14
|
+
var t, p = 0;
|
15
|
+
n = $.trim(n.replace(/\"/,''));
|
16
|
+
// look for a space in the first part of the number: "10 3/4" and save the "10"
|
17
|
+
if (/\s/.test(n)) {
|
18
|
+
p = ts.formatFloat(n.split(' ')[0], table);
|
19
|
+
// remove stuff to the left of the space
|
20
|
+
n = $.trim(n.substring(n.indexOf(' '), n.length));
|
21
|
+
}
|
22
|
+
// look for a "/" to calculate fractions
|
23
|
+
if (/\//g.test(n)) {
|
24
|
+
t = n.split('/');
|
25
|
+
// turn 3/4 into .75; make sure we don't divide by zero
|
26
|
+
n = p + parseInt(t[0], 10) / parseInt(t[1] || 1, 10);
|
27
|
+
// look for fraction symbols
|
28
|
+
} else if (ts.symbolRegex.test(n)) {
|
29
|
+
n = p + n.replace(ts.symbolRegex, function(m){
|
30
|
+
return {
|
31
|
+
'\u215b' : '.125', // 1/8
|
32
|
+
'\u215c' : '.375', // 3/8
|
33
|
+
'\u215d' : '.625', // 5/8
|
34
|
+
'\u215e' : '.875', // 7/8
|
35
|
+
'\u00bc' : '.25', // 1/4
|
36
|
+
'\u00bd' : '.5', // 1/2
|
37
|
+
'\u00be' : '.75' // 3/4
|
38
|
+
}[m];
|
39
|
+
});
|
40
|
+
}
|
41
|
+
}
|
42
|
+
return n || 0;
|
43
|
+
};
|
44
|
+
|
45
|
+
$.tablesorter.addParser({
|
46
|
+
id: 'distance',
|
47
|
+
is: function() {
|
48
|
+
// return false so this parser is not auto detected
|
49
|
+
return false;
|
50
|
+
},
|
51
|
+
format: function(s, table) {
|
52
|
+
if (s === '') { return ''; }
|
53
|
+
// look for feet symbol = '
|
54
|
+
// very generic test to catch 1.1', 1 1/2' and 1½'
|
55
|
+
var d = (/^\s*\S*(\s+\S+)?\s*\'/.test(s)) ? s.split("'") : [0,s],
|
56
|
+
f = ts.processFractions(d[0], table), // feet
|
57
|
+
i = ts.processFractions(d[1], table); // inches
|
58
|
+
return (/[\'\"]/).test(s) ? parseFloat(f) + (parseFloat(i)/12 || 0) : parseFloat(f) + parseFloat(i);
|
59
|
+
},
|
60
|
+
type: 'numeric'
|
61
|
+
});
|
62
|
+
|
63
|
+
})(jQuery);
|
@@ -0,0 +1,73 @@
|
|
1
|
+
/*! File Type parser
|
2
|
+
* When a file type extension is found, the equivalent name is
|
3
|
+
* prefixed into the parsed data, so sorting occurs in groups
|
4
|
+
*/
|
5
|
+
/*global jQuery: false */
|
6
|
+
;(function($){
|
7
|
+
"use strict";
|
8
|
+
|
9
|
+
// basic list from http://en.wikipedia.org/wiki/List_of_file_formats
|
10
|
+
// To add a custom equivalent, define:
|
11
|
+
// $.tablesorter.fileTypes.equivalents['xx'] = "A|B|C";
|
12
|
+
$.tablesorter.fileTypes = {
|
13
|
+
// divides filetype extensions in the equivalent list below
|
14
|
+
separator : '|',
|
15
|
+
equivalents : {
|
16
|
+
"3D Image" : "3dm|3ds|dwg|max|obj",
|
17
|
+
"Audio" : "aif|aac|ape|flac|la|m4a|mid|midi|mp2|mp3|ogg|ra|raw|rm|wav|wma",
|
18
|
+
"Compressed" : "7z|bin|cab|cbr|gz|gzip|iso|lha|lz|rar|tar|tgz|zip|zipx|zoo",
|
19
|
+
"Database" : "csv|dat|db|dbf|json|ldb|mdb|myd|pdb|sql|tsv|wdb|wmdb|xlr|xls|xlsx|xml",
|
20
|
+
"Development" : "asm|c|class|cls|cpp|cc|cs|cxx|cbp|cs|dba|fla|h|java|lua|pl|py|pyc|pyo|sh|sln|r|rb|vb",
|
21
|
+
"Document" : "doc|docx|odt|ott|pages|pdf|rtf|tex|wpd|wps|wrd|wri",
|
22
|
+
"Executable" : "apk|app|com|exe|gadget|lnk|msi",
|
23
|
+
"Fonts" : "eot|fnt|fon|otf|ttf|woff",
|
24
|
+
"Icons" : "ani|cur|icns|ico",
|
25
|
+
"Images" : "bmp|gif|jpg|jpeg|jpe|jp2|pic|png|psd|tga|tif|tiff|wmf|webp",
|
26
|
+
"Presentation" : "pps|ppt",
|
27
|
+
"Published" : "chp|epub|lit|pub|ppp|fm|mobi",
|
28
|
+
"Script" : "as|bat|cgi|cmd|jar|js|lua|scpt|scptd|sh|vbs|vb|wsf",
|
29
|
+
"Styles" : "css|less|sass",
|
30
|
+
"Text" : "info|log|md|markdown|nfo|tex|text|txt",
|
31
|
+
"Vectors" : "awg|ai|eps|cdr|ps|svg",
|
32
|
+
"Video" : "asf|avi|flv|m4v|mkv|mov|mp4|mpe|mpeg|mpg|ogg|rm|rv|swf|vob|wmv",
|
33
|
+
"Web" : "asp|aspx|cer|cfm|htm|html|php|url|xhtml"
|
34
|
+
}
|
35
|
+
};
|
36
|
+
|
37
|
+
$.tablesorter.addParser({
|
38
|
+
id: 'filetype',
|
39
|
+
is: function() {
|
40
|
+
return false;
|
41
|
+
},
|
42
|
+
format: function(s, table) {
|
43
|
+
var t,
|
44
|
+
c = table.config,
|
45
|
+
wo = c.widgetOptions,
|
46
|
+
i = s.lastIndexOf('.'),
|
47
|
+
sep = $.tablesorter.fileTypes.separator,
|
48
|
+
m = $.tablesorter.fileTypes.matching,
|
49
|
+
types = $.tablesorter.fileTypes.equivalents;
|
50
|
+
if (!m) {
|
51
|
+
// make a string to "quick" match the existing equivalents
|
52
|
+
var t = [];
|
53
|
+
$.each(types, function(i,v){
|
54
|
+
t.push(v);
|
55
|
+
});
|
56
|
+
m = $.tablesorter.fileTypes.matching = sep + t.join(sep) + sep;
|
57
|
+
}
|
58
|
+
if (i >= 0) {
|
59
|
+
t = sep + s.substring(i + 1, s.length) + sep;
|
60
|
+
if (m.indexOf(t) >= 0) {
|
61
|
+
for (i in types) {
|
62
|
+
if ((sep + types[i] + sep).indexOf(t) >= 0) {
|
63
|
+
return i + (wo.group_separator ? wo.group_separator : '-') + s;
|
64
|
+
}
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}
|
68
|
+
return s;
|
69
|
+
},
|
70
|
+
type: 'text'
|
71
|
+
});
|
72
|
+
|
73
|
+
})(jQuery);
|
@@ -0,0 +1,47 @@
|
|
1
|
+
/*! Title parser
|
2
|
+
* This parser will remove "The", "A" and "An" from the beginning of a book
|
3
|
+
* or movie title, so it sorts by the second word or number
|
4
|
+
* Demo: http://jsfiddle.net/Mottie/abkNM/5/
|
5
|
+
*/
|
6
|
+
/*global jQuery: false */
|
7
|
+
;(function($){
|
8
|
+
"use strict";
|
9
|
+
|
10
|
+
// basic list from http://en.wikipedia.org/wiki/Article_%28grammar%29
|
11
|
+
$.tablesorter.ignoreArticles = {
|
12
|
+
"en" : "the, a, an",
|
13
|
+
"de" : "der, die, das, des, dem, den, ein, eine, einer, eines, einem, einen",
|
14
|
+
"nl" : "de, het, de, een",
|
15
|
+
"es" : "el, la, lo, los, las, un, una, unos, unas",
|
16
|
+
"pt" : "o, a, os, as, um, uma, uns, umas",
|
17
|
+
"fr" : "le, la, l'_, les, un, une, des",
|
18
|
+
"it" : "il, lo, la, l'_, i, gli, le, un', uno, una, un",
|
19
|
+
"hu" : "a, az, egy"
|
20
|
+
};
|
21
|
+
|
22
|
+
// To add a custom parser, define:
|
23
|
+
// $.tablesorter.ignoreArticles['xx'] = "A, B, C";
|
24
|
+
// and then set the language id 'xx' in the headers option
|
25
|
+
// ignoreArticles : 'xx'
|
26
|
+
|
27
|
+
$.tablesorter.addParser({
|
28
|
+
id: 'ignoreArticles',
|
29
|
+
is: function() {
|
30
|
+
return false;
|
31
|
+
},
|
32
|
+
format: function(s, table, cell, cellIndex) {
|
33
|
+
var c = table.config, art, lang;
|
34
|
+
if ( !(c.headers && c.headers[cellIndex] && c.headers[cellIndex].ignoreArticlesRegex) ) {
|
35
|
+
// initialize - save regex in c.headers[cellIndex].ignoreArticles
|
36
|
+
if (!c.headers) { c.headers = {}; }
|
37
|
+
if (!c.headers[cellIndex]) { c.headers[cellIndex] = {}; }
|
38
|
+
lang = $.tablesorter.getData(c.$headers.eq(cellIndex), c.headers[cellIndex], 'ignoreArticles');
|
39
|
+
art = ($.tablesorter.ignoreArticles[lang] || "the, a, an" ) + "";
|
40
|
+
c.headers[cellIndex].ignoreArticlesRegex = new RegExp('^(' + $.trim( art.split(/\s*\,\s*/).join('\\s|') + "\\s" ).replace("_\\s","") + ')', 'i');
|
41
|
+
}
|
42
|
+
return (s || '').replace(c.headers[cellIndex].ignoreArticlesRegex, '');
|
43
|
+
},
|
44
|
+
type: 'text'
|
45
|
+
});
|
46
|
+
|
47
|
+
})(jQuery);
|
@@ -0,0 +1,86 @@
|
|
1
|
+
/*! input & select parsers for jQuery 1.7+ & tablesorter 2.7.11+
|
2
|
+
* Updated 2/19/2014 (v2.15.0)
|
3
|
+
* Demo: http://mottie.github.com/tablesorter/docs/example-widget-grouping.html
|
4
|
+
*/
|
5
|
+
/*jshint browser: true, jquery:true, unused:false */
|
6
|
+
;(function($){
|
7
|
+
"use strict";
|
8
|
+
|
9
|
+
var resort = true, // resort table after update
|
10
|
+
updateServer = function(event, $table, $input){
|
11
|
+
// do something here to update your server, if needed
|
12
|
+
// event = change event object
|
13
|
+
// $table = jQuery object of the table that was just updated
|
14
|
+
// $input = jQuery object of the input or select that was modified
|
15
|
+
};
|
16
|
+
|
17
|
+
// Custom parser for parsing input values
|
18
|
+
// updated dynamically using the "change" function below
|
19
|
+
$.tablesorter.addParser({
|
20
|
+
id: "inputs",
|
21
|
+
is: function(){
|
22
|
+
return false;
|
23
|
+
},
|
24
|
+
format: function(s, table, cell) {
|
25
|
+
return $(cell).find('input').val() || s;
|
26
|
+
},
|
27
|
+
parsed : true, // filter widget flag
|
28
|
+
type: "text"
|
29
|
+
});
|
30
|
+
|
31
|
+
// Custom parser for including checkbox status if using the grouping widget
|
32
|
+
// updated dynamically using the "change" function below
|
33
|
+
$.tablesorter.addParser({
|
34
|
+
id: "checkbox",
|
35
|
+
is: function(){
|
36
|
+
return false;
|
37
|
+
},
|
38
|
+
format: function(s, table, cell, cellIndex) {
|
39
|
+
var $c = $(cell).find('input'),
|
40
|
+
isChecked = $c[0].checked;
|
41
|
+
// adding class to row, indicating that a checkbox is checked; includes
|
42
|
+
// a column index in case more than one checkbox happens to be in a row
|
43
|
+
$c.closest('tr').toggleClass('checked-' + cellIndex, isChecked);
|
44
|
+
// returning plain language here because this is what is shown in the
|
45
|
+
// group headers - change it as desired
|
46
|
+
return $c.length ? isChecked ? 'checked' : 'unchecked' : s;
|
47
|
+
},
|
48
|
+
parsed : true, // filter widget flag
|
49
|
+
type: "text"
|
50
|
+
});
|
51
|
+
|
52
|
+
// Custom parser which returns the currently selected options
|
53
|
+
// updated dynamically using the "change" function below
|
54
|
+
$.tablesorter.addParser({
|
55
|
+
id: "select",
|
56
|
+
is: function(){
|
57
|
+
return false;
|
58
|
+
},
|
59
|
+
format: function(s, table, cell) {
|
60
|
+
return $(cell).find('select').val() || s;
|
61
|
+
},
|
62
|
+
parsed : true, // filter widget flag
|
63
|
+
type: "text"
|
64
|
+
});
|
65
|
+
|
66
|
+
// update select and all input types in the tablesorter cache when the change event fires.
|
67
|
+
// This method only works with jQuery 1.7+
|
68
|
+
// you can change it to use delegate (v1.4.3+) or live (v1.3+) as desired
|
69
|
+
// if this code interferes somehow, target the specific table $('#mytable'), instead of $('table')
|
70
|
+
$(window).load(function(){
|
71
|
+
// this flag prevents the updateCell event from being spammed
|
72
|
+
// it happens when you modify input text and hit enter
|
73
|
+
var alreadyUpdating = false;
|
74
|
+
$('table').find('tbody').on('change', 'select, input', function(e){
|
75
|
+
if (!alreadyUpdating) {
|
76
|
+
var $tar = $(e.target),
|
77
|
+
$table = $tar.closest('table');
|
78
|
+
alreadyUpdating = true;
|
79
|
+
$table.trigger('updateCell', [ $tar.closest('td'), resort ]);
|
80
|
+
updateServer(e, $table, $tar);
|
81
|
+
setTimeout(function(){ alreadyUpdating = false; }, 10);
|
82
|
+
}
|
83
|
+
});
|
84
|
+
});
|
85
|
+
|
86
|
+
})(jQuery);
|