jquery-tablesorter 1.16.0 → 1.16.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: cf80f7e8c0500b21e4c526fd87d688eb6d45d067
4
- data.tar.gz: b6395dc3b8886d12002caa44c097c6ccd4efb8bc
3
+ metadata.gz: 829c54cea1f515c1cfa40720c377143067718de0
4
+ data.tar.gz: 77e79f0f644401ad0dba7ed025fbc41b6176bc65
5
5
  SHA512:
6
- metadata.gz: c8cb6023d3e61aa0e6184124c38642835d876e52da9eb2d5647b4e86b478f2c20669561db9e4a5ce8918c2c46ce1d0a6826aba2d061ca2b77e7f2b178a9f36b1
7
- data.tar.gz: d79e33105295d8fa121b04d8068c27cf897594eb2e4ea8d6cb25f672d901956aa522ffb1d285607c89c3c9a0e16485668a0a67b83b1d7f89bb2d0018f20919ac
6
+ metadata.gz: 18a6169fa726b92e7634f1fa2ddef07ba134c61bae955de9f7290a8f25cabbfad689797fa61a166445990ee802f18d4d2ffe86330d7b0a1708c6e4bb47670998
7
+ data.tar.gz: a5874b4304c01c4899b21a79ca2df2efa86121093769ad4890c7ab8e253d176f8d9017b6ef093abc9f39908f79b2aaa4848d5732021a05e01518b0693193134e
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.21.0 (3/5/2015), [documentation]
7
+ Current tablesorter version: 2.21.1 (3/10/2015), [documentation]
8
8
 
