jquery-tablesorter 1.17.2 → 1.17.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/jquery-tablesorter/version.rb +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/addons/pager/jquery.tablesorter.pager.js +76 -71
- data/vendor/assets/javascripts/jquery-tablesorter/extras/jquery.dragtable.mod.js +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.combined.js +2647 -2576
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.js +174 -119
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.widgets.js +2487 -2471
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-extract.js +15 -15
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-iso8601.js +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-month.js +4 -4
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-range.js +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-two-digit-year.js +12 -12
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-weekday.js +4 -4
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date.js +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-duration.js +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-feet-inch-fraction.js +6 -6
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-file-type.js +22 -22
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-globalize.js +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-ignore-articles.js +15 -15
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-image.js +3 -3
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-input-select.js +10 -3
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-metric.js +2 -2
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-named-numbers.js +3 -3
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-network.js +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-roman.js +4 -4
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-alignChar.js +122 -121
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-build-table.js +13 -13
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-chart.js +2 -2
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-columnSelector.js +324 -324
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-columns.js +60 -60
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-editable.js +219 -219
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-filter-formatter-html5.js +360 -361
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-filter-formatter-jui.js +666 -666
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-filter-formatter-select2.js +124 -124
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-filter-type-insideRange.js +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-filter.js +1448 -1433
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-formatter.js +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-grouping.js +213 -213
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-headerTitles.js +3 -3
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-math.js +271 -216
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-output.js +339 -320
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-pager.js +1057 -1045
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-print.js +109 -109
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-reflow.js +114 -115
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-resizable.js +360 -359
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-saveSort.js +59 -59
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-scroller.js +818 -806
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-sort2Hash.js +128 -0
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-sortTbodies.js +195 -195
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-staticRow.js +90 -90
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-stickyHeaders.js +257 -257
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-storage.js +76 -76
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-uitheme.js +170 -170
- metadata +3 -3
- data/vendor/assets/javascripts/jquery-tablesorter/extras/jquery.quicksearch.js +0 -195
@@ -8,422 +8,421 @@
|
|
8
8
|
/*jshint browser:true, jquery:true, unused:false */
|
9
9
|
/*global jQuery: false */
|
10
10
|
;(function($){
|
11
|
-
|
11
|
+
'use strict';
|
12
12
|
|
13
|
-
var ts = $.tablesorter || {},
|
13
|
+
var ts = $.tablesorter || {},
|
14
14
|
|
15
|
-
// compare option selector class name (jQuery selector)
|
16
|
-
compareSelect = '.compare-select',
|
15
|
+
// compare option selector class name (jQuery selector)
|
16
|
+
compareSelect = '.compare-select',
|
17
17
|
|
18
|
+
tsff = ts.filterFormatter = $.extend( {}, ts.filterFormatter, {
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
.find('select')
|
33
|
-
.append(opt);
|
34
|
-
}
|
35
|
-
},
|
36
|
-
|
37
|
-
updateCompare : function($cell, $input, o) {
|
38
|
-
var val = $input.val() || '',
|
39
|
-
num = val.replace(/\s*?[><=]\s*?/g, ''),
|
40
|
-
compare = val.match(/[><=]/g) || '';
|
41
|
-
if (o.compare) {
|
42
|
-
if ($.isArray(o.compare)){
|
43
|
-
compare = (compare || []).join('') || o.compare[o.selected || 0];
|
44
|
-
}
|
45
|
-
$cell.find(compareSelect).val( compare );
|
46
|
-
}
|
47
|
-
return [ val, num ];
|
48
|
-
},
|
49
|
-
|
50
|
-
/**********************\
|
51
|
-
HTML5 Number (spinner)
|
52
|
-
\**********************/
|
53
|
-
html5Number : function($cell, indx, def5Num) {
|
54
|
-
var t, o = $.extend({
|
55
|
-
value : 0,
|
56
|
-
min : 0,
|
57
|
-
max : 100,
|
58
|
-
step : 1,
|
59
|
-
delayed : true,
|
60
|
-
disabled : false,
|
61
|
-
addToggle : false,
|
62
|
-
exactMatch : false,
|
63
|
-
cellText : '',
|
64
|
-
compare : '',
|
65
|
-
skipTest: false
|
66
|
-
}, def5Num),
|
67
|
-
|
68
|
-
$input,
|
69
|
-
// test browser for HTML5 range support
|
70
|
-
$number = $('<input type="number" style="visibility:hidden;" value="test">').appendTo($cell),
|
71
|
-
// test if HTML5 number is supported - from Modernizr
|
72
|
-
numberSupported = o.skipTest || $number.attr('type') === 'number' && $number.val() !== 'test',
|
73
|
-
$shcell = [],
|
74
|
-
c = $cell.closest('table')[0].config,
|
75
|
-
|
76
|
-
updateNumber = function(delayed, notrigger){
|
77
|
-
var chkd = o.addToggle ? $cell.find('.toggle').is(':checked') : true,
|
78
|
-
v = $cell.find('.number').val(),
|
79
|
-
compare = ($.isArray(o.compare) ? $cell.find(compareSelect).val() || o.compare[ o.selected || 0] : o.compare) || '',
|
80
|
-
searchType = c.$table[0].hasInitialized ? (delayed ? delayed : o.delayed) || '' : true;
|
81
|
-
$input
|
82
|
-
// add equal to the beginning, so we filter exact numbers
|
83
|
-
.val( !o.addToggle || chkd ? (compare ? compare : o.exactMatch ? '=' : '') + v : '' )
|
84
|
-
.trigger( notrigger ? '' : 'search', searchType ).end()
|
85
|
-
.find('.number').val(v);
|
86
|
-
if ($cell.find('.number').length) {
|
87
|
-
$cell.find('.number')[0].disabled = (o.disabled || !chkd);
|
20
|
+
addCompare: function($cell, indx, options){
|
21
|
+
if (options.compare && $.isArray(options.compare) && options.compare.length > 1) {
|
22
|
+
var opt = '',
|
23
|
+
compareSelectClass = [ compareSelect.slice(1), ' ' + compareSelect.slice(1), '' ],
|
24
|
+
txt = options.cellText ? '<label class="' + compareSelectClass.join('-label') + indx + '">' + options.cellText + '</label>' : '';
|
25
|
+
$.each(options.compare, function(i, c){
|
26
|
+
opt += '<option ' + (options.selected === i ? 'selected' : '') + '>' + c + '</option>';
|
27
|
+
});
|
28
|
+
$cell
|
29
|
+
.wrapInner('<div class="' + compareSelectClass.join('-wrapper') + indx + '" />')
|
30
|
+
.prepend( txt + '<select class="' + compareSelectClass.join('') + indx + '" />' )
|
31
|
+
.find('select')
|
32
|
+
.append(opt);
|
88
33
|
}
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
34
|
+
},
|
35
|
+
|
36
|
+
updateCompare : function($cell, $input, o) {
|
37
|
+
var val = $input.val() || '',
|
38
|
+
num = val.replace(/\s*?[><=]\s*?/g, ''),
|
39
|
+
compare = val.match(/[><=]/g) || '';
|
40
|
+
if (o.compare) {
|
41
|
+
if ($.isArray(o.compare)){
|
42
|
+
compare = (compare || []).join('') || o.compare[o.selected || 0];
|
95
43
|
}
|
44
|
+
$cell.find(compareSelect).val( compare );
|
96
45
|
}
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
46
|
+
return [ val, num ];
|
47
|
+
},
|
48
|
+
|
49
|
+
/**********************\
|
50
|
+
HTML5 Number (spinner)
|
51
|
+
\**********************/
|
52
|
+
html5Number : function($cell, indx, def5Num) {
|
53
|
+
var t, o = $.extend({
|
54
|
+
value : 0,
|
55
|
+
min : 0,
|
56
|
+
max : 100,
|
57
|
+
step : 1,
|
58
|
+
delayed : true,
|
59
|
+
disabled : false,
|
60
|
+
addToggle : false,
|
61
|
+
exactMatch : false,
|
62
|
+
cellText : '',
|
63
|
+
compare : '',
|
64
|
+
skipTest: false
|
65
|
+
}, def5Num),
|
66
|
+
|
67
|
+
$input,
|
68
|
+
// test browser for HTML5 range support
|
69
|
+
$number = $('<input type="number" style="visibility:hidden;" value="test">').appendTo($cell),
|
70
|
+
// test if HTML5 number is supported - from Modernizr
|
71
|
+
numberSupported = o.skipTest || $number.attr('type') === 'number' && $number.val() !== 'test',
|
72
|
+
$shcell = [],
|
73
|
+
c = $cell.closest('table')[0].config,
|
74
|
+
|
75
|
+
updateNumber = function(delayed, notrigger){
|
76
|
+
var chkd = o.addToggle ? $cell.find('.toggle').is(':checked') : true,
|
77
|
+
v = $cell.find('.number').val(),
|
78
|
+
compare = ($.isArray(o.compare) ? $cell.find(compareSelect).val() || o.compare[ o.selected || 0] : o.compare) || '',
|
79
|
+
searchType = c.$table[0].hasInitialized ? (delayed ? delayed : o.delayed) || '' : true;
|
80
|
+
$input
|
81
|
+
// add equal to the beginning, so we filter exact numbers
|
82
|
+
.val( !o.addToggle || chkd ? (compare ? compare : o.exactMatch ? '=' : '') + v : '' )
|
83
|
+
.trigger( notrigger ? '' : 'search', searchType ).end()
|
84
|
+
.find('.number').val(v);
|
85
|
+
if ($cell.find('.number').length) {
|
86
|
+
$cell.find('.number')[0].disabled = (o.disabled || !chkd);
|
87
|
+
}
|
88
|
+
// update sticky header cell
|
89
|
+
if ($shcell.length) {
|
90
|
+
$shcell.find('.number').val(v)[0].disabled = (o.disabled || !chkd);
|
91
|
+
$shcell.find(compareSelect).val(compare);
|
119
92
|
if (o.addToggle) {
|
120
|
-
$
|
121
|
-
if ($shcell.length) {
|
122
|
-
$shcell.find('.toggle')[0].checked = false;
|
123
|
-
}
|
93
|
+
$shcell.find('.toggle')[0].checked = chkd;
|
124
94
|
}
|
125
|
-
|
126
|
-
|
95
|
+
}
|
96
|
+
};
|
97
|
+
$number.remove();
|
98
|
+
|
99
|
+
if (numberSupported) {
|
100
|
+
t = o.addToggle ? '<div class="button"><input id="html5button' + indx + '" type="checkbox" class="toggle" />' +
|
101
|
+
'<label for="html5button' + indx + '"></label></div>' : '';
|
102
|
+
t += '<input class="number" type="number" min="' + o.min + '" max="' + o.max + '" value="' +
|
103
|
+
o.value + '" step="' + o.step + '" />';
|
104
|
+
// add HTML5 number (spinner)
|
105
|
+
$cell
|
106
|
+
.append(t + '<input type="hidden" />')
|
107
|
+
.find('.toggle, .number').bind('change', function(){
|
127
108
|
updateNumber();
|
128
|
-
}
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
109
|
+
})
|
110
|
+
.closest('thead').find('th[data-column=' + indx + ']')
|
111
|
+
.addClass('filter-parsed') // get exact numbers from column
|
112
|
+
// on reset
|
113
|
+
.closest('table').bind('filterReset', function(){
|
114
|
+
if ($.isArray(o.compare)) {
|
115
|
+
$cell.add($shcell).find(compareSelect).val( o.compare[ o.selected || 0 ] );
|
116
|
+
}
|
117
|
+
// turn off the toggle checkbox
|
118
|
+
if (o.addToggle) {
|
119
|
+
$cell.find('.toggle')[0].checked = false;
|
120
|
+
if ($shcell.length) {
|
121
|
+
$shcell.find('.toggle')[0].checked = false;
|
122
|
+
}
|
123
|
+
}
|
124
|
+
$cell.find('.number').val( o.value );
|
125
|
+
setTimeout(function(){
|
126
|
+
updateNumber();
|
127
|
+
}, 0);
|
128
|
+
});
|
129
|
+
$input = $cell.find('input[type=hidden]').bind('change', function(){
|
130
|
+
$cell.find('.number').val( this.value );
|
147
131
|
updateNumber();
|
148
132
|
});
|
149
|
-
}
|
150
133
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
.
|
157
|
-
|
158
|
-
updateNumber();
|
159
|
-
});
|
134
|
+
// update slider from hidden input, in case of saved filters
|
135
|
+
c.$table.bind('filterFomatterUpdate', function(){
|
136
|
+
var val = tsff.updateCompare($cell, $input, o)[0] || o.value;
|
137
|
+
$cell.find('.number').val( ((val || '') + '').replace(/[><=]/g, '') );
|
138
|
+
updateNumber(false, true);
|
139
|
+
ts.filter.formatterUpdated($cell, indx);
|
140
|
+
});
|
160
141
|
|
161
142
|
if (o.compare) {
|
162
143
|
// add compare select
|
163
|
-
tsff.addCompare($
|
164
|
-
$
|
165
|
-
$cell.find(compareSelect).val( $(this).val() );
|
144
|
+
tsff.addCompare($cell, indx, o);
|
145
|
+
$cell.find(compareSelect).bind('change', function(){
|
166
146
|
updateNumber();
|
167
147
|
});
|
168
148
|
}
|
169
149
|
|
170
|
-
|
171
|
-
|
150
|
+
// has sticky headers?
|
151
|
+
c.$table.bind('stickyHeadersInit', function(){
|
152
|
+
$shcell = c.widgetOptions.$sticky.find('.tablesorter-filter-row').children().eq(indx).empty();
|
153
|
+
$shcell
|
154
|
+
.append(t)
|
155
|
+
.find('.toggle, .number').bind('change', function(){
|
156
|
+
$cell.find('.number').val( $(this).val() );
|
157
|
+
updateNumber();
|
158
|
+
});
|
159
|
+
|
160
|
+
if (o.compare) {
|
161
|
+
// add compare select
|
162
|
+
tsff.addCompare($shcell, indx, o);
|
163
|
+
$shcell.find(compareSelect).bind('change', function(){
|
164
|
+
$cell.find(compareSelect).val( $(this).val() );
|
165
|
+
updateNumber();
|
166
|
+
});
|
167
|
+
}
|
172
168
|
|
173
|
-
|
169
|
+
updateNumber();
|
170
|
+
});
|
174
171
|
|
175
|
-
|
172
|
+
updateNumber();
|
176
173
|
|
177
|
-
return numberSupported ? $cell.find('input[type="hidden"]') : $('<input type="search">');
|
178
|
-
},
|
179
|
-
|
180
|
-
/**********************\
|
181
|
-
HTML5 range slider
|
182
|
-
\**********************/
|
183
|
-
html5Range : function($cell, indx, def5Range) {
|
184
|
-
var o = $.extend({
|
185
|
-
value : 0,
|
186
|
-
min : 0,
|
187
|
-
max : 100,
|
188
|
-
step : 1,
|
189
|
-
delayed : true,
|
190
|
-
valueToHeader : true,
|
191
|
-
exactMatch : true,
|
192
|
-
cellText : '',
|
193
|
-
compare : '',
|
194
|
-
allText : 'all',
|
195
|
-
skipTest : false
|
196
|
-
}, def5Range),
|
197
|
-
|
198
|
-
$input,
|
199
|
-
// test browser for HTML5 range support
|
200
|
-
$range = $('<input type="range" style="visibility:hidden;" value="test">').appendTo($cell),
|
201
|
-
// test if HTML5 range is supported - from Modernizr (but I left out the method to detect in Safari 2-4)
|
202
|
-
// see https://github.com/Modernizr/Modernizr/blob/master/feature-detects/inputtypes.js
|
203
|
-
rangeSupported = o.skipTest || $range.attr('type') === 'range' && $range.val() !== 'test',
|
204
|
-
$shcell = [],
|
205
|
-
c = $cell.closest('table')[0].config,
|
206
|
-
|
207
|
-
updateRange = function(v, delayed, notrigger){
|
208
|
-
/*jshint eqeqeq:false */
|
209
|
-
// hidden input changes may include compare symbols
|
210
|
-
v = ( typeof v === "undefined" ? $input.val() : v ).toString().replace(/[<>=]/g,'') || o.value;
|
211
|
-
var compare = ($.isArray(o.compare) ? $cell.find(compareSelect).val() || o.compare[ o.selected || 0] : o.compare) || '',
|
212
|
-
t = ' (' + (compare ? compare + v : v == o.min ? o.allText : v) + ')',
|
213
|
-
searchType = c.$table[0].hasInitialized ? (delayed ? delayed : o.delayed) || '' : true;
|
214
|
-
$cell.find('input[type=hidden]')
|
215
|
-
// add equal to the beginning, so we filter exact numbers
|
216
|
-
.val( ( compare ? compare + v : ( v == o.min ? '' : ( o.exactMatch ? '=' : '' ) + v ) ) )
|
217
|
-
//( val == o.min ? '' : val + (o.exactMatch ? '=' : ''))
|
218
|
-
.trigger( notrigger ? '' : 'search', searchType ).end()
|
219
|
-
.find('.range').val(v);
|
220
|
-
// or add current value to the header cell, if desired
|
221
|
-
$cell.closest('thead').find('th[data-column=' + indx + ']').find('.curvalue').html(t);
|
222
|
-
// update sticky header cell
|
223
|
-
if ($shcell.length) {
|
224
|
-
$shcell
|
225
|
-
.find('.range').val(v).end()
|
226
|
-
.find(compareSelect).val( compare );
|
227
|
-
$shcell.closest('thead').find('th[data-column=' + indx + ']').find('.curvalue').html(t);
|
228
174
|
}
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
175
|
+
|
176
|
+
return numberSupported ? $cell.find('input[type="hidden"]') : $('<input type="search">');
|
177
|
+
},
|
178
|
+
|
179
|
+
/**********************\
|
180
|
+
HTML5 range slider
|
181
|
+
\**********************/
|
182
|
+
html5Range : function($cell, indx, def5Range) {
|
183
|
+
var o = $.extend({
|
184
|
+
value : 0,
|
185
|
+
min : 0,
|
186
|
+
max : 100,
|
187
|
+
step : 1,
|
188
|
+
delayed : true,
|
189
|
+
valueToHeader : true,
|
190
|
+
exactMatch : true,
|
191
|
+
cellText : '',
|
192
|
+
compare : '',
|
193
|
+
allText : 'all',
|
194
|
+
skipTest : false
|
195
|
+
}, def5Range),
|
196
|
+
|
197
|
+
$input,
|
198
|
+
// test browser for HTML5 range support
|
199
|
+
$range = $('<input type="range" style="visibility:hidden;" value="test">').appendTo($cell),
|
200
|
+
// test if HTML5 range is supported - from Modernizr (but I left out the method to detect in Safari 2-4)
|
201
|
+
// see https://github.com/Modernizr/Modernizr/blob/master/feature-detects/inputtypes.js
|
202
|
+
rangeSupported = o.skipTest || $range.attr('type') === 'range' && $range.val() !== 'test',
|
203
|
+
$shcell = [],
|
204
|
+
c = $cell.closest('table')[0].config,
|
205
|
+
|
206
|
+
updateRange = function(v, delayed, notrigger){
|
242
207
|
/*jshint eqeqeq:false */
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
208
|
+
// hidden input changes may include compare symbols
|
209
|
+
v = ( typeof v === 'undefined' ? $input.val() : v ).toString().replace(/[<>=]/g, '') || o.value;
|
210
|
+
var compare = ($.isArray(o.compare) ? $cell.find(compareSelect).val() || o.compare[ o.selected || 0] : o.compare) || '',
|
211
|
+
t = ' (' + (compare ? compare + v : v == o.min ? o.allText : v) + ')',
|
212
|
+
searchType = c.$table[0].hasInitialized ? (delayed ? delayed : o.delayed) || '' : true;
|
213
|
+
$cell.find('input[type=hidden]')
|
214
|
+
// add equal to the beginning, so we filter exact numbers
|
215
|
+
.val( ( compare ? compare + v : ( v == o.min ? '' : ( o.exactMatch ? '=' : '' ) + v ) ) )
|
216
|
+
// ( val == o.min ? '' : val + (o.exactMatch ? '=' : ''))
|
217
|
+
.trigger( notrigger ? '' : 'search', searchType ).end()
|
218
|
+
.find('.range').val(v);
|
219
|
+
// or add current value to the header cell, if desired
|
220
|
+
$cell.closest('thead').find('th[data-column=' + indx + ']').find('.curvalue').html(t);
|
221
|
+
// update sticky header cell
|
222
|
+
if ($shcell.length) {
|
223
|
+
$shcell
|
224
|
+
.find('.range').val(v).end()
|
225
|
+
.find(compareSelect).val( compare );
|
226
|
+
$shcell.closest('thead').find('th[data-column=' + indx + ']').find('.curvalue').html(t);
|
249
227
|
}
|
250
|
-
}
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
228
|
+
};
|
229
|
+
$range.remove();
|
230
|
+
|
231
|
+
if (rangeSupported) {
|
232
|
+
// add HTML5 range
|
233
|
+
$cell
|
234
|
+
.html('<input type="hidden"><input class="range" type="range" min="' + o.min + '" max="' + o.max + '" value="' + o.value + '" />')
|
235
|
+
.closest('thead').find('th[data-column=' + indx + ']')
|
236
|
+
.addClass('filter-parsed') // get exact numbers from column
|
237
|
+
// add span to header for the current slider value
|
238
|
+
.find('.tablesorter-header-inner').append('<span class="curvalue" />');
|
239
|
+
// hidden filter update namespace trigger by filter widget
|
240
|
+
$input = $cell.find('input[type=hidden]').bind('change' + c.namespace + 'filter', function(){
|
241
|
+
/*jshint eqeqeq:false */
|
242
|
+
var v = this.value,
|
243
|
+
compare = ($.isArray(o.compare) ? $cell.find(compareSelect).val() || o.compare[ o.selected || 0] : o.compare) || '';
|
244
|
+
if (v !== this.lastValue) {
|
245
|
+
this.lastValue = ( compare ? compare + v : ( v == o.min ? '' : ( o.exactMatch ? '=' : '' ) + v ) );
|
246
|
+
this.value = this.lastValue;
|
247
|
+
updateRange( v );
|
248
|
+
}
|
249
|
+
});
|
263
250
|
|
264
|
-
|
265
|
-
|
266
|
-
tsff.addCompare($cell, indx, o);
|
267
|
-
$cell.find(compareSelect).bind('change', function(){
|
268
|
-
updateRange();
|
251
|
+
$cell.find('.range').bind('change', function(){
|
252
|
+
updateRange( this.value );
|
269
253
|
});
|
270
|
-
}
|
271
254
|
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
.
|
278
|
-
|
279
|
-
});
|
280
|
-
updateRange();
|
255
|
+
// update spinner from hidden input, in case of saved filters
|
256
|
+
c.$table.bind('filterFomatterUpdate', function(){
|
257
|
+
var val = tsff.updateCompare($cell, $input, o)[0];
|
258
|
+
$cell.find('.range').val( val );
|
259
|
+
updateRange(val, false, true);
|
260
|
+
ts.filter.formatterUpdated($cell, indx);
|
261
|
+
});
|
281
262
|
|
282
263
|
if (o.compare) {
|
283
264
|
// add compare select
|
284
|
-
tsff.addCompare($
|
285
|
-
$
|
286
|
-
$cell.find(compareSelect).val( $(this).val() );
|
265
|
+
tsff.addCompare($cell, indx, o);
|
266
|
+
$cell.find(compareSelect).bind('change', function(){
|
287
267
|
updateRange();
|
288
268
|
});
|
289
269
|
}
|
290
270
|
|
291
|
-
|
271
|
+
// has sticky headers?
|
272
|
+
c.$table.bind('stickyHeadersInit', function(){
|
273
|
+
$shcell = c.widgetOptions.$sticky.find('.tablesorter-filter-row').children().eq(indx).empty();
|
274
|
+
$shcell
|
275
|
+
.html('<input class="range" type="range" min="' + o.min + '" max="' + o.max + '" value="' + o.value + '" />')
|
276
|
+
.find('.range').bind('change', function(){
|
277
|
+
updateRange( $shcell.find('.range').val() );
|
278
|
+
});
|
279
|
+
updateRange();
|
292
280
|
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
});
|
302
|
-
updateRange();
|
281
|
+
if (o.compare) {
|
282
|
+
// add compare select
|
283
|
+
tsff.addCompare($shcell, indx, o);
|
284
|
+
$shcell.find(compareSelect).bind('change', function(){
|
285
|
+
$cell.find(compareSelect).val( $(this).val() );
|
286
|
+
updateRange();
|
287
|
+
});
|
288
|
+
}
|
303
289
|
|
304
|
-
|
290
|
+
});
|
305
291
|
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
addToggle : true,
|
317
|
-
exactMatch : true,
|
318
|
-
valueToHeader : false,
|
319
|
-
skipTest : false
|
320
|
-
}, defColor),
|
321
|
-
$input,
|
322
|
-
// Add a hidden input to hold the range values
|
323
|
-
$color = $('<input type="color" style="visibility:hidden;" value="test">').appendTo($cell),
|
324
|
-
// test if HTML5 color is supported - from Modernizr
|
325
|
-
colorSupported = o.skipTest || $color.attr('type') === 'color' && $color.val() !== 'test',
|
326
|
-
$shcell = [],
|
327
|
-
c = $cell.closest('table')[0].config,
|
328
|
-
|
329
|
-
updateColor = function(v, notrigger){
|
330
|
-
v = ( typeof v === "undefined" ? $input.val() : v ).toString().replace('=','') || o.value;
|
331
|
-
var chkd = true,
|
332
|
-
t = ' (' + v + ')';
|
333
|
-
if (o.addToggle) {
|
334
|
-
chkd = $cell.find('.toggle').is(':checked');
|
335
|
-
}
|
336
|
-
if ($cell.find('.colorpicker').length) {
|
337
|
-
$cell.find('.colorpicker').val(v)[0].disabled = (o.disabled || !chkd);
|
338
|
-
}
|
292
|
+
// on reset
|
293
|
+
$cell.closest('table').bind('filterReset', function(){
|
294
|
+
if ($.isArray(o.compare)) {
|
295
|
+
$cell.add($shcell).find(compareSelect).val( o.compare[ o.selected || 0 ] );
|
296
|
+
}
|
297
|
+
setTimeout(function(){
|
298
|
+
updateRange(o.value, false, true);
|
299
|
+
}, 0);
|
300
|
+
});
|
301
|
+
updateRange();
|
339
302
|
|
340
|
-
$input
|
341
|
-
.val( chkd ? v + (o.exactMatch ? '=' : '') : '' )
|
342
|
-
.trigger( !c.$table[0].hasInitialized || notrigger ? '' : 'search' );
|
343
|
-
if (o.valueToHeader) {
|
344
|
-
// add current color to the header cell
|
345
|
-
$cell.closest('thead').find('th[data-column=' + indx + ']').find('.curcolor').html(t);
|
346
|
-
} else {
|
347
|
-
// current color to span in cell
|
348
|
-
$cell.find('.currentColor').html(t);
|
349
303
|
}
|
350
304
|
|
351
|
-
|
352
|
-
|
353
|
-
|
305
|
+
return rangeSupported ? $cell.find('input[type="hidden"]') : $('<input type="search">');
|
306
|
+
},
|
307
|
+
|
308
|
+
/**********************\
|
309
|
+
HTML5 Color picker
|
310
|
+
\**********************/
|
311
|
+
html5Color: function($cell, indx, defColor) {
|
312
|
+
var t, o = $.extend({
|
313
|
+
value : '#000000',
|
314
|
+
disabled : false,
|
315
|
+
addToggle : true,
|
316
|
+
exactMatch : true,
|
317
|
+
valueToHeader : false,
|
318
|
+
skipTest : false
|
319
|
+
}, defColor),
|
320
|
+
$input,
|
321
|
+
// Add a hidden input to hold the range values
|
322
|
+
$color = $('<input type="color" style="visibility:hidden;" value="test">').appendTo($cell),
|
323
|
+
// test if HTML5 color is supported - from Modernizr
|
324
|
+
colorSupported = o.skipTest || $color.attr('type') === 'color' && $color.val() !== 'test',
|
325
|
+
$shcell = [],
|
326
|
+
c = $cell.closest('table')[0].config,
|
327
|
+
|
328
|
+
updateColor = function(v, notrigger) {
|
329
|
+
v = ( typeof v === 'undefined' ? $input.val() : v ).toString().replace('=', '') || o.value;
|
330
|
+
var chkd = true,
|
331
|
+
t = ' (' + v + ')';
|
354
332
|
if (o.addToggle) {
|
355
|
-
$
|
333
|
+
chkd = $cell.find('.toggle').is(':checked');
|
334
|
+
}
|
335
|
+
if ($cell.find('.colorpicker').length) {
|
336
|
+
$cell.find('.colorpicker').val(v)[0].disabled = (o.disabled || !chkd);
|
356
337
|
}
|
338
|
+
|
339
|
+
$input
|
340
|
+
.val( chkd ? v + (o.exactMatch ? '=' : '') : '' )
|
341
|
+
.trigger( !c.$table[0].hasInitialized || notrigger ? '' : 'search' );
|
357
342
|
if (o.valueToHeader) {
|
358
343
|
// add current color to the header cell
|
359
|
-
$
|
344
|
+
$cell.closest('thead').find('th[data-column=' + indx + ']').find('.curcolor').html(t);
|
360
345
|
} else {
|
361
346
|
// current color to span in cell
|
362
|
-
$
|
347
|
+
$cell.find('.currentColor').html(t);
|
363
348
|
}
|
364
|
-
}
|
365
|
-
};
|
366
|
-
$color.remove();
|
367
|
-
|
368
|
-
if (colorSupported) {
|
369
|
-
t = '' + indx + Math.round(Math.random() * 100);
|
370
|
-
// add HTML5 color picker
|
371
|
-
t = '<div class="color-controls-wrapper">' +
|
372
|
-
(o.addToggle ? '<div class="button"><input id="colorbutton' + t + '" type="checkbox" class="toggle" /><label for="colorbutton' +
|
373
|
-
t + '"></label></div>' : '') +
|
374
|
-
'<input type="hidden"><input class="colorpicker" type="color" />' +
|
375
|
-
(o.valueToHeader ? '' : '<span class="currentColor">(#000000)</span>') + '</div>';
|
376
|
-
$cell.html(t);
|
377
|
-
// add span to header for the current color value - only works if the line in the updateColor() function is also un-commented out
|
378
|
-
if (o.valueToHeader) {
|
379
|
-
$cell.closest('thead').find('th[data-column=' + indx + ']').find('.tablesorter-header-inner').append('<span class="curcolor" />');
|
380
|
-
}
|
381
349
|
|
382
|
-
|
383
|
-
|
384
|
-
|
350
|
+
// update sticky header cell
|
351
|
+
if ($shcell.length) {
|
352
|
+
$shcell.find('.colorpicker').val(v)[0].disabled = (o.disabled || !chkd);
|
353
|
+
if (o.addToggle) {
|
354
|
+
$shcell.find('.toggle')[0].checked = chkd;
|
355
|
+
}
|
356
|
+
if (o.valueToHeader) {
|
357
|
+
// add current color to the header cell
|
358
|
+
$shcell.closest('thead').find('th[data-column=' + indx + ']').find('.curcolor').html(t);
|
359
|
+
} else {
|
360
|
+
// current color to span in cell
|
361
|
+
$shcell.find('.currentColor').html(t);
|
362
|
+
}
|
363
|
+
}
|
364
|
+
};
|
365
|
+
$color.remove();
|
366
|
+
|
367
|
+
if (colorSupported) {
|
368
|
+
t = '' + indx + Math.round(Math.random() * 100);
|
369
|
+
// add HTML5 color picker
|
370
|
+
t = '<div class="color-controls-wrapper">' +
|
371
|
+
(o.addToggle ? '<div class="button"><input id="colorbutton' + t + '" type="checkbox" class="toggle" /><label for="colorbutton' +
|
372
|
+
t + '"></label></div>' : '') +
|
373
|
+
'<input type="hidden"><input class="colorpicker" type="color" />' +
|
374
|
+
(o.valueToHeader ? '' : '<span class="currentColor">(#000000)</span>') + '</div>';
|
375
|
+
$cell.html(t);
|
376
|
+
// add span to header for the current color value - only works if the line in the updateColor() function is also un-commented out
|
377
|
+
if (o.valueToHeader) {
|
378
|
+
$cell.closest('thead').find('th[data-column=' + indx + ']').find('.tablesorter-header-inner').append('<span class="curcolor" />');
|
379
|
+
}
|
385
380
|
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
});
|
381
|
+
$cell.find('.toggle, .colorpicker').bind('change', function(){
|
382
|
+
updateColor( $cell.find('.colorpicker').val() );
|
383
|
+
});
|
390
384
|
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
});
|
385
|
+
// hidden filter update namespace trigger by filter widget
|
386
|
+
$input = $cell.find('input[type=hidden]').bind('change' + c.namespace + 'filter', function(){
|
387
|
+
updateColor( this.value );
|
388
|
+
});
|
396
389
|
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
}
|
403
|
-
// delay needed because default color needs to be set in the filter
|
404
|
-
// there is no compare option here, so if addToggle = false,
|
405
|
-
// default color is #000000 (even with no value set)
|
406
|
-
setTimeout(function(){
|
407
|
-
updateColor();
|
408
|
-
}, 0);
|
409
|
-
});
|
410
|
-
|
411
|
-
// has sticky headers?
|
412
|
-
c.$table.bind('stickyHeadersInit', function(){
|
413
|
-
$shcell = c.widgetOptions.$sticky.find('.tablesorter-filter-row').children().eq(indx);
|
414
|
-
$shcell
|
415
|
-
.html(t)
|
416
|
-
.find('.toggle, .colorpicker').bind('change', function(){
|
417
|
-
updateColor( $shcell.find('.colorpicker').val() );
|
418
|
-
});
|
419
|
-
updateColor( $shcell.find('.colorpicker').val() );
|
420
|
-
});
|
390
|
+
// update slider from hidden input, in case of saved filters
|
391
|
+
c.$table.bind('filterFomatterUpdate', function(){
|
392
|
+
updateColor( $input.val(), true );
|
393
|
+
ts.filter.formatterUpdated($cell, indx);
|
394
|
+
});
|
421
395
|
|
422
|
-
|
396
|
+
// on reset
|
397
|
+
$cell.closest('table').bind('filterReset', function(){
|
398
|
+
// just turn off the colorpicker
|
399
|
+
if (o.addToggle) {
|
400
|
+
$cell.find('.toggle')[0].checked = false;
|
401
|
+
}
|
402
|
+
// delay needed because default color needs to be set in the filter
|
403
|
+
// there is no compare option here, so if addToggle = false,
|
404
|
+
// default color is #000000 (even with no value set)
|
405
|
+
setTimeout(function(){
|
406
|
+
updateColor();
|
407
|
+
}, 0);
|
408
|
+
});
|
409
|
+
|
410
|
+
// has sticky headers?
|
411
|
+
c.$table.bind('stickyHeadersInit', function(){
|
412
|
+
$shcell = c.widgetOptions.$sticky.find('.tablesorter-filter-row').children().eq(indx);
|
413
|
+
$shcell
|
414
|
+
.html(t)
|
415
|
+
.find('.toggle, .colorpicker').bind('change', function(){
|
416
|
+
updateColor( $shcell.find('.colorpicker').val() );
|
417
|
+
});
|
418
|
+
updateColor( $shcell.find('.colorpicker').val() );
|
419
|
+
});
|
420
|
+
|
421
|
+
updateColor( o.value );
|
422
|
+
}
|
423
|
+
return colorSupported ? $cell.find('input[type="hidden"]') : $('<input type="search">');
|
423
424
|
}
|
424
|
-
return colorSupported ? $cell.find('input[type="hidden"]') : $('<input type="search">');
|
425
|
-
}
|
426
425
|
|
427
|
-
});
|
426
|
+
});
|
428
427
|
|
429
428
|
})(jQuery);
|