1
- /*! Tablesaw - v1 .0.5 - 2015-10-09
1
+ /*! Tablesaw - v2 .0.0 - 2015-10-09
2
2
* https://github.com/filamentgroup/tablesaw
3
3
* Copyright (c) 2015 Filament Group; Licensed MIT */
4
- ; ( function ( $ ) {
5
-
6
- // Cut the mustard
7
- if ( ! ( 'querySelector' in document ) ||
8
- ( window . blackberry && ! window . WebKitPoint ) ||
9
- window . operamini ) {
10
- return ;
11
- } else {
12
- $ ( document . documentElement ) . addClass ( 'tablesaw-enhanced' ) ;
13
-
14
- // DOM-ready auto-init of plugins.
15
- // Many plugins bind to an "enhance" event to init themselves on dom ready, or when new markup is inserted into the DOM
16
- $ ( function ( ) {
17
- $ ( document ) . trigger ( "enhance.tablesaw" ) ;
18
- } ) ;
19
- }
20
-
21
- } ) ( jQuery ) ;
22
4
/*
23
5
* tablesaw: A set of plugins for responsive tables
24
6
* Stack and Column Toggle tables
@@ -34,12 +16,19 @@ if( typeof Tablesaw === "undefined" ) {
34
16
columnBtnText : 'Columns' ,
35
17
columnsDialogError : 'No eligible columns.' ,
36
18
sort : 'Sort'
37
- }
19
+ } ,
20
+ // cut the mustard
21
+ mustard : 'querySelector' in document &&
22
+ ( ! window . blackberry || window . WebKitPoint ) &&
23
+ ! window . operamini
38
24
} ;
39
25
}
40
26
if ( ! Tablesaw . config ) {
41
27
Tablesaw . config = { } ;
42
28
}
29
+ if ( Tablesaw . mustard ) {
30
+ jQuery ( document . documentElement ) . addClass ( 'tablesaw-enhanced' ) ;
31
+ }
43
32
44
33
; ( function ( $ ) {
45
34
var pluginName = "table" ,
@@ -102,7 +91,7 @@ if( !Tablesaw.config ) {
102
91
}
103
92
104
93
// Store "cells" data on header as a reference to all cells in the same column as this TH
105
- this . cells = self . $table . find ( "tr" ) . not ( $ ( thrs ) . eq ( 0 ) ) . not ( this ) . children ( sel ) ;
94
+ this . cells = self . $table . find ( "tr" ) . not ( thrs [ 0 ] ) . not ( this ) . children ( sel ) ;
106
95
coltally ++ ;
107
96
} ) ;
108
97
} ) ;
@@ -165,7 +154,10 @@ if( !Tablesaw.config ) {
165
154
} ;
166
155
167
156
$ ( document ) . on ( "enhance.tablesaw" , function ( e ) {
168
- $ ( e . target ) . find ( initSelector ) [ pluginName ] ( ) ;
157
+ // Cut the mustard
158
+ if ( Tablesaw . mustard ) {
159
+ $ ( e . target ) . find ( initSelector ) [ pluginName ] ( ) ;
160
+ }
169
161
} ) ;
170
162
171
163
} ( jQuery ) ) ;
@@ -269,7 +261,6 @@ if( !Tablesaw.config ) {
269
261
} ( this , jQuery ) ) ;
270
262
; ( function ( $ ) {
271
263
var pluginName = "tablesawbtn" ,
272
- initSelector = ".btn" ,
273
264
methods = {
274
265
_create : function ( ) {
275
266
return $ ( this ) . each ( function ( ) {
@@ -345,10 +336,6 @@ if( !Tablesaw.config ) {
345
336
// add methods
346
337
$ . extend ( $ . fn [ pluginName ] . prototype , methods ) ;
347
338
348
- $ ( document ) . on ( "enhance" , function ( e ) {
349
- $ ( initSelector , e . target ) [ pluginName ] ( ) ;
350
- } ) ;
351
-
352
339
} ( jQuery ) ) ;
353
340
; ( function ( win , $ , undefined ) {
354
341
0 commit comments