jquery-tablesorter 1.12.8 → 1.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/jquery-tablesorter/version.rb +1 -1
  4. data/vendor/assets/javascripts/jquery-tablesorter/addons/pager/jquery.tablesorter.pager.js +115 -67
  5. data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.js +62 -40
  6. data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.widgets.js +251 -118
  7. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-extract.js +48 -24
  8. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-iso8601.js +5 -4
  9. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-month.js +16 -10
  10. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-two-digit-year.js +26 -19
  11. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-weekday.js +16 -10
  12. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date.js +7 -4
  13. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-named-numbers.js +121 -0
  14. data/vendor/assets/javascripts/jquery-tablesorter/parsers/{parser-ipv6.js → parser-network.js} +66 -17
  15. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-columnSelector.js +10 -7
  16. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-cssStickyHeaders.js +62 -35
  17. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-editable.js +197 -174
  18. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-grouping.js +3 -6
  19. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-pager.js +145 -62
  20. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-repeatheaders.js +1 -1
  21. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-scroller.js +16 -14
  22. data/vendor/assets/stylesheets/jquery-tablesorter/theme.black-ice.css +2 -2
  23. data/vendor/assets/stylesheets/jquery-tablesorter/theme.blue.css +2 -2
  24. data/vendor/assets/stylesheets/jquery-tablesorter/theme.bootstrap_2.css +2 -2
  25. data/vendor/assets/stylesheets/jquery-tablesorter/theme.dark.css +2 -2
  26. data/vendor/assets/stylesheets/jquery-tablesorter/theme.default.css +2 -2
  27. data/vendor/assets/stylesheets/jquery-tablesorter/theme.dropbox.css +2 -2
  28. data/vendor/assets/stylesheets/jquery-tablesorter/theme.green.css +2 -2
  29. data/vendor/assets/stylesheets/jquery-tablesorter/theme.grey.css +2 -2
  30. data/vendor/assets/stylesheets/jquery-tablesorter/theme.ice.css +2 -2
  31. data/vendor/assets/stylesheets/jquery-tablesorter/theme.jui.css +4 -1
  32. data/vendor/assets/stylesheets/jquery-tablesorter/theme.metro-dark.css +4 -4
  33. metadata +4 -3
@@ -1,57 +1,80 @@
1
1
  /*!
2
2
  * Extract out date parsers
3
+ * 10/26/2014 (v2.18.0)
3
4
  */
4
5
  /*jshint jquery:true */
