1
- /*! Tablesaw - v3.0.6 - 2017-11-20
1
+ /*! Tablesaw - v3.0.7 - 2018-01-24
2
2
* https://github.com/filamentgroup/tablesaw
3
- * Copyright (c) 2017 Filament Group; Licensed MIT */
3
+ * Copyright (c) 2018 Filament Group; Licensed MIT */
4
4
( function ( root , factory ) {
5
5
if ( typeof define === 'function' && define . amd ) {
6
6
define ( [ "jquery" ] , function ( jQuery ) {
7
7
return ( root . Tablesaw = factory ( jQuery , root ) ) ;
8
8
} ) ;
9
9
} else if ( typeof exports === 'object' ) {
10
- module . exports = factory ( require ( 'jquery' ) ( root ) , root ) ;
10
+ if ( "document" in root ) {
11
+ module . exports = factory ( require ( 'jquery' ) , root ) ;
12
+ } else {
13
+ // special jQuery case for CommonJS (pass in a window)
14
+ module . exports = factory ( require ( 'jquery' ) ( root ) , root ) ;
15
+ }
11
16
} else {
12
17
root . Tablesaw = factory ( jQuery , root ) ;
13
18
}
14
- } ( typeof window !== "undefined" ? window : this , function ( $ , win ) {
19
+ } ( typeof window !== "undefined" ? window : this , function ( $ , window ) {
15
20
"use strict" ;
16
21
22
+ var document = window . document ;
23
+
17
24
var domContentLoadedTriggered = false ;
18
25
document . addEventListener ( "DOMContentLoaded" , function ( ) {
19
26
domContentLoadedTriggered = true ;
@@ -55,7 +62,7 @@ var Tablesaw = {
55
62
}
56
63
} ;
57
64
58
- $ ( win . document ) . on ( "enhance.tablesaw" , function ( ) {
65
+ $ ( document ) . on ( "enhance.tablesaw" , function ( ) {
59
66
// Extend i18n config, if one exists.
60
67
if ( typeof TablesawConfig !== "undefined" && TablesawConfig . i18n ) {
61
68
Tablesaw . i18n = $ . extend ( Tablesaw . i18n , TablesawConfig . i18n || { } ) ;
@@ -480,7 +487,7 @@ if (Tablesaw.mustard) {
480
487
} ) ;
481
488
} ;
482
489
483
- var $doc = $ ( win . document ) ;
490
+ var $doc = $ ( document ) ;
484
491
$doc . on ( "enhance.tablesaw" , function ( e ) {
485
492
// Cut the mustard
486
493
if ( Tablesaw . mustard ) {
@@ -500,17 +507,17 @@ if (Tablesaw.mustard) {
500
507
$doc . on ( "scroll.tablesaw" , function ( ) {
501
508
isScrolling = true ;
502
509
503
- win . clearTimeout ( scrollTimeout ) ;
504
- scrollTimeout = win . setTimeout ( function ( ) {
510
+ window . clearTimeout ( scrollTimeout ) ;
511
+ scrollTimeout = window . setTimeout ( function ( ) {
505
512
isScrolling = false ;
506
513
} , 300 ) ; // must be greater than the resize timeout below
507
514
} ) ;
508
515
509
516
var resizeTimeout ;
510
- $ ( win ) . on ( "resize" , function ( ) {
517
+ $ ( window ) . on ( "resize" , function ( ) {
511
518
if ( ! isScrolling ) {
512
- win . clearTimeout ( resizeTimeout ) ;
513
- resizeTimeout = win . setTimeout ( function ( ) {
519
+ window . clearTimeout ( resizeTimeout ) ;
520
+ resizeTimeout = window . setTimeout ( function ( ) {
514
521
$doc . trigger ( events . resize ) ;
515
522
} , 150 ) ; // must be less than the scrolling timeout above.
516
523
}
@@ -1577,7 +1584,7 @@ if (Tablesaw.mustard) {
1577
1584
1578
1585
function matchesMedia ( ) {
1579
1586
var matchMedia = $table . attr ( "data-tablesaw-swipe-media" ) ;
1580
- return ! matchMedia || ( "matchMedia" in win && win . matchMedia ( matchMedia ) . matches ) ;
1587
+ return ! matchMedia || ( "matchMedia" in window && window . matchMedia ( matchMedia ) . matches ) ;
1581
1588
}
1582
1589
1583
1590
function fakeBreakpoints ( ) {
@@ -1674,7 +1681,7 @@ if (Tablesaw.mustard) {
1674
1681
var y ;
1675
1682
var scrollTop = window . pageYOffset ;
1676
1683
1677
- $ ( win ) . off ( Tablesaw . events . resize , fakeBreakpoints ) ;
1684
+ $ ( window ) . off ( Tablesaw . events . resize , fakeBreakpoints ) ;
1678
1685
1679
1686
$ ( this )
1680
1687
. on ( "touchmove.swipetoggle" , function ( e ) {
@@ -1711,7 +1718,7 @@ if (Tablesaw.mustard) {
1711
1718
}
1712
1719
1713
1720
window . setTimeout ( function ( ) {
1714
- $ ( win ) . on ( Tablesaw . events . resize , fakeBreakpoints ) ;
1721
+ $ ( window ) . on ( Tablesaw . events . resize , fakeBreakpoints ) ;
1715
1722
} , 300 ) ;
1716
1723
1717
1724
$ ( this ) . off ( "touchmove.swipetoggle touchend.swipetoggle" ) ;
@@ -1741,7 +1748,7 @@ if (Tablesaw.mustard) {
1741
1748
1742
1749
$t . removeClass ( "tablesaw-swipe" ) ;
1743
1750
tblsaw . $toolbar . find ( ".tablesaw-advance" ) . remove ( ) ;
1744
- $ ( win ) . off ( Tablesaw . events . resize , fakeBreakpoints ) ;
1751
+ $ ( window ) . off ( Tablesaw . events . resize , fakeBreakpoints ) ;
1745
1752
1746
1753
$t . off ( ".swipetoggle" ) ;
1747
1754
} )
@@ -1752,7 +1759,7 @@ if (Tablesaw.mustard) {
1752
1759
} ) ;
1753
1760
1754
1761
fakeBreakpoints ( ) ;
1755
- $ ( win ) . on ( Tablesaw . events . resize , fakeBreakpoints ) ;
1762
+ $ ( window ) . on ( Tablesaw . events . resize , fakeBreakpoints ) ;
1756
1763
}
1757
1764
1758
1765
// on tablecreate, init
@@ -1776,9 +1783,9 @@ if (Tablesaw.mustard) {
1776
1783
if ( mq === "" ) {
1777
1784
// value-less but exists
1778
1785
return true ;
1779
- } else if ( mq && "matchMedia" in win ) {
1786
+ } else if ( mq && "matchMedia" in window ) {
1780
1787
// has a mq value
1781
- return win . matchMedia ( mq ) . matches ;
1788
+ return window . matchMedia ( mq ) . matches ;
1782
1789
}
1783
1790
1784
1791
return false ;
@@ -1817,7 +1824,7 @@ if (Tablesaw.mustard) {
1817
1824
1818
1825
// run on init and resize
1819
1826
showHideNav ( ) ;
1820
- $ ( win ) . on ( Tablesaw . events . resize , showHideNav ) ;
1827
+ $ ( window ) . on ( Tablesaw . events . resize , showHideNav ) ;
1821
1828
1822
1829
$table
1823
1830
. on ( "tablesawcolumns.minimap" , function ( ) {
@@ -1827,7 +1834,7 @@ if (Tablesaw.mustard) {
1827
1834
var $t = $ ( this ) ;
1828
1835
1829
1836
tblsaw . $toolbar . find ( ".tablesaw-advance" ) . remove ( ) ;
1830
- $ ( win ) . off ( Tablesaw . events . resize , showHideNav ) ;
1837
+ $ ( window ) . off ( Tablesaw . events . resize , showHideNav ) ;
1831
1838
1832
1839
$t . off ( ".minimap" ) ;
1833
1840
} ) ;
@@ -1925,7 +1932,7 @@ if (Tablesaw.mustard) {
1925
1932
}
1926
1933
} ;
1927
1934
1928
- $ ( win . document ) . on ( Tablesaw . events . create , function ( e , Tablesaw ) {
1935
+ $ ( document ) . on ( Tablesaw . events . create , function ( e , Tablesaw ) {
1929
1936
if ( Tablesaw . $table . is ( S . selectors . init ) ) {
1930
1937
S . init ( Tablesaw . table ) ;
1931
1938
}
0 commit comments