jquery-tablesorter 1.12.0 → 1.12.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 65ae3cb21c44ee0f6bfee2c97b57b137ae72b4eb
4
- data.tar.gz: 8497edb9c98963bd4645d158c8b161467646d23a
3
+ metadata.gz: 3d57d330a80b51accce3abd18b155fdc9d5bcf78
4
+ data.tar.gz: 9606f1dd2b1fab6e6c6701ff8cb665f1b32f1f6a
5
5
  SHA512:
6
- metadata.gz: 297953c27301fe09470785ac076576f262ed73f4c8847a2b8da5d0485e9f4bd629755b586021d5ca11a859972a950825cf0f16306de247ddedd0e30e09f1e51a
7
- data.tar.gz: 9c2d2ee68462a3c05b1a35c9294bd0fd4c2d22daf20949aed52dc1d37e133ea4f4b541f0cb7fa4d6503d6fa7132605de69597b798dc65865c212b0376c8c0234
6
+ metadata.gz: 9c38d8e463b16af2634b959fe1da80530899565e55adc9e9cf0c136534e15ef3a4ec481311d77318d6a0ff12bcb229b4f116e5d3c1cf5d73f396242fdb0ef034
7
+ data.tar.gz: 1913baee25edf188ced214be19a75f5a5a36bf3d2667b53c59c34b3a3dca66c61e88e508b0cd5b5ba5cca11d113cfa0161220a32ceb51e7f9788c905c6557cdc
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  Simple integration of jquery-tablesorter into the asset pipeline.
6
6
 
7
- Current tablesorter version: 2.17.0 (5/22/2014), [documentation]
7
+ Current tablesorter version: 2.17.1 (5/28/2014), [documentation]
8
8
 
