diff --git a/dist/bare/tablesaw.bare.css b/dist/bare/tablesaw.bare.css index a752c33..36e15f4 100644 --- a/dist/bare/tablesaw.bare.css +++ b/dist/bare/tablesaw.bare.css @@ -1,4 +1,4 @@ -/*! Tablesaw - v1.0.1 - 2014-12-09 +/*! Tablesaw - v1.0.1 - 2014-12-15 * https://github.com/filamentgroup/tablesaw * Copyright (c) 2014 Filament Group; Licensed MIT */ diff --git a/dist/stackonly/tablesaw.stackonly.css b/dist/stackonly/tablesaw.stackonly.css index 7dc414a..84cb5c5 100644 --- a/dist/stackonly/tablesaw.stackonly.css +++ b/dist/stackonly/tablesaw.stackonly.css @@ -1,4 +1,4 @@ -/*! Tablesaw - v1.0.1 - 2014-12-09 +/*! Tablesaw - v1.0.1 - 2014-12-15 * https://github.com/filamentgroup/tablesaw * Copyright (c) 2014 Filament Group; Licensed MIT */ diff --git a/dist/stackonly/tablesaw.stackonly.js b/dist/stackonly/tablesaw.stackonly.js index aa88360..b37e9b2 100644 --- a/dist/stackonly/tablesaw.stackonly.js +++ b/dist/stackonly/tablesaw.stackonly.js @@ -1,4 +1,4 @@ -/*! Tablesaw - v1.0.1 - 2014-12-09 +/*! Tablesaw - v1.0.1 - 2014-12-15 * https://github.com/filamentgroup/tablesaw * Copyright (c) 2014 Filament Group; Licensed MIT */ ;(function( $ ) { @@ -27,6 +27,20 @@ } })( jQuery ); +/* +* tablesaw: A set of plugins for responsive tables +* Stack and Column Toggle tables +* Copyright (c) 2013 Filament Group, Inc. +* MIT License +*/ + +if( typeof Tablesaw === "undefined" ) { + Tablesaw = {}; +} +if( !Tablesaw.config ) { + Tablesaw.config = {}; +} + ;(function( $ ) { var pluginName = "table", classes = { @@ -230,7 +244,9 @@ Stack.prototype.destroy = function() { this.$table.removeClass( classes.stackTable ); this.$table.find( '.' + classes.cellLabels ).remove(); - this.$table.find( '.' + classes.cellContentLabels ).remove(); + this.$table.find( '.' + classes.cellContentLabels ).each(function() { + $( this ).replaceWith( this.childNodes ); + }); }; // on tablecreate, init diff --git a/dist/stackonly/tablesaw.stackonly.scss b/dist/stackonly/tablesaw.stackonly.scss index c94a4cc..392614d 100644 --- a/dist/stackonly/tablesaw.stackonly.scss +++ b/dist/stackonly/tablesaw.stackonly.scss @@ -1,7 +1,7 @@ -/*! Tablesaw - v1.0.1 - 2014-12-09 +/*! Tablesaw - v1.0.1 - 2014-12-15 * https://github.com/filamentgroup/tablesaw * Copyright (c) 2014 Filament Group; Licensed MIT */ -/*! Tablesaw - v1.0.1 - 2014-12-09 +/*! Tablesaw - v1.0.1 - 2014-12-15 * https://github.com/filamentgroup/tablesaw * Copyright (c) 2014 Filament Group; Licensed MIT */ diff --git a/dist/tablesaw.css b/dist/tablesaw.css index 690d61c..e9e5128 100644 --- a/dist/tablesaw.css +++ b/dist/tablesaw.css @@ -1,4 +1,4 @@ -/*! Tablesaw - v1.0.1 - 2014-12-09 +/*! Tablesaw - v1.0.1 - 2014-12-15 * https://github.com/filamentgroup/tablesaw * Copyright (c) 2014 Filament Group; Licensed MIT */ diff --git a/dist/tablesaw.js b/dist/tablesaw.js index eb18803..fb73a42 100644 --- a/dist/tablesaw.js +++ b/dist/tablesaw.js @@ -1,4 +1,4 @@ -/*! Tablesaw - v1.0.1 - 2014-12-09 +/*! Tablesaw - v1.0.1 - 2014-12-15 * https://github.com/filamentgroup/tablesaw * Copyright (c) 2014 Filament Group; Licensed MIT */ ;(function( $ ) { @@ -27,6 +27,20 @@ } })( jQuery ); +/* +* tablesaw: A set of plugins for responsive tables +* Stack and Column Toggle tables +* Copyright (c) 2013 Filament Group, Inc. +* MIT License +*/ + +if( typeof Tablesaw === "undefined" ) { + Tablesaw = {}; +} +if( !Tablesaw.config ) { + Tablesaw.config = {}; +} + ;(function( $ ) { var pluginName = "table", classes = { @@ -230,7 +244,9 @@ Stack.prototype.destroy = function() { this.$table.removeClass( classes.stackTable ); this.$table.find( '.' + classes.cellLabels ).remove(); - this.$table.find( '.' + classes.cellContentLabels ).remove(); + this.$table.find( '.' + classes.cellContentLabels ).each(function() { + $( this ).replaceWith( this.childNodes ); + }); }; // on tablecreate, init @@ -519,6 +535,14 @@ }( this, jQuery )); ;(function( win, $, undefined ){ + $.extend( Tablesaw.config, { + swipe: { + horizontalThreshold: 15, + verticalThreshold: 30 + } + }); + + var config = Tablesaw.config.swipe; function createSwipeTable( $table ){ @@ -711,27 +735,31 @@ e.preventDefault(); }); + function getCoord( event, key ) { + return ( event.touches || event.originalEvent.touches )[ 0 ][ key ]; + } + $table .bind( "touchstart.swipetoggle", function( e ){ - var originX = ( e.touches || e.originalEvent.touches )[ 0 ].pageX, - originY = ( e.touches || e.originalEvent.touches )[ 0 ].pageY, + var originX = getCoord( e, 'pageX' ), + originY = getCoord( e, 'pageY' ), x, y; $( this ) .bind( "touchmove", function( e ){ - x = ( e.touches || e.originalEvent.touches )[ 0 ].pageX; - y = ( e.touches || e.originalEvent.touches )[ 0 ].pageY; + x = getCoord( e, 'pageX' ); + y = getCoord( e, 'pageY' ); - if( Math.abs( x - originX ) > 15 && Math.abs( y - originY ) < 20 ) { + if( Math.abs( x - originX ) > config.horizontalThreshold && Math.abs( y - originY ) < config.verticalThreshold ) { e.preventDefault(); } }) .bind( "touchend.swipetoggle", function(){ - if( x - originX < 15 ){ + if( x - originX < -1 * config.horizontalThreshold ){ advance( true ); } - if( x - originX > -15 ){ + if( x - originX > config.horizontalThreshold ){ advance( false ); } @@ -957,7 +985,7 @@ }, getSortFxn = function( ascending, forceNumeric ){ var fn, - regex = /[^\d\.]/g; + regex = /[^\-\+\d\.]/g; if( ascending ){ fn = function( a , b ){ if( forceNumeric || !isNaN( parseFloat( a.cell ) ) ) {