5
6
  ;(function($){
6
7
  "use strict";
7
8
 
9
+ var regex = {
10
+ usLong : /[A-Z]{3,10}\.?\s+\d{1,2},?\s+(?:\d{4})(?:\s+\d{1,2}:\d{2}(?::\d{2})?(?:\s+[AP]M)?)?/i,
11
+ mdy : /(\d{1,2}[\/\s]\d{1,2}[\/\s]\d{4}(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?)/i,
12
+
13
+ dmy : /(\d{1,2}[\/\s]\d{1,2}[\/\s]\d{4}(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?)/i,
14
+ dmyreplace : /(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,
15
+
16
+ ymd : /(\d{4}[\/\s]\d{1,2}[\/\s]\d{1,2}(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?)/i,
17
+ ymdreplace : /(\d{4})[\/\s](\d{1,2})[\/\s](\d{1,2})/
18
+ };
19
+
8
20
  /*! extract US Long Date (ignore any other text)
9
21
  * e.g. "Sue's Birthday! Jun 26, 2004 7:22 AM (8# 2oz)"
10
- * demo: http://jsfiddle.net/abkNM/2293/
22
+ * demo: http://jsfiddle.net/Mottie/abkNM/4165/
11
23
  */
12
24
  $.tablesorter.addParser({
13
25
  id: "extractUSLongDate",
14
- is: function (s) {
26
+ is: function () {
15
27
  // don't auto detect this parser
16
28
  return false;
17
29
  },
18
- format: function (s, table) {
19
- var date = s.match(/[A-Z]{3,10}\.?\s+\d{1,2},?\s+(?:\d{4})(?:\s+\d{1,2}:\d{2}(?::\d{2})?(?:\s+[AP]M)?)?/i);
20
- return date ? $.tablesorter.formatFloat((new Date(date[0]).getTime() || ''), table) || s : s;
30
+ format: function (s) {
31
+ var date,
32
+ str = s ? s.match(regex.usLong) : s;
33
+ if (str) {
34
+ date = new Date( str[0] );
35
+ return date instanceof Date && isFinite(date) ? date.getTime() : s;
36
+ }
37
+ return s;
21
38
  },
22
39
  type: "numeric"
23
40
  });
24
41
 
25
42
  /*! extract MMDDYYYY (ignore any other text)
26
- * demo: http://jsfiddle.net/Mottie/abkNM/2418/
43
+ * demo: http://jsfiddle.net/Mottie/abkNM/4166/
27
44
  */
28
45
  $.tablesorter.addParser({
29
46
  id: "extractMMDDYYYY",
30
- is: function (s) {
47
+ is: function () {
31
48
  // don't auto detect this parser
32
49
  return false;
33
50
  },
34
- format: function (s, table) {
35
- var date = s.replace(/\s+/g," ").replace(/[\-.,]/g, "/").match(/(\d{1,2}[\/\s]\d{1,2}[\/\s]\d{4}(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?)/i);
36
- return date ? $.tablesorter.formatFloat((new Date(date[0]).getTime() || ''), table) || s : s;
51
+ format: function (s) {
52
+ var date,
53
+ str = s ? s.replace(/\s+/g," ").replace(/[\-.,]/g, "/").match(regex.mdy) : s;
54
+ if (str) {
55
+ date = new Date( str[0] );
56
+ return date instanceof Date && isFinite(date) ? date.getTime() : s;
57
+ }
58
+ return s;
37
59
  },
38
60
  type: "numeric"
39
61
  });
40
62
 
41
63
  /*! extract DDMMYYYY (ignore any other text)
42
- * demo: http://jsfiddle.net/Mottie/abkNM/2419/
64
+ * demo: http://jsfiddle.net/Mottie/abkNM/4167/
43
65
  */
44
66
  $.tablesorter.addParser({
45
67
  id: "extractDDMMYYYY",
46
- is: function (s) {
68
+ is: function () {
47
69
  // don't auto detect this parser
48
70
  return false;
49
71
  },
50
- format: function (s, table) {
51
- var date = s.replace(/\s+/g," ").replace(/[\-.,]/g, "/").match(/(\d{1,2}[\/\s]\d{1,2}[\/\s]\d{4}(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?)/i);
52
- if (date) {
53
- date = date[0].replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/, "$2/$1/$3");
54
- return $.tablesorter.formatFloat((new Date(date).getTime() || ''), table) || s;
72
+ format: function (s) {
73
+ var date,
74
+ str = s ? s.replace(/\s+/g," ").replace(/[\-.,]/g, "/").match(regex.dmy) : s;
75
+ if (str) {
76
+ date = new Date( str[0].replace(regex.dmyreplace, "$2/$1/$3") );
77
+ return date instanceof Date && isFinite(date) ? date.getTime() : s;
55
78
  }
56
79
  return s;
57
80
  },
@@ -59,19 +82,20 @@
59
82
  });
60
83
 
61
84
  /*! extract YYYYMMDD (ignore any other text)
62
- * demo: http://jsfiddle.net/Mottie/abkNM/2420/
85
+ * demo: http://jsfiddle.net/Mottie/abkNM/4168/
63
86
  */
64
87
  $.tablesorter.addParser({
65
88
  id: "extractYYYYMMDD",
66
- is: function (s) {
89
+ is: function () {
67
90
  // don't auto detect this parser
68
91
  return false;
69
92
  },
70
- format: function (s, table) {
71
- var date = s.replace(/\s+/g," ").replace(/[\-.,]/g, "/").match(/(\d{4}[\/\s]\d{1,2}[\/\s]\d{1,2}(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?)/i);
72
- if (date) {
73
- date = date[0].replace(/(\d{4})[\/\s](\d{1,2})[\/\s](\d{1,2})/, "$2/$3/$1");
74
- return $.tablesorter.formatFloat((new Date(date).getTime() || ''), table) || s;
93
+ format: function (s) {
94
+ var date,
95
+ str = s ? s.replace(/\s+/g," ").replace(/[\-.,]/g, "/").match(regex.ymd) : s;
96
+ if (str) {
97
+ date = new Date( str[0].replace(regex.ymdreplace, "$2/$3/$1") );
98
+ return date instanceof Date && isFinite(date) ? date.getTime() : s;
75
99
  }
76
100
  return s;
77
101
  },
@@ -1,4 +1,4 @@
1
- /*! ISO-8601 date parser
1
+ /*! ISO-8601 date parser - 10/26/2014 (v2.18.0)
2
2
  * This parser will work with dates in ISO8601 format
3
3
  * 2013-02-18T18:18:44+00:00
4
4
  * Written by Sean Ellingham :https://github.com/seanellingham
@@ -9,13 +9,14 @@
9
9
  "use strict";
10
10
 
11
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
+
12
13
  $.tablesorter.addParser({
13
14
  id : 'iso8601date',
14
15
  is : function(s) {
15
- return s.match(iso8601date);
16
+ return s ? s.match(iso8601date) : false;
16
17
  },
17
18
  format : function(s) {
18
- var result = s.match(iso8601date);
19
+ var result = s ? s.match(iso8601date) : s;
19
20
  if (result) {
20
21
  var date = new Date(result[1], 0, 1);
21
22
  if (result[3]) { date.setMonth(result[3] - 1); }
@@ -24,7 +25,7 @@
24
25
  if (result[8]) { date.setMinutes(result[8]); }
25
26
  if (result[10]) { date.setSeconds(result[10]); }
26
27
  if (result[12]) { date.setMilliseconds(Number('0.' + result[12]) * 1000); }
27
- return date;
28
+ return date.getTime();
28
29
  }
29
30
  return s;
30
31
  },
@@ -1,5 +1,5 @@
1
- /*! Month parser
2
- * Demo: http://jsfiddle.net/Mottie/abkNM/477/
1
+ /*! Month parser - 10/26/2014 (v2.18.0)
2
+ * Demo: http://jsfiddle.net/Mottie/abkNM/4169/
3
3
  */
4
4
  /*jshint jquery:true */
5
5
  ;(function($){
@@ -18,14 +18,20 @@
18
18
  return false;
19
19
  },
20
20
  format: function(s, table) {
21
- var j = -1, c = table.config,
22
- n = c.ignoreCase ? s.toLocaleLowerCase() : s;
23
- $.each(ts.dates[ 'month' + (c.ignoreCase ? 'Lower' : 'Cased') ], function(i,v){
24
- if (j < 0 && n.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;
21
+ if (s) {
22
+ var j = -1, c = table.config,
23
+ n = c.ignoreCase ? s.toLocaleLowerCase() : s;
24
+ $.each(ts.dates[ 'month' + (c.ignoreCase ? 'Lower' : 'Cased') ], function(i,v){
25
+ if (j < 0 && n.match(v)) {
26
+ j = i;
27
+ return false;
28
+ }
29
+ });
30
+ // return s (original string) if there isn't a match
31
+ // (non-weekdays will sort separately and empty cells will sort as expected)
32
+ return j < 0 ? s : j;
33
+ }
34
+ return s;
29
35
  },
30
36
  type: "numeric"
31
37
  });
@@ -1,16 +1,18 @@
1
- /*! Two digit year parser
2
- * Demo: http://jsfiddle.net/Mottie/abkNM/427/
1
+ /*! Two digit year parser - 10/26/2014 (v2.18.0)
2
+ * Demo: http://mottie.github.io/tablesorter/docs/example-parsers-dates.html
3
3
  */
4
4
  /*jshint jquery:true */
5
5
  ;(function($){
6
6
  "use strict";
7
7
 
8
- var ts = $.tablesorter,
9
-
10
8
  // Make the date be within +/- range of the 2 digit year
11
9
  // so if the current year is 2020, and the 2 digit year is 80 (2080 - 2020 > 50), it becomes 1980
12
10
  // if the 2 digit year is 50 (2050 - 2020 < 50), then it becomes 2050.
13
- range = 50;
11
+ var range = 50,
12
+
13
+ // no need to change any of the code below
14
+ ts = $.tablesorter,
15
+ now = new Date().getFullYear();
14
16
 
15
17
  ts.dates = $.extend({}, ts.dates, {
16
18
  regxxxxyy: /(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{2})/,
@@ -18,21 +20,26 @@
18
20
  });
19
21
 
20
22
  ts.formatDate = function(s, regex, format, table){
21
- var n = s
22
- // replace separators
23
- .replace(/\s+/g," ").replace(/[-.,]/g, "/")
24
- // reformat xx/xx/xx to mm/dd/19yy;
25
- .replace(regex, format),
26
- d = new Date(n),
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;
23
+ if (s) {
24
+ var y, rng,
25
+ n = s
26
+ // replace separators
27
+ .replace(/\s+/g," ").replace(/[-.,]/g, "/")
28
+ // reformat xx/xx/xx to mm/dd/19yy;
29
+ .replace(regex, format),
30
+ d = new Date(n);
31
+ if ( d instanceof Date && isFinite(d) ) {
32
+ y = d.getFullYear();
33
+ rng = table && table.config.dateRange || range;
34
+ // if date > 50 years old (set range), add 100 years
35
+ // this will work when people start using "50" and mean "2050"
36
+ while (now - y > rng) {
37
+ y += 100;
38
+ }
39
+ return d.setFullYear(y);
40
+ }
34
41
  }
35
- return d.setFullYear(y) || s;
42
+ return s;
36
43
  };
37
44
 
38
45
  $.tablesorter.addParser({
@@ -1,5 +1,5 @@
1
- /*! Weekday parser
2
- * Demo: http://jsfiddle.net/Mottie/abkNM/477/
1
+ /*! Weekday parser - 10/26/2014 (v2.18.0)
2
+ * Demo: http://jsfiddle.net/Mottie/abkNM/4169/
3
3
  */
4
4
  /*jshint jquery:true */
5
5
  ;(function($){
@@ -18,14 +18,20 @@
18
18
  return false;
19
19
  },
20
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;
21
+ if (s) {
22
+ var j = -1, c = table.config;
23
+ s = c.ignoreCase ? s.toLocaleLowerCase() : s;
24
+ $.each(ts.dates[ 'weekday' + (c.ignoreCase ? 'Lower' : 'Cased') ], function(i,v){
25
+ if (j < 0 && s.match(v)) {
26
+ j = i;
27
+ return false;
28
+ }
29
+ });
30
+ // return s (original string) if there isn't a match
31
+ // (non-weekdays will sort separately and empty cells will sort as expected)
32
+ return j < 0 ? s : j;
33
+ }
34
+ return s;
29
35
  },
30
36
  type: "numeric"
31
37
  });
@@ -1,12 +1,13 @@
1
1
  /*!
2
2
  * Extract dates using popular natural language date parsers
3
+ * 10/26/2014 (v2.18.0)
3
4
  */
4
5
  /*jshint jquery:true */
5
6
  ;(function($){
6
7
  "use strict";
7
8
 
8
9
  /*! Sugar (http://sugarjs.com/dates#comparing_dates)
9
- * demo: http://jsfiddle.net/Mottie/abkNM/551/
10
+ * demo: http://jsfiddle.net/Mottie/abkNM/4163/
10
11
  */
11
12
  $.tablesorter.addParser({
12
13
  id: "sugar",
@@ -14,13 +15,14 @@
14
15
  return false;
15
16
  },
16
17
  format: function(s) {
17
- return Date.create ? Date.create(s).getTime() || s : new Date(s).getTime() || s;
18
+ var date = Date.create ? Date.create(s) : s ? new Date(s) : s;
19
+ return date instanceof Date && isFinite(date) ? date.getTime() : s;
18
20
  },
19
21
  type: "numeric"
20
22
  });
21
23
 
22
24
  /*! Datejs (http://www.datejs.com/)
23
- * demo: http://jsfiddle.net/Mottie/abkNM/550/
25
+ * demo: http://jsfiddle.net/Mottie/abkNM/4164/
24
26
  */
25
27
  $.tablesorter.addParser({
26
28
  id: "datejs",
@@ -28,7 +30,8 @@
28
30
  return false;
29
31
  },
30
32
  format: function(s) {
31
- return Date.parse && Date.parse(s) || s;
33
+ var date = Date.parse ? Date.parse(s) : s ? new Date(s) : s;
34
+ return date instanceof Date && isFinite(date) ? date.getTime() : s;
32
35
  },
33
36
  type: "numeric"
34
37
  });
@@ -0,0 +1,121 @@
1
+ /*! Named Numbers Parser - 10/26/2014 (v2.18.0)
2
+ * code modified from http://stackoverflow.com/a/12014376/145346
3
+ */
4
+ /*jshint jquery:true */
5
+ ;(function($){
6
+ "use strict";
7
+
8
+ // Change language of the named numbers as needed
9
+ var named = {
10
+ negative: [ 'negative', 'minus' ],
11
+ numbers : {
12
+ 'zero' : 0,
13
+ 'one' : 1,
14
+ 'two' : 2,
15
+ 'three' : 3,
16
+ 'four' : 4,
17
+ 'five' : 5,
18
+ 'six' : 6,
19
+ 'seven' : 7,
20
+ 'eight' : 8,
21
+ 'nine' : 9,
22
+ 'ten' : 10,
23
+ 'eleven' : 11,
24
+ 'twelve' : 12,
25
+ 'thirteen' : 13,
26
+ 'fourteen' : 14,
27
+ 'fifteen' : 15,
28
+ 'sixteen' : 16,
29
+ 'seventeen' : 17,
30
+ 'eighteen' : 18,
31
+ 'nineteen' : 19,
32
+ 'twenty' : 20,
33
+ 'thirty' : 30,
34
+ 'forty' : 40,
35
+ 'fourty' : 40, // common misspelling
36
+ 'fifty' : 50,
37
+ 'sixty' : 60,
38
+ 'seventy' : 70,
39
+ 'eighty' : 80,
40
+ 'ninety' : 90
41
+ },
42
+ // special case
43
+ hundred : 'hundred',
44
+ // multiples
45
+ powers : {
46
+ 'thousand' : 1e3,
47
+ 'million' : 1e6,
48
+ 'billion' : 1e9,
49
+ 'trillion' : 1e12,
50
+ 'quadrillion' : 1e15,
51
+ 'quintillion' : 1e18,
52
+ 'sextillion' : 1e21,
53
+ 'septillion' : 1e24,
54
+ 'octillion' : 1e27,
55
+ 'nonillion' : 1e30,
56
+ 'decillion' : 1e33,
57
+ 'undecillion' : 1e36,
58
+ 'duodecillion' : 1e39,
59
+ 'tredecillion' : 1e42,
60
+ 'quattuordecillion' : 1e45,
61
+ 'quindecillion' : 1e48,
62
+ 'sexdecillion' : 1e51,
63
+ 'septendecillion' : 1e54,
64
+ 'octodecillion' : 1e57,
65
+ 'novemdecillion' : 1e60,
66
+ 'vigintillion' : 1e63,
67
+ 'unvigintillion' : 1e66,
68
+ 'duovigintillion' : 1e69,
69
+ 'trevigintillion' : 1e72,
70
+ 'quattuorvigintillion' : 1e75,
71
+ 'quinvigintillion' : 1e78,
72
+ 'sexvigintillion' : 1e81,
73
+ 'septenvigintillion' : 1e84,
74
+ 'octovigintillion' : 1e87,
75
+ 'novemvigintillion' : 1e90,
76
+ 'trigintillion' : 1e93,
77
+ 'untrigintillion' : 1e96,
78
+ 'duotrigintillion' : 1e99,
79
+ 'googl' : 1e100
80
+ }
81
+ },
82
+ result, group,
83
+ negativeRegex = new RegExp('(' + named.negative.join('|') + ')'),
84
+ calc = function ( word, table ) {
85
+ var num = named.numbers.hasOwnProperty( word ) ? named.numbers[ word ] : null,
86
+ power = named.powers.hasOwnProperty( word ) ? named.powers[ word ] : null;
87
+ if ( !num && !isNaN( word ) ) {
88
+ num = $.tablesorter.formatFloat( word || '', table );
89
+ }
90
+ if ( num !== null ) {
91
+ group += num;
92
+ } else if ( word === named.hundred ) {
93
+ group *= 100;
94
+ } else if ( power !== null ) {
95
+ result += group * power;
96
+ group = 0;
97
+ }
98
+ };
99
+
100
+ $.tablesorter.addParser({
101
+ id: "namedNumbers",
102
+ is: function () {
103
+ return false;
104
+ },
105
+ format: function ( str, table ) {
106
+ result = 0;
107
+ group = 0;
108
+ var indx,
109
+ arry = ( str || '' ).split( /[\s-]+/ ),
110
+ len = arry.length;
111
+ for ( indx = 0; indx < len; indx++ ) {
112
+ calc( arry[ indx ].toLowerCase(), table );
113
+ }
114
+ result = ( result + group ) * ( str.match( negativeRegex ) ? -1 : 1 );
115
+ // make sure to let zero get parsed, so check hasOwnProperty
116
+ return result || named.numbers.hasOwnProperty( str ) ? result : $.tablesorter.formatFloat( str || '', table );
117
+ },
118
+ type: "numeric"
119
+ });
120
+
121
+ })( jQuery );