9
9
  Any issue associated with the js/css files, please report to [Mottie's fork].
10
10
 
@@ -1,3 +1,3 @@
1
1
  module JqueryTablesorter
2
- VERSION = '1.12.0'
2
+ VERSION = '1.12.1'
3
3
  end
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * tablesorter pager plugin
3
- * updated 5/22/2014 (v2.17.0)
3
+ * updated 5/28/2014 (v2.17.1)
4
4
  */
5
5
  /*jshint browser:true, jquery:true, unused:false */
6
6
  ;(function($) {
@@ -67,7 +67,7 @@
67
67
 
68
68
  // Save pager page & size if the storage script is loaded (requires $.tablesorter.storage in jquery.tablesorter.widgets.js)
69
69
  savePages: true,
70
-
70
+
71
71
  // defines custom storage key
72
72
  storageKey: 'tablesorter-pager',
73
73
 
@@ -271,7 +271,7 @@
271
271
  c = table.config,
272
272
  $t = c.$table,
273
273
  tds = '',
274
- result = p.ajaxProcessing(data, table) || [ 0, [] ],
274
+ result = p.ajaxProcessing(data, table, xhr) || [ 0, [] ],
275
275
  hl = $t.find('thead th').length;
276
276
 
277
277
  // Clean up any previous error.
@@ -368,10 +368,13 @@
368
368
  fixHeight(table, p);
369
369
  $t.trigger('updateCache', [function(){
370
370
  if (p.initialized) {
371
- // apply widgets after table has rendered
372
- $t
373
- .trigger('applyWidgets')
374
- .trigger('pagerChange', p);
371
+ // apply widgets after table has rendered & after a delay to prevent
372
+ // multiple applyWidget blocking code from blocking this trigger
373
+ setTimeout(function(){
374
+ $t
375
+ .trigger('applyWidgets')
376
+ .trigger('pagerChange', p);
377
+ }, 0);
375
378
  }
376
379
  }]);
377
380
 
@@ -401,12 +404,12 @@
401
404
  counter = ++p.ajaxCounter;
402
405
 
403
406
  p.ajaxObject.url = url; // from the ajaxUrl option and modified by customAjaxUrl
404
- p.ajaxObject.success = function(data) {
407
+ p.ajaxObject.success = function(data, status, jqxhr) {
405
408
  // Refuse to process old ajax commands that were overwritten by new ones - see #443
406
409
  if (counter < p.ajaxCounter){
407
410
  return;
408
411
  }
409
- renderAjax(data, table, p);
412
+ renderAjax(data, table, p, jqxhr);
410
413
  $doc.unbind('ajaxError.pager');
411
414
  if (typeof p.oldAjaxSuccess === 'function') {
412
415
  p.oldAjaxSuccess(data);
@@ -484,7 +487,7 @@
484
487
  // if filtered, start from zero
485
488
  index = f ? 0 : s;
486
489
  count = f ? 0 : s;
487
- added = 0;
490
+ added = 0;
488
491
  while (added < e && index < rows.length) {
489
492
  if (!f || !/filtered/.test(rows[index][0].className)){
490
493
  count++;
@@ -1,5 +1,5 @@
1
1
  /**!
2
- * TableSorter 2.17.0 - Client-side table sorting with ease!
2
+ * TableSorter 2.17.1 - 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.17.0";
27
+ ts.version = "2.17.1";
28
28
 
29
29
  ts.parsers = [];
30
30
  ts.widgets = [];
@@ -219,7 +219,7 @@
219
219
  var c = table.config,
220
220
  // update table bodies in case we start with an empty table
221
221
  tb = c.$tbodies = c.$table.children('tbody:not(.' + c.cssInfoBlock + ')'),
222
- rows, list, l, i, h, ch, p, time,
222
+ rows, list, l, i, h, ch, np, p, time,
223
223
  j = 0,
224
224
  parsersDebug = "",
225
225
  len = tb.length;
@@ -240,17 +240,21 @@
240
240
  ch = ts.getColumnData( table, c.headers, i );
241
241
  // get column parser
242
242
  p = ts.getParserById( ts.getData(h, ch, 'sorter') );
243
+ np = ts.getData(h, ch, 'parser') === 'false';
243
244
  // empty cells behaviour - keeping emptyToBottom for backwards compatibility
244
245
  c.empties[i] = ts.getData(h, ch, 'empty') || c.emptyTo || (c.emptyToBottom ? 'bottom' : 'top' );
245
246
  // text strings behaviour in numerical sorts
246
247
  c.strings[i] = ts.getData(h, ch, 'string') || c.stringTo || 'max';
248
+ if (np) {
249
+ p = ts.getParserById('no-parser');
250
+ }
247
251
  if (!p) {
248
252
  p = detectParserForColumn(table, rows, -1, i);
249
253
  }
250
254
  if (c.debug) {
251
255
  parsersDebug += "column:" + i + "; parser:" + p.id + "; string:" + c.strings[i] + '; empty: ' + c.empties[i] + "\n";
252
256
  }
253
- list.push(p);
257
+ list[i] = p;
254
258
  }
255
259
  }
256
260
  j += (list.length) ? len : 1;
@@ -327,7 +331,7 @@
327
331
  t = getElementText(table, $row[0].cells[j], j);
328
332
  // allow parsing if the string is empty, previously parsing would change it to zero,
329
333
  // in case the parser needs to extract data from the table cell attributes
330
- v = parsers[j].format(t, table, $row[0].cells[j], j);
334
+ v = parsers[j].id === 'no-parser' ? '' : parsers[j].format(t, table, $row[0].cells[j], j);
331
335
  cols.push(v);
332
336
  if ((parsers[j].type || '').toLowerCase() === "numeric") {
333
337
  // determine column max value (ignore sign)
@@ -839,7 +843,8 @@
839
843
  row = $tb.eq(tbdy).find('tr').index( $row );
840
844
  icell = $cell.index();
841
845
  c.cache[tbdy].normalized[row][c.columns].$row = $row;
842
- v = c.cache[tbdy].normalized[row][icell] = c.parsers[icell].format( getElementText(table, cell, icell), table, cell, icell );
846
+ v = c.cache[tbdy].normalized[row][icell] = c.parsers[icell].id === 'no-parser' ? '' :
847
+ c.parsers[icell].format( getElementText(table, cell, icell), table, cell, icell );
843
848
  if ((c.parsers[icell].type || '').toLowerCase() === "numeric") {
844
849
  // update column max value (ignore sign)
845
850
  c.cache[tbdy].colMax[icell] = Math.max(Math.abs(v) || 0, c.cache[tbdy].colMax[icell] || 0);
@@ -874,7 +879,8 @@
874
879
  };
875
880
  // add each cell
876
881
  for (j = 0; j < l; j++) {
877
- cells[j] = c.parsers[j].format( getElementText(table, $row[i].cells[j], j), table, $row[i].cells[j], j );
882
+ cells[j] = c.parsers[j].id === 'no-parser' ? '' :
883
+ c.parsers[j].format( getElementText(table, $row[i].cells[j], j), table, $row[i].cells[j], j );
878
884
  if ((c.parsers[j].type || '').toLowerCase() === "numeric") {
879
885
  // update column max value (ignore sign)
880
886
  c.cache[tbdy].colMax[j] = Math.max(Math.abs(cells[j]) || 0, c.cache[tbdy].colMax[j] || 0);
@@ -947,7 +953,7 @@
947
953
  e.stopPropagation();
948
954
  ts.destroy(table, c, cb);
949
955
  })
950
- .bind("resetToLoadState" + c.namespace, function(e){
956
+ .bind("resetToLoadState" + c.namespace, function(){
951
957
  // remove all widgets
952
958
  ts.refreshWidgets(table, true, true);
953
959
  // restore original settings; this clears out current settings, but does not clear
@@ -1225,7 +1231,7 @@
1225
1231
  // set timer on mousedown
1226
1232
  if (type === 'mousedown') {
1227
1233
  downTime = new Date().getTime();
1228
- return e.target.tagName === "INPUT" ? '' : !c.cancelSelection;
1234
+ return /(input|select|button|textarea)/i.test(e.target.tagName) ? '' : !c.cancelSelection;
1229
1235
  }
1230
1236
  if (c.delayInit && isEmptyObject(c.cache)) { buildCache(table); }
1231
1237
  // jQuery v1.2.6 doesn't have closest()
@@ -1630,6 +1636,17 @@
1630
1636
  });
1631
1637
 
1632
1638
  // add default parsers
1639
+ ts.addParser({
1640
+ id: 'no-parser',
1641
+ is: function() {
1642
+ return false;
1643
+ },
1644
+ format: function() {
1645
+ return '';
1646
+ },
1647
+ type: 'text'
1648
+ });
1649
+
1633
1650
  ts.addParser({
1634
1651
  id: "text",
1635
1652
  is: function() {
@@ -1,4 +1,4 @@
1
- /*! tableSorter 2.16+ widgets - updated 5/22/2014 (v2.17.0)
1
+ /*! tableSorter 2.16+ widgets - updated 5/28/2014 (v2.17.1)
2
2
  *
3
3
  * Column Styles
4
4
  * Column Filters
@@ -458,6 +458,21 @@ ts.filter = {
458
458
  }
459
459
  return null;
460
460
  },
461
+ // Look for a not match
462
+ notMatch: function( filter, iFilter, exact, iExact, cached, index, table, wo ) {
463
+ if ( /^\!/.test(iFilter) ) {
464
+ iFilter = iFilter.replace('!', '');
465
+ if (ts.filter.regex.exact.test(iFilter)) {
466
+ // look for exact not matches - see #628
467
+ iFilter = iFilter.replace(ts.filter.regex.exact, '');
468
+ return iFilter === '' ? true : $.trim(iFilter) !== iExact;
469
+ } else {
470
+ var indx = iExact.search( $.trim(iFilter) );
471
+ return iFilter === '' ? true : !(wo.filter_startsWith ? indx === 0 : indx >= 0);
472
+ }
473
+ }
474
+ return null;
475
+ },
461
476
  // Look for quotes or equals to get an exact match; ignore type since iExact could be numeric
462
477
  exact: function( filter, iFilter, exact, iExact, cached, index, table, wo, parsed, rowArray ) {
463
478
  /*jshint eqeqeq:false */
@@ -467,15 +482,6 @@ ts.filter = {
467
482
  }
468
483
  return null;
469
484
  },
470
- // Look for a not match
471
- notMatch: function( filter, iFilter, exact, iExact, cached, index, table, wo ) {
472
- if ( /^\!/.test(iFilter) ) {
473
- iFilter = iFilter.replace('!', '');
474
- var indx = iExact.search( $.trim(iFilter) );
475
- return iFilter === '' ? true : !(wo.filter_startsWith ? indx === 0 : indx >= 0);
476
- }
477
- return null;
478
- },
479
485
  // Look for an AND or && operator (logical and)
480
486
  and : function( filter, iFilter, exact, iExact ) {
481
487
  if ( ts.filter.regex.andTest.test(filter) ) {
@@ -1,5 +1,5 @@
1
1
  /*! input & select parsers for jQuery 1.7+ & tablesorter 2.7.11+
2
- * Updated 4/27/2014 (v2.16.2)
2
+ * Updated 5/28/2014 (v2.17.1)
3
3
  * Demo: http://mottie.github.com/tablesorter/docs/example-widget-grouping.html
4
4
  */
5
5
  /*jshint browser: true, jquery:true, unused:false */
@@ -71,17 +71,20 @@
71
71
  $(window).load(function(){
72
72
  // this flag prevents the updateCell event from being spammed
73
73
  // it happens when you modify input text and hit enter
74
- var alreadyUpdating = false;
75
- $('table').find('tbody').on('change', 'select, input', function(e){
74
+ var alreadyUpdating = false,
75
+ t = $.tablesorter.css.table || 'tablesorter';
76
+ // bind to .tablesorter (default class name)
77
+ $('.' + t).find('tbody').on('change', 'select, input', function(e){
76
78
  if (!alreadyUpdating) {
77
79
  var $tar = $(e.target),
78
80
  $cell = $tar.closest('td'),
79
81
  $table = $cell.closest('table'),
80
82
  indx = $cell[0].cellIndex,
81
- c = $table[0].config,
83
+ c = $table[0].config || false,
82
84
  $hdr = c && c.$headers && c.$headers.eq(indx);
83
- // don't use updateCell if column is set to "sorter-false" and "filter-false"
84
- if ($hdr.length && $hdr.hasClass('sorter-false') && $hdr.hasClass('filter-false')){
85
+ // abort if not a tablesorter table, or
86
+ // don't use updateCell if column is set to "sorter-false" and "filter-false", or column is set to "parser-false"
87
+ if ( !c || ( $hdr && $hdr.length && ( $hdr.hasClass('parser-false') || ($hdr.hasClass('sorter-false') && $hdr.hasClass('filter-false')) ) ) ){
85
88
  return false;
86
89
  }
87
90
  alreadyUpdating = true;
@@ -1,4 +1,4 @@
1
- /*! tablesorter math widget - beta - updated 5/22/2014 (v2.17.0)
1
+ /*! tablesorter math widget - beta - updated 5/28/2014 (v2.17.1)
2
2
  * Requires tablesorter v2.16+ and jQuery 1.7+
3
3
  * by Rob Garrison
4
4
  */
@@ -12,7 +12,8 @@
12
12
 
13
13
  // get all of the row numerical values in an arry
14
14
  getRow : function(table, wo, $el, dataAttrib) {
15
- var txt,
15
+ var $t, txt,
16
+ c = table.config,
16
17
  arry = [],
17
18
  $row = $el.closest('tr'),
18
19
  $cells = $row.children();
@@ -21,7 +22,11 @@
21
22
  $cells = $cells.not('[' + dataAttrib + '=ignore]').not('[data-column=' + wo.math_ignore.join('],[data-column=') + ']');
22
23
  }
23
24
  arry = $cells.not($el).map(function(){
24
- txt = this.textContent || $(this).text();
25
+ $t = $(this);
26
+ txt = $t.attr(c.textAttribute);
27
+ if (typeof txt === "undefined") {
28
+ txt = this.textContent || $t.text();
29
+ }
25
30
  txt = ts.formatFloat(txt.replace(/[^\w,. \-()]/g, ""), table);
26
31
  return isNaN(txt) ? 0 : txt;
27
32
  }).get();
@@ -52,7 +57,10 @@
52
57
  if (mathAbove) {
53
58
  i = 0;
54
59
  } else if ($t.length) {
55
- txt = $t[0].textContent || $t.text();
60
+ txt = $t.attr(c.textAttribute);
61
+ if (typeof txt === "undefined") {
62
+ txt = $t[0].textContent || $t.text();
63
+ }
56
64
  txt = ts.formatFloat(txt.replace(/[^\w,. \-()]/g, ""), table);
57
65
  arry.push(isNaN(txt) ? 0 : txt);
58
66
  }
@@ -63,7 +71,10 @@
63
71
  $rows.each(function(){
64
72
  $t = $(this).children().filter('[data-column=' + cIndex + ']');
65
73
  if (!$(this).hasClass(filtered) && $t.not('[' + dataAttrib + '^=above],[' + dataAttrib + '^=col]').length && !$t.is($el)) {
66
- txt = ($t[0] ? $t[0].textContent : '') || $t.text();
74
+ txt = $t.attr(c.textAttribute);
75
+ if (typeof txt === "undefined") {
76
+ txt = ($t[0] ? $t[0].textContent : '') || $t.text();
77
+ }
67
78
  txt = ts.formatFloat(txt.replace(/[^\w,. \-()]/g, ""), table);
68
79
  arry.push(isNaN(txt) ? 0 : txt);
69
80
  }
@@ -85,7 +96,10 @@
85
96
  $t = $(this);
86
97
  col = parseInt( $t.attr('data-column'), 10);
87
98
  if (!$t.filter('[' + dataAttrib + ']').length && $.inArray(col, wo.math_ignore) < 0) {
88
- txt = ($t[0] ? $t[0].textContent : '') || $t.text();
99
+ txt = $t.attr(c.textAttribute);
100
+ if (typeof txt === "undefined") {
101
+ txt = ($t[0] ? $t[0].textContent : '') || $t.text();
102
+ }
89
103
  txt = ts.formatFloat(txt.replace(/[^\w,. \-()]/g, ""), table);
90
104
  arry.push(isNaN(txt) ? 0 : txt);
91
105
  }
@@ -1,4 +1,4 @@
1
- /* Pager widget (beta) for TableSorter 5/22/2014 (v2.17.0) */
1
+ /* Pager widget (beta) for TableSorter 5/28/2014 (v2.17.1) */
2
2
  /*jshint browser:true, jquery:true, unused:false */
3
3
  ;(function($){
4
4
  "use strict";
@@ -480,7 +480,7 @@ tsp = ts.pager = {
480
480
  var i, j, t, hsh, $f, $sh, th, d, l, rr_count,
481
481
  $t = c.$table,
482
482
  tds = '',
483
- result = wo.pager_ajaxProcessing(data, table) || [ 0, [] ],
483
+ result = wo.pager_ajaxProcessing(data, table, xhr) || [ 0, [] ],
484
484
  hl = $t.find('thead th').length;
485
485
 
486
486
  // Clean up any previous error.
@@ -570,9 +570,13 @@ tsp = ts.pager = {
570
570
  tsp.fixHeight(table, c);
571
571
  $t.trigger('updateCache', [function(){
572
572
  if (p.initialized) {
573
- // apply widgets after table has rendered
574
- $t.trigger('applyWidgets');
575
- $t.trigger('pagerChange', p);
573
+ // apply widgets after table has rendered & after a delay to prevent
574
+ // multiple applyWidget blocking code from blocking this trigger
575
+ setTimeout(function(){
576
+ $t
577
+ .trigger('applyWidgets')
578
+ .trigger('pagerChange', p);
579
+ }, 0);
576
580
  }
577
581
  }]);
578
582
  }
@@ -597,12 +601,12 @@ tsp = ts.pager = {
597
601
  });
598
602
  counter = ++p.ajaxCounter;
599
603
  wo.pager_ajaxObject.url = url; // from the ajaxUrl option and modified by customAjaxUrl
600
- wo.pager_ajaxObject.success = function(data) {
604
+ wo.pager_ajaxObject.success = function(data, status, jqxhr) {
601
605
  // Refuse to process old ajax commands that were overwritten by new ones - see #443
602
606
  if (counter < p.ajaxCounter){
603
607
  return;
604
608
  }
605
- tsp.renderAjax(data, table, c);
609
+ tsp.renderAjax(data, table, c, jqxhr);
606
610
  $doc.unbind('ajaxError.pager');
607
611
  if (typeof p.oldAjaxSuccess === 'function') {
608
612
  p.oldAjaxSuccess(data);
@@ -682,7 +686,7 @@ tsp = ts.pager = {
682
686
  // if filtered, start from zero
683
687
  index = f ? 0 : s;
684
688
  count = f ? 0 : s;
685
- added = 0;
689
+ added = 0;
686
690
  while (added < e && index < rows.length) {
687
691
  if (!f || !/filtered/.test(rows[index][0].className)){
688
692
  count++;
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jquery-tablesorter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.0
4
+ version: 1.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jun Lin
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-22 00:00:00.000000000 Z
12
+ date: 2014-05-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties