Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

floatthead

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

floatthead - npm Package Compare versions

Comparing version 1.2.2 to 1.2.4

dist/jquery.floatThead-slim.js

5

bower.json
{
"name": "jquery.floatThead",
"version": "1.2.2",
"version": "1.2.4",
"homepage": "http://mkoryak.github.io/floatThead/",

@@ -23,5 +23,4 @@ "authors": [

"dependencies": {
"jquery": ">= 1.9.0",
"underscore": ">= 1.3.0"
"jquery": ">= 1.9.0"
}
}

128

jquery.floatThead.js

@@ -1,2 +0,2 @@

// @preserve jQuery.floatThead 1.2.2 - http://mkoryak.github.io/floatThead/ - Copyright (c) 2012 - 2014 Misha Koryak
// @preserve jQuery.floatThead 1.2.4 - http://mkoryak.github.io/floatThead/ - Copyright (c) 2012 - 2014 Misha Koryak
// @license Licensed under http://creativecommons.org/licenses/by-sa/4.0/

@@ -9,3 +9,2 @@

* jquery 1.9.0 + [required] OR jquery 1.7.0 + jquery UI core
* underscore.js 1.3.0 + [required]
*

@@ -17,6 +16,2 @@ * http://mkoryak.github.io/floatThead/

*/
// ==ClosureCompiler==
// @compilation_level SIMPLE_OPTIMIZATIONS
// @output_file_name jquery.floatThead.min.js
// ==/ClosureCompiler==
(function( $ ) {

@@ -27,27 +22,29 @@ /**

*/
$.floatThead = {
defaults: {
cellTag: 'th:visible', //thead cells are this
zIndex: 1001, //zindex of the floating thead (actually a container div)
debounceResizeMs: 1,
useAbsolutePositioning: true, //if set to NULL - defaults: has scrollContainer=true, doesn't have scrollContainer=false
scrollingTop: 0, //String or function($table) - offset from top of window where the header should not pass above
scrollingBottom: 0, //String or function($table) - offset from the bottom of the table where the header should stop scrolling
scrollContainer: function($table){
return $([]); //if the table has horizontal scroll bars then this is the container that has overflow:auto and causes those scroll bars
},
getSizingRow: function($table, $cols, $fthCells){ // this is only called when using IE,
// override it if the first row of the table is going to contain colgroups (any cell spans greater then one col)
// it should return a jquery object containing a wrapped set of table cells comprising a row that contains no col spans and is visible
return $table.find('tbody tr:visible:first>td');
},
floatTableClass: 'floatThead-table',
floatContainerClass: 'floatThead-container',
debug: false //print possible issues (that don't prevent script loading) to console, if console exists.
}
$.floatThead = $.floatThead || {};
$.floatThead.defaults = {
cellTag: 'th:visible', //thead cells are this
zIndex: 1001, //zindex of the floating thead (actually a container div)
debounceResizeMs: 1,
useAbsolutePositioning: true, //if set to NULL - defaults: has scrollContainer=true, doesn't have scrollContainer=false
scrollingTop: 0, //String or function($table) - offset from top of window where the header should not pass above
scrollingBottom: 0, //String or function($table) - offset from the bottom of the table where the header should stop scrolling
scrollContainer: function($table){
return $([]); //if the table has horizontal scroll bars then this is the container that has overflow:auto and causes those scroll bars
},
getSizingRow: function($table, $cols, $fthCells){ // this is only called when using IE,
// override it if the first row of the table is going to contain colgroups (any cell spans greater then one col)
// it should return a jquery object containing a wrapped set of table cells comprising a row that contains no col spans and is visible
return $table.find('tbody tr:visible:first>td');
},
floatTableClass: 'floatThead-table',
floatWrapperClass: 'floatThead-wrapper',
floatContainerClass: 'floatThead-container',
copyTableClass: true, //copy 'class' attribute from table into the floated table so that the styles match.
debug: false //print possible issues (that don't prevent script loading) to console, if console exists.
};
var util = window._;
//browser stuff
var ieVersion = function(){for(var a=3,b=document.createElement("b"),c=b.all||[];b.innerHTML="<!--[if gt IE "+ ++a+"]><i><![endif]-->",c[0];);return 4<a?a:document.documentMode}();
var ieVersion = function(){for(var a=3,b=document.createElement("b"),c=b.all||[];a = 1+a,b.innerHTML="<!--[if gt IE "+ a +"]><i><![endif]-->",c[0];);return 4<a?a:document.documentMode}();
var isChrome = null;

@@ -75,3 +72,3 @@ var isChromeCheck = function(){

function windowResize(debounceMs, cb){
$window.bind('resize.floatTHead', _.debounce(cb, debounceMs)); //TODO: check if resize bug is gone in IE8 +
$window.bind('resize.floatTHead', util.debounce(cb, debounceMs)); //TODO: check if resize bug is gone in IE8 +
}

@@ -117,2 +114,10 @@

$.fn.floatThead = function(map){
map = map || {};
if(!util){ //may have been included after the script? lets try to grab it again.
util = window._ || $.floatThead._;
if(!util){
throw new Error("jquery.floatThead-slim.js requires underscore. You should use the non-lite version since you do not have underscore.");
}
}
if(ieVersion < 8){

@@ -131,3 +136,3 @@ return this; //no more crappy browser support.

}
if(_.isString(map)){
if(util.isString(map)){
var command = map;

@@ -137,3 +142,3 @@ var ret = this;

var obj = $(this).data('floatThead-attached');
if(obj && _.isFunction(obj[command])){
if(obj && util.isFunction(obj[command])){
var r = obj[command]();

@@ -147,7 +152,7 @@ if(typeof r !== 'undefined'){

}
var opts = $.extend({}, $.floatThead.defaults, map);
var opts = $.extend({}, $.floatThead.defaults || {}, map);
_.each(map, function(val, key){
$.each(map, function(val, key){
if((!(key in $.floatThead.defaults)) && opts.debug){
debug("jQuery.floatThead: used ["+key+"] key to init plugin, but that param is not an option for the plugin. Valid options are: "+ (_.keys($.floatThead.defaults)).join(', '));
debug("jQuery.floatThead: used ["+key+"] key to init plugin, but that param is not an option for the plugin. Valid options are: "+ (util.keys($.floatThead.defaults)).join(', '));
}

@@ -190,2 +195,3 @@ });

var wrappedContainer = false; //used with absolute positioning enabled. did we need to wrap the scrollContainer/table with a relative div?
var $wrapper = $([]); //used when absolute positioning enabled - wraps the table and the float container
var absoluteToFixedOnScroll = ieVersion <= 9 && !locked && useAbsolutePositioning; //on ie using absolute positioning doesnt look good with window scrolling, so we change positon to fixed on scroll, and then change it back to absolute when done.

@@ -213,3 +219,11 @@ var $floatTable = $("<table/>");

$floatContainer.append($floatTable);
$floatTable.attr('class', $table.attr('class'));
if(opts.copyTableClass){
$floatTable.attr('class', $table.attr('class'));
}
$floatTable.attr({ //copy over some deprecated table attributes that people still like to use. Good thing poeple dont use colgroups...
'cellpadding': $table.attr('cellpadding'),
'cellspacing': $table.attr('cellspacing'),
'border': $table.attr('border')
});
$floatTable.addClass(opts.floatTableClass).css('margin', 0); //must have no margins or you wont be able to click on things under floating table

@@ -224,3 +238,3 @@

$floatContainer.css(css);
$container = $container.wrap("<div style='position: relative; clear:both;'></div>").parent();
$container = $container.wrap("<div class='"+opts.floatWrapperClass+"' style='position: relative; clear:both;'></div>").parent();
wrappedContainer = true;

@@ -231,6 +245,6 @@ }

if(locked){
var $relative = makeRelative($scrollContainer, true);
$relative.append($floatContainer);
$wrapper = makeRelative($scrollContainer, true);
$wrapper.append($floatContainer);
} else {
makeRelative($table);
$wrapper = makeRelative($table);
$table.after($floatContainer);

@@ -249,3 +263,3 @@ }

});
$floatContainer.addClass(opts.floatContainerClass)
$floatContainer.addClass(opts.floatContainerClass);
updateScrollingOffsets();

@@ -255,5 +269,6 @@

var layoutAuto = {'table-layout': $table.css('tableLayout') || 'auto'};
var originalTableWidth = $table[0].style.width || "auto";
function setHeaderHeight(){
var headerHeight = $header.outerHeight(true);
var headerHeight = $header.find(opts.cellTag).outerHeight(true);
$sizerRow.outerHeight(headerHeight);

@@ -277,4 +292,4 @@ $sizerCells.outerHeight(headerHeight);

function updateScrollingOffsets(){
scrollingTop = (_.isFunction(opts.scrollingTop) ? opts.scrollingTop($table) : opts.scrollingTop) || 0;
scrollingBottom = (_.isFunction(opts.scrollingBottom) ? opts.scrollingBottom($table) : opts.scrollingBottom) || 0;
scrollingTop = (util.isFunction(opts.scrollingTop) ? opts.scrollingTop($table) : opts.scrollingTop) || 0;
scrollingBottom = (util.isFunction(opts.scrollingBottom) ? opts.scrollingBottom($table) : opts.scrollingBottom) || 0;
}

@@ -287,7 +302,6 @@

var $headerColumns = $header.find('tr:first>'+opts.cellTag);
var count = _.reduce($headerColumns, function(sum, cell){
var colspan = parseInt(($(cell).attr('colspan') || 1), 10);
return sum + colspan;
}, 0);
var count = 0;
$headerColumns.each(function(){
count += parseInt(($(this).attr('colspan') || 1), 10);
});
if(count != lastColumnCount){

@@ -297,3 +311,3 @@ lastColumnCount = count;

for(var x = 0; x < count; x++){
cells.push('<th class="floatThead-col-'+x+'"/>');
cells.push('<th class="floatThead-col"/>');
cols.push('<col/>');

@@ -313,2 +327,3 @@ psuedo.push("<fthtd style='display:table-cell;height:0;width:auto;'/>");

$sizerRow.html(cells);
$sizerCells = $sizerRow.find("th");
$tableColGroup.html(cols);

@@ -326,2 +341,9 @@ $tableCells = $tableColGroup.find('col');

headerFloated = true;
if(useAbsolutePositioning){ //#53, #56
var tableWidth = $table.width();
var wrapperWidth = $wrapper.width();
if(tableWidth > wrapperWidth){
$table.css('minWidth', tableWidth);
}
}
$table.css(layoutFixed);

@@ -337,2 +359,5 @@ $floatTable.css(layoutFixed);

headerFloated = false;
if(useAbsolutePositioning){ //#53, #56
$table.width(originalTableWidth);
}
$newHeader.detach();

@@ -401,3 +426,3 @@ $table.prepend($header);

var captionHeight = haveCaption ? $caption.outerHeight(true) : 0;
var captionScrollOffset = captionAlignTop ? captionHeight : -captionHeight;
var captionScrollOffset = captionAlignTop ? captionHeight : -captionHeight;

@@ -562,3 +587,3 @@ var floatContainerHeight = $floatContainer.height();

var windowScrollDoneEvent = _.debounce(function(){
var windowScrollDoneEvent = util.debounce(function(){
repositionFloatContainer(calculateFloatContainerPos('windowScrollDone'), false);

@@ -584,3 +609,3 @@ }, 300);

};
var reflowEvent = _.debounce(function(){
var reflowEvent = util.debounce(function(){
calculateScrollBarSize();

@@ -617,2 +642,3 @@ updateScrollingOffsets();

destroy: function(){
unfloat();
$table.css(layoutAuto);

@@ -619,0 +645,0 @@ $tableColGroup.remove();

{
"name": "floatthead",
"version": "1.2.2",
"version": "1.2.4",
"description": "locking table headers without special css",
"main": "jquery.floatThead.js",
"filename": "jquery.floatThead.js",
"dependencies": {},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {

@@ -27,6 +24,11 @@ "type": "git",

"license": "CC BY-SA 4.0",
"bugs": {
"url": "https://github.com/mkoryak/floatThead/issues"
},
"homepage": "https://github.com/mkoryak/floatThead"
"bugs": "https://github.com/mkoryak/floatThead/issues",
"homepage": "https://github.com/mkoryak/floatThead",
"npmName": "floatthead",
"npmFileMap": [{
"basePath": "/dist/",
"files": [
"*.js"
]
}]
}

@@ -1,2 +0,2 @@

jquery.floatThead v1.2.2
jquery.floatThead v1.2.4
=================

@@ -20,4 +20,7 @@

Install:
Download / Install:
--------
#### Via Bower
Install using [Bower](http://bower.io/):

@@ -28,8 +31,19 @@

```
#### CDN Hosted
[http://cdnjs.com/libraries/floatthead/](http://cdnjs.com/libraries/floatthead/)
or download:
- [development version](https://raw.github.com/mkoryak/floatThead/master/jquery.floatThead.js)
- [production version](https://raw.github.com/mkoryak/floatThead/master/jquery.floatThead.min.js)
#### Download
- [development version](https://raw.github.com/mkoryak/floatThead/master/dist/jquery.floatThead.js)
- [production version](https://raw.github.com/mkoryak/floatThead/master/dist/jquery.floatThead.min.js)
if your project includes [underscore](http://underscorejs.org) and you want to save a few bytes you can use the slim version:
- [slim development version](https://raw.github.com/mkoryak/floatThead/master/dist/jquery.floatThead-slim.js)
- [slim production version](https://raw.github.com/mkoryak/floatThead/master/dist/jquery.floatThead-slim.min.js)
Features:

@@ -51,3 +65,2 @@ ---------

- jQuery 1.8.x or better (1.9 compliant) (or jQuery 1.7.x and jQuery UI core)
- Underscore.js 1.3 or better
- IE8, IE9, IE10, IE11, FF10+ or Chrome15+.

@@ -74,3 +87,16 @@ - The following meta tag to placate IE: <code>&lt;meta http-equiv="X-UA-Compatible" content="IE=10; IE=9; IE=8; IE=7; IE=EDGE" /&gt;</code>

### 1.2.4
- better support for really really wide tables
- fixed https://github.com/mkoryak/floatThead/issues/53
- fixed https://github.com/mkoryak/floatThead/issues/56
### 1.2.3
- removed underscore dependency, added a *slim* version which is very slightly smaller and requires underscore
- now supporting a few evil deprecated table attributes that people still use: `cellpadding` and `cellspacing`
- fixed https://github.com/mkoryak/floatThead/issues/52
- fixed https://github.com/mkoryak/floatThead/issues/50
- added floatWrapperClass option
- added copyTableClass option
### 1.2.2

@@ -118,3 +144,3 @@

[Fixed-Table-Header](https://github.com/markmalek/Fixed-Header-Table/)
This is the orignal. It has been around for ages and it will be the first plugin you find when you start looking. It also has a ton of open unresolved issues. It does not support window scrolling, it does not seem to support y-scrolling withing the container. It loses the events you attached to the thead. **Stay away.**
This is the original. It has been around for ages and it will be the first plugin you find when you start looking. It also has a ton of open unresolved issues. It does not support window scrolling, it does not seem to support y-scrolling withing the container. It loses the events you attached to the thead. Lots of open issues. **Stay away.**

@@ -121,0 +147,0 @@ [Fixed table rows cols](http://meetselva.github.io/fixed-table-rows-cols)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc