jquery-tablesorter 1.10.1 → 1.10.10

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.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/{README.markdown → README.md} +8 -3
  3. data/Rakefile +39 -35
  4. data/lib/jquery-tablesorter/version.rb +1 -1
  5. data/lib/jquery-tablesorter.rb +1 -1
  6. data/vendor/assets/javascripts/jquery-tablesorter/addons/pager/jquery.tablesorter.pager.js +66 -29
  7. data/vendor/assets/javascripts/jquery-tablesorter/extras/jquery.quicksearch.js +191 -0
  8. data/vendor/assets/javascripts/jquery-tablesorter/extras/semver-mod.js +1026 -0
  9. data/vendor/assets/javascripts/jquery-tablesorter/extras/semver.js +1011 -0
  10. data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.js +156 -99
  11. data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.widgets-filter-formatter.js +22 -22
  12. data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.widgets.js +68 -42
  13. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-iso8601.js +34 -0
  14. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-month.js +33 -0
  15. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-two-digit-year.js +74 -0
  16. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-weekday.js +33 -0
  17. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date.js +36 -0
  18. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-feet-inch-fraction.js +63 -0
  19. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-file-type.js +73 -0
  20. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-ignore-articles.js +47 -0
  21. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-input-select.js +87 -0
  22. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-ipv6.js +76 -0
  23. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-metric.js +77 -0
  24. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-alignChar.js +145 -0
  25. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-build-table.js +441 -0
  26. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-columnSelector.js +306 -0
  27. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-cssStickyHeaders.js +67 -0
  28. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-editable.js +89 -0
  29. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-grouping.js +249 -0
  30. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-headerTitles.js +91 -0
  31. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-pager.js +864 -0
  32. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-repeatheaders.js +50 -0
  33. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-scroller.js +241 -0
  34. data/vendor/assets/stylesheets/jquery-tablesorter/theme.black-ice.css +4 -0
  35. data/vendor/assets/stylesheets/jquery-tablesorter/theme.blue.css +4 -0
  36. data/vendor/assets/stylesheets/jquery-tablesorter/theme.bootstrap.css +14 -5
  37. data/vendor/assets/stylesheets/jquery-tablesorter/theme.bootstrap_2.css +4 -0
  38. data/vendor/assets/stylesheets/jquery-tablesorter/theme.dark.css +4 -0
  39. data/vendor/assets/stylesheets/jquery-tablesorter/theme.default.css +4 -0
  40. data/vendor/assets/stylesheets/jquery-tablesorter/theme.dropbox.css +4 -0
  41. data/vendor/assets/stylesheets/jquery-tablesorter/theme.green.css +4 -0
  42. data/vendor/assets/stylesheets/jquery-tablesorter/theme.grey.css +4 -0
  43. data/vendor/assets/stylesheets/jquery-tablesorter/theme.ice.css +4 -0
  44. data/vendor/assets/stylesheets/jquery-tablesorter/theme.jui.css +9 -3
  45. metadata +28 -12
  46. data/vendor/assets/images/jquery-tablesorter/dropbox-asc1.png +0 -0
  47. data/vendor/assets/images/jquery-tablesorter/dropbox-asc2.png +0 -0
  48. data/vendor/assets/images/jquery-tablesorter/dropbox-desc1.png +0 -0
  49. data/vendor/assets/images/jquery-tablesorter/dropbox-desc2.png +0 -0
  50. data/vendor/assets/images/jquery-tablesorter/green-asc.png +0 -0
  51. data/vendor/assets/images/jquery-tablesorter/green-desc.png +0 -0
  52. data/vendor/assets/images/jquery-tablesorter/green-header.png +0 -0
  53. data/vendor/assets/images/jquery-tablesorter/green-unsorted.png +0 -0
@@ -0,0 +1,249 @@
1
+ /*! tablesorter Grouping widget - updated 3/7/2014 (core v2.15.6)
2
+ * Requires tablesorter v2.8+ and jQuery 1.7+
3
+ * by Rob Garrison
4
+ */
5
+ /*jshint browser:true, jquery:true, unused:false */
6
+ /*global jQuery: false */
7
+ ;(function($){
8
+ "use strict";
9
+ var ts = $.tablesorter;
10
+
11
+ ts.grouping = {
12
+
13
+ types : {
14
+ number : function(c, $column, txt, num, group){
15
+ var value, word;
16
+ if (num > 1 && txt !== '') {
17
+ if ($column.hasClass(ts.css.sortAsc)) {
18
+ value = Math.floor(parseFloat(txt)/num) * num;
19
+ return value > parseFloat(group || 0) ? value : parseFloat(group || 0);
20
+ } else {
21
+ value = Math.ceil(parseFloat(txt)/num) * num;
22
+ return value < parseFloat(group || num) - value ? parseFloat(group || num) - value : value;
23
+ }
24
+ } else {
25
+ word = (txt + '').match(/\d+/g);
26
+ return word && word.length >= num ? word[num - 1] : txt || '';
27
+ }
28
+ },
29
+ separator : function(c, $column, txt, num){
30
+ var word = (txt + '').split(c.widgetOptions.group_separator);
31
+ return $.trim(word && num > 0 && word.length >= num ? word[(num || 1) - 1] : '');
32
+ },
33
+ word : function(c, $column, txt, num){
34
+ var word = (txt + ' ').match(/\w+/g);
35
+ return word && word.length >= num ? word[num - 1] : txt || '';
36
+ },
37
+ letter : function(c, $column, txt, num){
38
+ return txt ? (txt + ' ').substring(0, num) : '';
39
+ },
40
+ date : function(c, $column, txt, part, group){
41
+ var wo = c.widgetOptions,
42
+ time = new Date(txt || ''),
43
+ hours = time.getHours();
44
+ return part === 'year' ? time.getFullYear() :
45
+ part === 'month' ? wo.group_months[time.getMonth()] :
46
+ part === 'day' ? wo.group_months[time.getMonth()] + ' ' + time.getDate() :
47
+ part === 'week' ? wo.group_week[time.getDay()] :
48
+ part === 'time' ? ('00' + (hours > 12 ? hours - 12 : hours === 0 ? hours + 12 : hours)).slice(-2) + ':' +
49
+ ('00' + time.getMinutes()).slice(-2) + ' ' + ('00' + wo.group_time[hours >= 12 ? 1 : 0]).slice(-2) :
50
+ wo.group_dateString(time);
51
+ }
52
+ },
53
+
54
+ update : function(table, c, wo){
55
+ if ($.isEmptyObject(c.cache)) { return; }
56
+ var rowIndex, tbodyIndex, currentGroup, $rows, groupClass, grouping, time, cache, saveName, direction,
57
+ lang = wo.grouping_language,
58
+ group = '',
59
+ savedGroup = false,
60
+ column = c.sortList[0] ? c.sortList[0][0] : -1;
61
+ c.$table
62
+ .find('tr.group-hidden').removeClass('group-hidden').end()
63
+ .find('tr.group-header').remove();
64
+ if (wo.group_collapsible) {
65
+ // clear pager saved spacer height (in case the rows are collapsed)
66
+ c.$table.data('pagerSavedHeight', 0);
67
+ }
68
+ if (column >= 0 && !c.$headers.filter('[data-column="' + column + '"]:last').hasClass('group-false')) {
69
+ if (c.debug){ time = new Date(); }
70
+ wo.group_currentGroup = ''; // save current groups
71
+ wo.group_currentGroups = {};
72
+
73
+ // group class finds "group-{word/separator/letter/number/date/false}-{optional:#/year/month/day/week/time}"
74
+ groupClass = (c.$headers.filter('[data-column="' + column + '"]:last').attr('class') || '').match(/(group-\w+(-\w+)?)/g);
75
+ // grouping = [ 'group', '{word/separator/letter/number/date/false}', '{#/year/month/day/week/time}' ]
76
+ grouping = groupClass ? groupClass[0].split('-') : ['group','letter',1]; // default to letter 1
77
+
78
+ // save current grouping
79
+ if (wo.group_collapsible && wo.group_saveGroups && ts.storage) {
80
+ wo.group_currentGroups = ts.storage( table, 'tablesorter-groups' ) || {};
81
+ // include direction when grouping numbers > 1 (reversed direction shows different range values)
82
+ direction = (grouping[1] === 'number' && grouping[2] > 1) ? 'dir' + c.sortList[0][1] : '';
83
+ // combine column, sort direction & grouping as save key
84
+ saveName = wo.group_currentGroup = '' + column + direction + grouping.join('');
85
+ if (!wo.group_currentGroups[saveName]) {
86
+ wo.group_currentGroups[saveName] = [];
87
+ } else {
88
+ savedGroup = true;
89
+ }
90
+ }
91
+ for (tbodyIndex = 0; tbodyIndex < c.$tbodies.length; tbodyIndex++) {
92
+ cache = c.cache[tbodyIndex].normalized;
93
+ group = ''; // clear grouping across tbodies
94
+ $rows = c.$tbodies.eq(tbodyIndex).children('tr').not('.' + c.cssChildRow);
95
+ for (rowIndex = 0; rowIndex < $rows.length; rowIndex++) {
96
+ if ( $rows.eq(rowIndex).is(':visible') ) {
97
+ // fixes #438
98
+ if (ts.grouping.types[grouping[1]]) {
99
+ currentGroup = cache[rowIndex] ?
100
+ ts.grouping.types[grouping[1]]( c, c.$headers.filter('[data-column="' + column + '"]:last'), cache[rowIndex][column], /date/.test(groupClass) ?
101
+ grouping[2] : parseInt(grouping[2] || 1, 10) || 1, group, lang ) : currentGroup;
102
+ if (group !== currentGroup) {
103
+ group = currentGroup;
104
+ // show range if number > 1
105
+ if (grouping[1] === 'number' && grouping[2] > 1 && currentGroup !== '') {
106
+ currentGroup += ' - ' + (parseInt(currentGroup, 10) +
107
+ ((parseInt(grouping[2],10) - 1) * (c.$headers.filter('[data-column="' + column + '"]:last').hasClass(ts.css.sortAsc) ? 1 : -1)));
108
+ }
109
+ if ($.isFunction(wo.group_formatter)) {
110
+ currentGroup = wo.group_formatter((currentGroup || '').toString(), column, table, c, wo) || currentGroup;
111
+ }
112
+ $rows.eq(rowIndex).before('<tr class="group-header ' + c.selectorRemove.slice(1) +
113
+ '" unselectable="on"><td colspan="' +
114
+ c.columns + '">' + (wo.group_collapsible ? '<i/>' : '') + '<span class="group-name">' +
115
+ currentGroup + '</span><span class="group-count"></span></td></tr>');
116
+ if (wo.group_saveGroups && !savedGroup && wo.group_collapsed && wo.group_collapsible) {
117
+ // all groups start collapsed
118
+ wo.group_currentGroups[wo.group_currentGroup].push(currentGroup);
119
+ }
120
+ }
121
+ }
122
+ }
123
+ }
124
+ }
125
+ c.$table.find('tr.group-header')
126
+ .bind('selectstart', false)
127
+ .each(function(){
128
+ var isHidden, $label, name,
129
+ $row = $(this),
130
+ $rows = $row.nextUntil('tr.group-header').filter(':visible');
131
+ if (wo.group_count || $.isFunction(wo.group_callback)) {
132
+ $label = $row.find('.group-count');
133
+ if ($label.length) {
134
+ if (wo.group_count) {
135
+ $label.html( wo.group_count.replace(/\{num\}/g, $rows.length) );
136
+ }
137
+ if ($.isFunction(wo.group_callback)) {
138
+ wo.group_callback($row.find('td'), $rows, column, table);
139
+ }
140
+ }
141
+ }
142
+ if (wo.group_saveGroups && wo.group_currentGroups[wo.group_currentGroup].length) {
143
+ name = $row.find('.group-name').text().toLowerCase();
144
+ isHidden = $.inArray( name, wo.group_currentGroups[wo.group_currentGroup] ) > -1;
145
+ $row.toggleClass('collapsed', isHidden);
146
+ $rows.toggleClass('group-hidden', isHidden);
147
+ } else if (wo.group_collapsed && wo.group_collapsible) {
148
+ $row.addClass('collapsed');
149
+ $rows.addClass('group-hidden');
150
+ }
151
+ });
152
+ c.$table.trigger(wo.group_complete);
153
+ if (c.debug) {
154
+ $.tablesorter.benchmark("Applying groups widget: ", time);
155
+ }
156
+ }
157
+ },
158
+
159
+ bindEvents : function(table, c, wo){
160
+ if (wo.group_collapsible) {
161
+ wo.group_currentGroups = [];
162
+ // .on() requires jQuery 1.7+
163
+ c.$table.on('click toggleGroup', 'tr.group-header', function(event){
164
+ event.stopPropagation();
165
+ var isCollapsed, $groups, indx,
166
+ $this = $(this),
167
+ name = $this.find('.group-name').text().toLowerCase();
168
+ // use shift-click to toggle ALL groups
169
+ if (event.type === 'click' && event.shiftKey) {
170
+ $this.siblings('.group-header').trigger('toggleGroup');
171
+ }
172
+ $this.toggleClass('collapsed');
173
+ // nextUntil requires jQuery 1.4+
174
+ $this.nextUntil('tr.group-header').toggleClass('group-hidden', $this.hasClass('collapsed') );
175
+ // save collapsed groups
176
+ if (wo.group_saveGroups && ts.storage) {
177
+ $groups = c.$table.find('.group-header');
178
+ isCollapsed = $this.hasClass('collapsed');
179
+ if (!wo.group_currentGroups[wo.group_currentGroup]) {
180
+ wo.group_currentGroups[wo.group_currentGroup] = [];
181
+ }
182
+ if (isCollapsed && wo.group_currentGroup) {
183
+ wo.group_currentGroups[wo.group_currentGroup].push( name );
184
+ } else if (wo.group_currentGroup) {
185
+ indx = $.inArray( name, wo.group_currentGroups[wo.group_currentGroup] );
186
+ if (indx > -1) {
187
+ wo.group_currentGroups[wo.group_currentGroup].splice( indx, 1 );
188
+ }
189
+ }
190
+ ts.storage( table, 'tablesorter-groups', wo.group_currentGroups );
191
+ }
192
+ });
193
+ }
194
+ $(wo.group_saveReset).on('click', function(){
195
+ ts.grouping.clearSavedGroups(table);
196
+ });
197
+ c.$table.on('pagerChange.tsgrouping', function(){
198
+ ts.grouping.update(table, c, wo);
199
+ });
200
+ },
201
+
202
+ clearSavedGroups: function(table){
203
+ if (table && ts.storage) {
204
+ ts.storage(table, 'tablesorter-groups', '');
205
+ ts.grouping.update(table, table.config, table.config.widgetOptions);
206
+ }
207
+ }
208
+
209
+ };
210
+
211
+ ts.addWidget({
212
+ id: 'group',
213
+ priority: 100,
214
+ options: {
215
+ group_collapsible : true, // make the group header clickable and collapse the rows below it.
216
+ group_collapsed : false, // start with all groups collapsed
217
+ group_saveGroups : true, // remember collapsed groups
218
+ group_saveReset : null, // element to clear saved collapsed groups
219
+ group_count : ' ({num})', // if not false, the "{num}" string is replaced with the number of rows in the group
220
+ group_separator : '-', // group name separator; used when group-separator-# class is used.
221
+ group_formatter : null, // function(txt, column, table, c, wo) { return txt; }
222
+ group_callback : null, // function($cell, $rows, column, table){}, callback allowing modification of the group header labels
223
+ group_complete : 'groupingComplete', // event triggered on the table when the grouping widget has finished work
224
+
225
+ // change these default date names based on your language preferences
226
+ group_months : [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ],
227
+ group_week : [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ],
228
+ group_time : [ 'AM', 'PM' ],
229
+ // this function is used when "group-date" is set to create the date string
230
+ // you can just return date, date.toLocaleString(), date.toLocaleDateString() or d.toLocaleTimeString()
231
+ // reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#Conversion_getter
232
+ group_dateString : function(date) { return date.toLocaleString(); }
233
+ },
234
+ init: function(table, thisWidget, c, wo){
235
+ ts.grouping.bindEvents(table, c, wo);
236
+ },
237
+ format: function(table, c, wo) {
238
+ ts.grouping.update(table, c, wo);
239
+ },
240
+ remove : function(table, c, wo){
241
+ c.$table
242
+ .off('click', 'tr.group-header')
243
+ .off('pagerChange.tsgrouping')
244
+ .find('.group-hidden').removeClass('group-hidden').end()
245
+ .find('tr.group-header').remove();
246
+ }
247
+ });
248
+
249
+ })(jQuery);
@@ -0,0 +1,91 @@
1
+ /*! tablesorter headerTitles widget - updated 3/5/2014 (core v2.15.6)
2
+ * Requires tablesorter v2.8+ and jQuery 1.7+
3
+ * by Rob Garrison
4
+ */
5
+ /*jshint browser:true, jquery:true, unused:false */
6
+ /*global jQuery: false */
7
+ ;(function($){
8
+ "use strict";
9
+ var ts = $.tablesorter;
10
+
11
+ ts.addWidget({
12
+ id: 'headerTitles',
13
+ options: {
14
+ // use aria-label text
15
+ // e.g. "First Name: Ascending sort applied, activate to apply a descending sort"
16
+ headerTitle_useAria : false,
17
+ // add tooltip class
18
+ headerTitle_tooltip : '',
19
+ // custom titles [ ascending, descending, unsorted ]
20
+ headerTitle_cur_text : [ ' sort: A - Z', ' sort: Z - A', 'ly unsorted' ],
21
+ headerTitle_cur_numeric : [ ' sort: 0 - 9', ' sort: 9 - 0', 'ly unsorted' ],
22
+ headerTitle_nxt_text : [ ' sort: A - Z', ' sort: Z - A', 'remove sort' ],
23
+ headerTitle_nxt_numeric : [ ' sort: 0 - 9', ' sort: 9 - 0', 'remove sort' ],
24
+
25
+ // title display; {prefix} adds above prefix
26
+ // {type} adds the current sort order from above (text or numeric)
27
+ // {next} adds the next sort direction using the sort order above
28
+ headerTitle_output_sorted : 'current{current}; activate to {next}',
29
+ headerTitle_output_unsorted : 'current{current}; activate to {next} ',
30
+ headerTitle_output_nosort : 'No sort available',
31
+ // use this type to override the parser detection result
32
+ // e.g. use for numerically parsed columns (e.g. dates), but you
33
+ // want the user to see a text sort, e.g. [ 'text', 'numeric' ]
34
+ headerTitle_type : [],
35
+ // manipulate the title as desired
36
+ headerTitle_callback : null // function($cell, txt) { return txt; }
37
+ },
38
+ init: function(table, thisWidget, c, wo){
39
+ // force refresh
40
+ c.$table.on('refreshHeaderTitle', function(){
41
+ thisWidget.format(table, c, wo);
42
+ });
43
+ // add tooltip class
44
+ if ($.isArray(wo.headerTitle_tooltip)) {
45
+ c.$headers.each(function(){
46
+ $(this).addClass( wo.headerTitle_tooltip[this.column] || '' );
47
+ });
48
+ } else if (wo.headerTitle_tooltip !== '') {
49
+ c.$headers.addClass( wo.headerTitle_tooltip );
50
+ }
51
+ },
52
+ format: function (table, c, wo) {
53
+ var txt;
54
+ c.$headers.each(function(){
55
+ var t = this,
56
+ $this = $(this),
57
+ sortType = wo.headerTitle_type[t.column] || c.parsers[ t.column ].type || 'text',
58
+ sortDirection = $this.hasClass(ts.css.sortAsc) ? 0 : $this.hasClass(ts.css.sortDesc) ? 1 : 2,
59
+ sortNext = t.order[(t.count + 1) % (c.sortReset ? 3 : 2)];
60
+ if (wo.headerTitle_useAria) {
61
+ txt = $this.hasClass('sorter-false') ? wo.headerTitle_output_nosort : $this.attr('aria-label') || '';
62
+ } else {
63
+ txt = (wo.headerTitle_prefix || '') + // now deprecated
64
+ ($this.hasClass('sorter-false') ? wo.headerTitle_output_nosort :
65
+ ts.isValueInArray( t.column, c.sortList ) >= 0 ? wo.headerTitle_output_sorted : wo.headerTitle_output_unsorted);
66
+ txt = txt.replace(/\{(current|next|name)\}/gi, function(m){
67
+ return {
68
+ '{name}' : $this.text(),
69
+ '{current}' : wo[ 'headerTitle_cur_' + sortType ][ sortDirection ] || '',
70
+ '{next}' : wo[ 'headerTitle_nxt_' + sortType ][ sortNext ] || ''
71
+ }[m.toLowerCase()];
72
+ });
73
+ }
74
+ $this.attr('title', $.isFunction(wo.headerTitle_callback) ? wo.headerTitle_callback($this, txt) : txt);
75
+ });
76
+ },
77
+ remove: function (table, c, wo) {
78
+ c.$headers.attr('title', '');
79
+ c.$table.off('refreshHeaderTitle');
80
+ // remove tooltip class
81
+ if ($.isArray(wo.headerTitle_tooltip)) {
82
+ c.$headers.each(function(){
83
+ $(this).removeClass( wo.headerTitle_tooltip[this.column] || '' );
84
+ });
85
+ } else if (wo.headerTitle_tooltip !== '') {
86
+ c.$headers.removeClass( wo.headerTitle_tooltip );
87
+ }
88
+ }
89
+ });
90
+
91
+ })(jQuery);