9
9
  Any issue associated with the js/css files, please report to [Mottie's fork].
10
10
 
@@ -26,7 +26,7 @@ Or install it yourself as:
26
26
 
27
27
  Rails 3.2 and higher (tested up to 4.2)
28
28
 
29
- Tested with ruby 1.9.3 - 2.2.0
29
+ Tested with ruby 1.9.3 - 2.2.1
30
30
 
31
31
  ## Usage
32
32
 
@@ -1,3 +1,3 @@
1
1
  module JqueryTablesorter
2
- VERSION = '1.16.0'
2
+ VERSION = '1.16.1'
3
3
  end
@@ -1,4 +1,4 @@
1
- /*! TableSorter (FORK) v2.21.0 *//*
1
+ /*! TableSorter (FORK) v2.21.1 *//*
2
2
  * Client-side table sorting with ease!
3
3
  * @requires jQuery v1.2.6+
4
4
  *
@@ -34,7 +34,7 @@
34
34
 
35
35
  var ts = this;
36
36
 
37
- ts.version = '2.21.0';
37
+ ts.version = '2.21.1';
38
38
 
39
39
  ts.parsers = [];
40
40
  ts.widgets = [];
@@ -502,7 +502,8 @@
502
502
  for (indx = 0; indx < c.columns; indx++) {
503
503
  $t = c.$headers.filter('[data-column="' + indx + '"]');
504
504
  // target sortable column cells, unless there are none, then use non-sortable cells
505
- c.$headerIndexed[indx] = $t.not('.sorter-false').length ? $t.not('.sorter-false').last() : $t.last();
505
+ // .last() added in jQuery 1.4; use .filter(':last') to maintain compatibility with jQuery v1.2.6
506
+ c.$headerIndexed[indx] = $t.not('.sorter-false').length ? $t.not('.sorter-false').filter(':last') : $t.filter(':last');
506
507
  }
507
508
  $(table).find(c.selectorHeaders).attr({
508
509
  scope: 'col',
@@ -563,7 +564,7 @@
563
564
  c.$headers
564
565
  .removeClass(css.join(' '))
565
566
  .addClass(none).attr('aria-sort', 'none')
566
- .find('.' + c.cssIcon)
567
+ .find('.' + ts.css.icon)
567
568
  .removeClass(cssIcon.join(' '))
568
569
  .addClass(cssIcon[2]);
569
570
  for (i = 0; i < len; i++) {
@@ -1224,17 +1225,19 @@
1224
1225
  table = $(table)[0];
1225
1226
  var $h, k,
1226
1227
  c = table.config,
1227
- $cell = ( $headers || c.$headers );
1228
+ $cells = ( $headers || c.$headers ),
1229
+ // c.$headerIndexed is not defined initially
1230
+ $cell = c.$headerIndexed && c.$headerIndexed[indx] || $cells.filter('[data-column="' + indx + '"]:last');
1228
1231
  if (obj[indx]) {
1229
- return getCell ? obj[indx] : obj[$cell.index( $cell.filter('[data-column="' + indx + '"]:last') )];
1232
+ return getCell ? obj[indx] : obj[$cells.index( $cell )];
1230
1233
  }
1231
1234
  for (k in obj) {
1232
1235
  if (typeof k === 'string') {
1233
- $h = $cell.filter('[data-column="' + indx + '"]:last')
1236
+ $h = $cell
1234
1237
  // header cell with class/id
1235
1238
  .filter(k)
1236
1239
  // find elements within the header cell with cell/id
1237
- .add( $cell.filter('[data-column="' + indx + '"]:last').find(k) );
1240
+ .add( $cell.find(k) );
1238
1241
  if ($h.length) {
1239
1242
  return obj[k];
1240
1243
  }
@@ -4,8 +4,18 @@
4
4
  ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██▀▀ ▀▀▀▀██
5
5
  █████▀ ▀████▀ ██ ██ ▀████▀ ██ ██ ██ ██ ▀████▀ █████▀ ██ ██ █████▀
6
6
  */
7
- /*! tablesorter (FORK) widgets - updated 03-05-2015 (v2.21.0)*/
7
+ /*! tablesorter (FORK) widgets - updated 03-10-2015 (v2.21.1)*/
8
8
  /* Includes: storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort */
9
+ (function(factory) {
10
+ if (typeof define === 'function' && define.amd) {
11
+ define(['jquery'], factory);
12
+ } else if (typeof module === 'object' && typeof module.exports === 'object') {
13
+ module.exports = factory(require('jquery'));
14
+ } else {
15
+ factory(jQuery);
16
+ }
17
+ }(function($) {
18
+
9
19
  /*! Widget: storage */
10
20
  ;(function ($, window, document) {
11
21
  'use strict';
@@ -2191,3 +2201,7 @@ ts.addWidget({
2191
2201
  });
2192
2202
 
2193
2203
  })(jQuery);
2204
+
2205
+
2206
+ return $.tablesorter;
2207
+ }));
@@ -55,7 +55,7 @@ $(function(){
55
55
  '.tablesorter-scrollbar-measure { width: 100px; height: 100px; overflow: scroll; position: absolute; top: -9999px; } ' +
56
56
  '.tablesorter-scroller-reset { width: auto !important; } ' +
57
57
  '.tablesorter-scroller { text-align: left; overflow: hidden; }' +
58
- '.tablesorter-scroller-header { overflow: hidden; }' +
58
+ '.tablesorter-scroller-header, .tablesorter-scroller-footer { overflow: hidden; }' +
59
59
  '.tablesorter-scroller-header table.tablesorter { margin-bottom: 0; }' +
60
60
  '.tablesorter-scroller-footer table.tablesorter thead { visibility: hidden, height: 0; overflow: hidden; }' +
61
61
  '.tablesorter-scroller-table { overflow-y: scroll; }' +
@@ -96,8 +96,8 @@ ts.addWidget({
96
96
  });
97
97
  },
98
98
  format: function(table, c, wo) {
99
- var maxHt, tbHt, $hdr, $t, resize, getBarWidth, $hCells, $fCells,
100
- $ft = [],
99
+ var maxHt, tbHt, $hdr, $t, resize, getBarWidth, $hCells, $fCells, $tblWrap,
100
+ $ft = $(),
101
101
  // c.namespace contains a unique tablesorter ID, per table
102
102
  id = c.namespace.slice(1) + 'tsscroller',
103
103
  $win = $(window),
@@ -145,6 +145,7 @@ ts.addWidget({
145
145
 
146
146
  // use max-height, so the height resizes dynamically while filtering
147
147
  $tbl.wrap('<div class="tablesorter-scroller-table" style="max-height:' + maxHt + 'px;" />');
148
+ $tblWrap = $tbl.parent();
148
149
 
149
150
  // make scroller header sortable
150
151
  ts.bindEvents(table, $hCells);
@@ -164,7 +165,7 @@ ts.addWidget({
164
165
  };
165
166
 
166
167
  resize = function(){
167
- var d, b, $h, w,
168
+ var b, $h, $f, w,
168
169
  // Hide other scrollers so we can resize
169
170
  $div = $('div.tablesorter-scroller[id != "' + id + '"]').hide();
170
171
 
@@ -180,19 +181,48 @@ ts.addWidget({
180
181
  .children('thead')
181
182
  .find('.tablesorter-header-inner').addClass('tablesorter-scroller-reset').end()
182
183
  .find('.tablesorter-filter-row').show();
183
- d = $tbl.parent();
184
- d.addClass('tablesorter-scroller-reset');
184
+ $tblWrap.addClass('tablesorter-scroller-reset');
185
185
 
186
- d.parent().trigger('resize');
186
+ $tblWrap.parent().trigger('resize');
187
187
 
188
188
  // include left & right border widths
189
189
  b = parseInt( $tbl.css('border-left-width'), 10 ) + parseInt( $tbl.css('border-right-width'), 10 );
190
190
 
191
191
  // Shrink a bit to accommodate scrollbar
192
192
  w = ( wo.scroller_barWidth || getBarWidth() ) + b;
193
- d.width( d.parent().innerWidth() - ( d.parent().hasScrollBar() ? w : 0 ) );
194
- w = d.innerWidth() - ( d.hasScrollBar() ? w : 0 );
195
- $tbl.add( $hdr ).add( $hdr.parent() ).add( $ft ).width( w );
193
+
194
+ $tblWrap.width( $tblWrap.parent().innerWidth() - ( $tblWrap.parent().hasScrollBar() ? w : 0 ) );
195
+ w = $tblWrap.innerWidth() - ( $tblWrap.hasScrollBar() ? w : 0 );
196
+ $hdr.parent().add( $ft.parent() ).width( w );
197
+
198
+ w = $tbl.width();
199
+
200
+ $h = $hdr.children('thead').children().children('th, td').filter(':visible');
201
+ $f = $ft.children('tfoot').children().children('th, td').filter(':visible');
202
+ $tbl.children('thead').children().eq(0).children('th, td').each(function(indx, el) {
203
+ var width, border,
204
+ $this = $(this);
205
+ // code from https://github.com/jmosbech/StickyTableHeaders
206
+ if ($this.css('box-sizing') === 'border-box') {
207
+ width = $this.outerWidth();
208
+ } else {
209
+ if ($h.eq(indx).css('border-collapse') === 'collapse') {
210
+ if (window.getComputedStyle) {
211
+ width = parseFloat( window.getComputedStyle(this, null).width );
212
+ } else {
213
+ // ie8 only
214
+ border = parseFloat( $this.css('border-width') );
215
+ width = $this.outerWidth() - parseFloat( $this.css('padding-left') ) - parseFloat( $this.css('padding-right') ) - border;
216
+ }
217
+ } else {
218
+ width = $this.width();
219
+ }
220
+ }
221
+ $h.eq(indx).add( $f.eq(indx) ).css({
222
+ 'min-width': width,
223
+ 'max-width': width
224
+ });
225
+ });
196
226
 
197
227
  $tbl
198
228
  .closest('.tablesorter-scroller')
@@ -224,17 +254,17 @@ ts.addWidget({
224
254
  $tbl.find('thead').css('visibility', 'hidden');
225
255
  c.isScrolling = true;
226
256
 
227
- tbHt = $tbl.parent().parent().height();
257
+ tbHt = $tblWrap.parent().height();
228
258
 
229
259
  // The header will always jump into view if scrolling the table body
230
- $tbl.parent().bind('scroll', function(){
260
+ $tblWrap.bind('scroll', function(){
231
261
  if (wo.scroller_jumpToHeader) {
232
262
  var pos = $win.scrollTop() - $hdr.offset().top;
233
263
  if ($(this).scrollTop() !== 0 && pos < tbHt && pos > 0) {
234
264
  $win.scrollTop( $hdr.offset().top );
235
265
  }
236
266
  }
237
- $hdr.parent().scrollLeft( $(this).scrollLeft() );
267
+ $hdr.parent().add( $ft.parent() ).scrollLeft( $(this).scrollLeft() );
238
268
  });
239
269
 
240
270
  }
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.16.0
4
+ version: 1.16.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: 2015-03-05 00:00:00.000000000 Z
12
+ date: 2015-03-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties