floatthead
Advanced tools
Comparing version 2.1.3 to 2.1.4
@@ -7,3 +7,3 @@ { | ||
], | ||
"description": "Unobtrusively float any table's header without breaking styles or events", | ||
"description": "Fixed <thead>. Doesn't need any custom css/html. Does what position:sticky can't", | ||
"main": [ | ||
@@ -10,0 +10,0 @@ "dist/jquery.floatThead.js", |
@@ -0,1 +1,11 @@ | ||
### 2.1.4 | ||
This release is dedicated to my cat. May he rest in catnip and meats. | ||
new features: | ||
- Added `ariaLabel` function to the config object to give more flexibilty on the values the plugin uses. (doc site updated). | ||
bug fixes: | ||
- #432 - Improve RTL support. | ||
- #440 - Aria label does not work with quotes. | ||
### 2.1.3 | ||
@@ -2,0 +12,0 @@ Maintenance release. |
How to get help with the floatThead | ||
------------ | ||
**I just had a kid, and I work at a startup,** | ||
**I am old, and I work at Google,** | ||
I don't have time to reproduce your issue on my own, so please provide a **jsfiddle!!!** | ||
@@ -5,0 +5,0 @@ |
@@ -1,2 +0,2 @@ | ||
/** @preserve jQuery.floatThead 2.1.2 - https://mkoryak.github.io/floatThead/ - Copyright (c) 2012 - 2018 Misha Koryak **/ | ||
/** @preserve jQuery.floatThead 2.1.4 - https://mkoryak.github.io/floatThead/ - Copyright (c) 2012 - 2019 Misha Koryak **/ | ||
// @license MIT | ||
@@ -37,2 +37,8 @@ | ||
}, | ||
ariaLabel: function($table, $headerCell, columnIndex) { // This function will run for every header cell that exists in the table when we add aria-labels. | ||
// Override to customize the aria-label. NOTE: These labels will be added to the 'sizer cells' which get added to the real table and are not visible by the user (only screen readers), | ||
// The number of sizer columns might not match the header columns in your real table - I insert one sizer header cell per column. This means that if your table uses colspans or multiple header rows, | ||
// this will not be reflected by sizer cells. This is why I am giving you the `columnIndex`. | ||
return $headerCell.text(); | ||
}, | ||
floatTableClass: 'floatThead-table', | ||
@@ -73,3 +79,3 @@ floatWrapperClass: 'floatThead-wrapper', | ||
that['is' + name] = function(obj) { | ||
return Object.prototype.toString.call(obj) == '[object ' + name + ']'; | ||
return Object.prototype.toString.call(obj) === '[object ' + name + ']'; | ||
}; | ||
@@ -110,2 +116,3 @@ }); | ||
var isWebkit = /WebKit\//.test(navigator.userAgent); | ||
var isRTL = /rtl/i.test(document.documentElement.dir || ''); | ||
@@ -120,12 +127,12 @@ if(!(ieVersion || isFF || isWebkit)){ | ||
var $test = $('<div>').css('width', 0).append( | ||
$('<table>').css('max-width', '100%').append( | ||
$('<tr>').append( | ||
$('<th>').append( | ||
$('<div>').css('min-width', 100).text('X') | ||
) | ||
$('<table>').css('max-width', '100%').append( | ||
$('<tr>').append( | ||
$('<th>').append( | ||
$('<div>').css('min-width', 100).text('X') | ||
) | ||
) | ||
) | ||
) | ||
); | ||
$("body").append($test); | ||
var ret = ($test.find("table").width() == 0); | ||
var ret = ($test.find("table").width() === 0); | ||
$test.remove(); | ||
@@ -161,7 +168,7 @@ return ret; | ||
function windowResize(eventName, cb){ | ||
if(ieVersion == 8){ //ie8 is crap: https://github.com/mkoryak/floatThead/issues/65 | ||
if(ieVersion === 8){ //ie8 is crap: https://github.com/mkoryak/floatThead/issues/65 | ||
var winWidth = $window.width(); | ||
var debouncedCb = util.debounce(function(){ | ||
var winWidthNew = $window.width(); | ||
if(winWidth != winWidthNew){ | ||
if(winWidth !== winWidthNew){ | ||
winWidth = winWidthNew; | ||
@@ -186,7 +193,7 @@ cb(); | ||
if (pos != 'visible') break; | ||
if (pos !== 'visible') break; | ||
} while (parent = parent.parentElement); | ||
if(parent == document.body){ | ||
if(parent === document.body){ | ||
return $([]); | ||
@@ -230,3 +237,3 @@ } | ||
var table = $table.dataTableSettings[i].nTable; | ||
if($table[0] == table){ | ||
if($table[0] === table){ | ||
return true; | ||
@@ -298,3 +305,3 @@ } | ||
var v = $.fn.jquery.split("."); | ||
if(parseInt(v[0], 10) == 1 && parseInt(v[1], 10) <= 7){ | ||
if(parseInt(v[0], 10) === 1 && parseInt(v[1], 10) <= 7){ | ||
debug("jQuery version "+$.fn.jquery+" detected! This plugin supports 1.8 or better, or 1.7.x with jQuery UI 1.8.24 -> http://jqueryui.com/resources/download/jquery-ui-1.8.24.zip") | ||
@@ -316,5 +323,5 @@ } | ||
var $tbody = $table.children('tbody:first'); | ||
if($header.length == 0 || $tbody.length == 0){ | ||
if($header.length === 0 || $tbody.length === 0){ | ||
if(opts.debug) { | ||
if($header.length == 0){ | ||
if($header.length === 0){ | ||
debug('The thead element is missing.'); | ||
@@ -372,3 +379,3 @@ } else{ | ||
var $caption = $table.find("caption"); | ||
var haveCaption = $caption.length == 1; | ||
var haveCaption = $caption.length === 1; | ||
if(haveCaption){ | ||
@@ -393,3 +400,3 @@ var captionAlignTop = ($caption.css("caption-side") || $caption.attr("align") || "top") === "top"; | ||
var existingColGroup = true; | ||
if($tableColGroup.length == 0){ | ||
if($tableColGroup.length === 0){ | ||
$tableColGroup = $("<colgroup/>"); | ||
@@ -407,3 +414,3 @@ existingColGroup = false; | ||
var $newHeader = $("<thead/>"); | ||
var $sizerRow = $('<tr class="size-row" aria-hidden="true"/>'); | ||
var $sizerRow = $('<tr class="size-row"/>'); | ||
var $sizerCells = $([]); | ||
@@ -427,12 +434,12 @@ var $tableCells = $([]); //used for sizing - either $sizerCells or $tableColGroup cols. $tableColGroup cols are only created in chrome for borderCollapse:collapse because of a chrome bug. | ||
$floatTable.attr({ //copy over some deprecated table attributes that people still like to use. Good thing people don't use colgroups... | ||
'cellpadding': $table.attr('cellpadding'), | ||
'cellspacing': $table.attr('cellspacing'), | ||
'border': $table.attr('border') | ||
}); | ||
'cellpadding': $table.attr('cellpadding'), | ||
'cellspacing': $table.attr('cellspacing'), | ||
'border': $table.attr('border') | ||
}); | ||
var tableDisplayCss = $table.css('display'); | ||
$floatTable.css({ | ||
'borderCollapse': $table.css('borderCollapse'), | ||
'border': $table.css('border'), | ||
'display': tableDisplayCss | ||
}); | ||
'borderCollapse': $table.css('borderCollapse'), | ||
'border': $table.css('border'), | ||
'display': tableDisplayCss | ||
}); | ||
if(!locked){ | ||
@@ -450,3 +457,3 @@ $floatTable.css('width', 'auto'); | ||
var positionCss = $container.css('position'); | ||
var relativeToScrollContainer = (positionCss == "relative" || positionCss == "absolute"); | ||
var relativeToScrollContainer = (positionCss === "relative" || positionCss === "absolute"); | ||
var $containerWrap = $container; | ||
@@ -457,6 +464,6 @@ if(!relativeToScrollContainer || alwaysWrap){ | ||
$containerWrap = $container.data('floatThead-containerWrap') || $container.wrap( | ||
$('<div>').addClass(opts.floatWrapperClass).css({ | ||
'position': 'relative', | ||
'clear': 'both' | ||
}) | ||
$('<div>').addClass(opts.floatWrapperClass).css({ | ||
'position': 'relative', | ||
'clear': 'both' | ||
}) | ||
).parent(); | ||
@@ -504,3 +511,3 @@ $container.data('floatThead-containerWrap', $containerWrap); //multiple tables inside one scrolling container - #242 | ||
}); | ||
if($table.css('border-collapse') == 'collapse') { | ||
if($table.css('border-collapse') === 'collapse') { | ||
var tableBorderTopHeight = parseInt($table.css('border-top-width'), 10); | ||
@@ -521,3 +528,3 @@ var cellBorderTopHeight = parseInt($table.find("thead tr:first").find(">*:first").css('border-top-width'), 10); | ||
var width = $container.length ? getOffsetWidth($container[0]) : tw; | ||
var floatContainerWidth = $container.css("overflow-y") != 'hidden' ? width - scrollbarOffset.vertical : width; | ||
var floatContainerWidth = $container.css("overflow-y") !== 'hidden' ? width - scrollbarOffset.vertical : width; | ||
$floatContainer.width(floatContainerWidth); | ||
@@ -553,13 +560,16 @@ if(locked){ | ||
lastColumnCount = count; | ||
var cells = [], cols = [], psuedo = [], content; | ||
var cells = [], cols = [], psuedo = []; | ||
$sizerRow.empty(); | ||
for(var x = 0; x < count; x++){ | ||
content = $headerColumns.eq(x).text(); | ||
cells.push('<th class="floatThead-col" aria-label="'+content+'"/>'); | ||
var cell = document.createElement('th'); | ||
cell.setAttribute('aria-label', opts.ariaLabel($table, $headerColumns.eq(x), x)); | ||
cell.className = 'floatThead-col'; | ||
$sizerRow[0].appendChild(cell); | ||
cols.push('<col/>'); | ||
psuedo.push( | ||
$('<fthtd>').css({ | ||
'display': 'table-cell', | ||
'height': 0, | ||
'width': 'auto' | ||
}) | ||
$('<fthtd>').css({ | ||
'display': 'table-cell', | ||
'height': 0, | ||
'width': 'auto' | ||
}) | ||
); | ||
@@ -569,4 +579,3 @@ } | ||
cols = cols.join(''); | ||
cells = cells.join(''); | ||
if(createElements){ | ||
@@ -577,4 +586,3 @@ $fthRow.empty(); | ||
} | ||
$sizerRow.html(cells); | ||
$sizerCells = $sizerRow.find("th"); | ||
@@ -626,3 +634,3 @@ if(!existingColGroup){ | ||
function triggerFloatEvent(isFloating){ | ||
if(isHeaderFloatingLogical != isFloating){ | ||
if(isHeaderFloatingLogical !== isFloating){ | ||
isHeaderFloatingLogical = isFloating; | ||
@@ -633,3 +641,3 @@ $table.triggerHandler("floatThead", [isFloating, $floatContainer]) | ||
function changePositioning(isAbsolute){ | ||
if(useAbsolutePositioning != isAbsolute){ | ||
if(useAbsolutePositioning !== isAbsolute){ | ||
useAbsolutePositioning = isAbsolute; | ||
@@ -665,3 +673,3 @@ $floatContainer.css({ | ||
if($rowCells.length == numCols && numCols > 0){ | ||
if($rowCells.length === numCols && numCols > 0){ | ||
if(!existingColGroup){ | ||
@@ -704,3 +712,3 @@ for(i=0; i < numCols; i++){ | ||
function isResponsiveContainerActive(){ | ||
return $responsiveContainer.css("overflow-x") == 'auto'; | ||
return $responsiveContainer.css("overflow-x") === 'auto'; | ||
} | ||
@@ -762,6 +770,6 @@ /** | ||
if(eventType == 'windowScroll'){ | ||
if(eventType === 'windowScroll'){ | ||
windowTop = $window.scrollTop(); | ||
windowLeft = $window.scrollLeft(); | ||
} else if(eventType == 'containerScroll'){ | ||
} else if(eventType === 'containerScroll'){ | ||
if($responsiveContainer.length){ | ||
@@ -776,3 +784,3 @@ if(!responsive){ | ||
} | ||
} else if(eventType != 'init') { | ||
} else if(eventType !== 'init') { | ||
windowTop = $window.scrollTop(); | ||
@@ -783,3 +791,4 @@ windowLeft = $window.scrollLeft(); | ||
} | ||
if(isWebkit && (windowTop < 0 || windowLeft < 0)){ //chrome overscroll effect at the top of the page - breaks fixed positioned floated headers | ||
if(isWebkit && (windowTop < 0 || (isRTL && windowLeft > 0 ) || ( !isRTL && windowLeft < 0 )) ){ | ||
//chrome overscroll effect at the top of the page - breaks fixed positioned floated headers | ||
return; | ||
@@ -789,3 +798,3 @@ } | ||
if(absoluteToFixedOnScroll){ | ||
if(eventType == 'windowScrollDone'){ | ||
if(eventType === 'windowScrollDone'){ | ||
changePositioning(true); //change to absolute | ||
@@ -795,3 +804,3 @@ } else { | ||
} | ||
} else if(eventType == 'windowScrollDone'){ | ||
} else if(eventType === 'windowScrollDone'){ | ||
return null; //event is fired when they stop scrolling. ignore it if not 'absoluteToFixedOnScroll' | ||
@@ -874,3 +883,3 @@ } | ||
return function(pos, setWidth, setHeight){ | ||
if(pos != null && (oldTop != pos.top || oldLeft != pos.left)){ | ||
if(pos != null && (oldTop !== pos.top || oldLeft !== pos.left)){ | ||
if(ieVersion === 8){ | ||
@@ -890,4 +899,4 @@ $floatContainer.css({ | ||
'top': 0, | ||
'left': 0, | ||
}; | ||
cssObj[/rtl/i.test(document.documentElement.dir || '') ? 'right': 'left'] = 0; | ||
$floatContainer.css(cssObj); | ||
@@ -905,3 +914,3 @@ } | ||
var scrollLeft = (responsive ? $responsiveContainer : $scrollContainer).scrollLeft(); | ||
if(!useAbsolutePositioning || oldScrollLeft != scrollLeft){ | ||
if(!useAbsolutePositioning || oldScrollLeft !== scrollLeft){ | ||
$floatContainer.scrollLeft(scrollLeft); | ||
@@ -921,3 +930,3 @@ oldScrollLeft = scrollLeft; | ||
} else { | ||
if($scrollContainer.css('overflow-x') == 'scroll'){ | ||
if($scrollContainer.css('overflow-x') === 'scroll'){ | ||
scrollbarOffset.horizontal = scrollbarWidth; | ||
@@ -929,3 +938,3 @@ } else { | ||
} | ||
if($scrollContainer.css('overflow-y') == 'scroll'){ | ||
if($scrollContainer.css('overflow-y') === 'scroll'){ | ||
scrollbarOffset.vertical = scrollbarWidth; | ||
@@ -1062,3 +1071,3 @@ } else { | ||
var wasTableRelated = function(nodes){ | ||
return nodes && nodes[0] && (nodes[0].nodeName == "THEAD" || nodes[0].nodeName == "TD"|| nodes[0].nodeName == "TH"); | ||
return nodes && nodes[0] && (nodes[0].nodeName === "THEAD" || nodes[0].nodeName === "TD"|| nodes[0].nodeName === "TH"); | ||
}; | ||
@@ -1065,0 +1074,0 @@ for(var i=0; i < e.length; i++){ |
@@ -1,2 +0,2 @@ | ||
/** @preserve jQuery.floatThead 2.1.2 - https://mkoryak.github.io/floatThead/ - Copyright (c) 2012 - 2018 Misha Koryak **/ | ||
!function(ht){ht.floatThead=ht.floatThead||{},ht.floatThead.defaults={headerCellSelector:"tr:visible:first>*:visible",zIndex:1001,position:"auto",top:0,bottom:0,scrollContainer:function(t){return ht([])},responsiveContainer:function(t){return ht([])},getSizingRow:function(t,e,o){return t.find("tbody tr:visible:first>*:visible")},floatTableClass:"floatThead-table",floatWrapperClass:"floatThead-wrapper",floatContainerClass:"floatThead-container",copyTableClass:!0,autoReflow:!1,debug:!1,support:{bootstrap:!0,datatables:!0,jqueryUI:!0,perfectScrollbar:!0},floatContainerCss:{"overflow-x":"hidden"}};var vt=function(){var n={},o=Object.prototype.hasOwnProperty;n.has=function(t,e){return o.call(t,e)},n.keys=Object.keys||function(t){if(t!==Object(t))throw new TypeError("Invalid object");var e=[];for(var o in t)n.has(t,o)&&e.push(o);return e};var r=0;return n.uniqueId=function(t){var e=++r+"";return t?t+e:e},ht.each(["Arguments","Function","String","Number","Date","RegExp"],function(){var e=this;n["is"+e]=function(t){return Object.prototype.toString.call(t)=="[object "+e+"]"}}),n.debounce=function(o,n,r){var a,i,l,s,d;return function(){l=this,i=arguments,s=new Date;var e=function(){var t=new Date-s;t<n?a=setTimeout(e,n-t):(a=null,r||(d=o.apply(l,i)))},t=r&&!a;return a||(a=setTimeout(e,n)),t&&(d=o.apply(l,i)),d}},n}(),bt="undefined"!=typeof MutationObserver,wt=function(){for(var t=3,e=document.createElement("b"),o=e.all||[];t=1+t,e.innerHTML="\x3c!--[if gt IE "+t+"]><i><![endif]--\x3e",o[0];);return 4<t?t:document.documentMode}(),t=/Gecko\//.test(navigator.userAgent),gt=/WebKit\//.test(navigator.userAgent);wt||t||gt||(wt=11);var l=function(){if(gt){var t=ht("<div>").css("width",0).append(ht("<table>").css("max-width","100%").append(ht("<tr>").append(ht("<th>").append(ht("<div>").css("min-width",100).text("X")))));ht("body").append(t);var e=0==t.find("table").width();return t.remove(),e}return!1},mt=!t&&!wt,yt=ht(window),Tt=t&&window.matchMedia;if(!window.matchMedia||Tt){var e=window.onbeforeprint,o=window.onafterprint;window.onbeforeprint=function(){e&&e(),yt.triggerHandler("fth-beforeprint")},window.onafterprint=function(){o&&o(),yt.triggerHandler("fth-afterprint")}}function Ct(t){var e=t[0].parentElement;do{if("visible"!=window.getComputedStyle(e).getPropertyValue("overflow"))break}while(e=e.parentElement);return e==document.body?ht([]):ht(e)}function xt(t){window&&window.console&&window.console.error&&window.console.error("jQuery.floatThead: "+t)}function jt(t){var e=t.getBoundingClientRect();return e.width||e.right-e.left}function St(){var t=document.createElement("scrolltester");t.style.cssText="width:100px;height:100px;overflow:scroll!important;position:absolute;top:-9999px;display:block",document.body.appendChild(t);var e=t.offsetWidth-t.clientWidth;return document.body.removeChild(t),e}function zt(t,e,o){var n=o?"outerWidth":"width";if(l&&t.css("max-width")){var r=0;o&&(r+=parseInt(t.css("borderLeft"),10),r+=parseInt(t.css("borderRight"),10));for(var a=0;a<e.length;a++)r+=jt(e.get(a));return r}return t[n]()}ht.fn.floatThead=function(t){if(t=t||{},wt<8)return this;var ut=null;if(vt.isFunction(l)&&(l=l()),vt.isString(t)){var r=t,a=Array.prototype.slice.call(arguments,1),i=this;return this.filter("table").each(function(){var t=ht(this),e=t.data("floatThead-lazy");e&&t.floatThead(e);var o=t.data("floatThead-attached");if(o&&vt.isFunction(o[r])){var n=o[r].apply(this,a);void 0!==n&&(i=n)}}),i}var pt=ht.extend({},ht.floatThead.defaults||{},t);if(ht.each(t,function(t,e){t in ht.floatThead.defaults||!pt.debug||xt("Used ["+t+"] key to init plugin, but that param is not an option for the plugin. Valid options are: "+vt.keys(ht.floatThead.defaults).join(", "))}),pt.debug){var e=ht.fn.jquery.split(".");1==parseInt(e[0],10)&&parseInt(e[1],10)<=7&&xt("jQuery version "+ht.fn.jquery+" detected! This plugin supports 1.8 or better, or 1.7.x with jQuery UI 1.8.24 -> http://jqueryui.com/resources/download/jquery-ui-1.8.24.zip")}return this.filter(":not(."+pt.floatTableClass+")").each(function(){var e=vt.uniqueId(),m=ht(this);if(m.data("floatThead-attached"))return!0;if(!m.is("table"))throw new Error('jQuery.floatThead must be run on a table element. ex: $("table").floatThead();');bt=pt.autoReflow&&bt;var d=m.children("thead:first"),o=m.children("tbody:first");if(0==d.length||0==o.length)return pt.debug&&(0==d.length?xt("The thead element is missing."):xt("The tbody element is missing.")),m.data("floatThead-lazy",pt),void m.unbind("reflow").one("reflow",function(){m.floatThead(pt)});m.data("floatThead-lazy")&&m.unbind("reflow"),m.data("floatThead-lazy",!1);var y,T,n=!0,C={vertical:0,horizontal:0};vt.isFunction(St)&&(St=St());var f=0;!0===pt.scrollContainer&&(pt.scrollContainer=Ct);var x=pt.scrollContainer(m)||ht([]),j=0<x.length,S=j?ht([]):pt.responsiveContainer(m)||ht([]),z=$(),I=null;"auto"===pt.position?I=null:"fixed"===pt.position?I=!1:"absolute"===pt.position?I=!0:pt.debug&&xt('Invalid value given to "position" option, valid is "fixed", "absolute" and "auto". You passed: ',pt.position),null==I&&(I=j);var r=m.find("caption"),L=1==r.length;if(L)var H="top"===(r.css("caption-side")||r.attr("align")||"top");var a=ht("<fthfoot>").css({display:"table-footer-group","border-spacing":0,height:0,"border-collapse":"collapse",visibility:"hidden"}),W=!1,i=ht([]),q=wt<=9&&!j&&I,c=ht("<table/>"),u=ht("<colgroup/>"),p=m.children("colgroup:first"),h=!0;0==p.length&&(p=ht("<colgroup/>"),h=!1);var v=ht("<fthtr>").css({display:"table-row","border-spacing":0,height:0,"border-collapse":"collapse"}),R=ht("<div>").css(pt.floatContainerCss).attr("aria-hidden","true"),M=!1,l=ht("<thead/>"),b=ht('<tr class="size-row" aria-hidden="true"/>'),w=ht([]),g=ht([]),E=ht([]),k=ht([]);l.append(b),m.prepend(p),mt&&(a.append(v),m.append(a)),c.append(u),R.append(c),pt.copyTableClass&&c.attr("class",m.attr("class")),c.attr({cellpadding:m.attr("cellpadding"),cellspacing:m.attr("cellspacing"),border:m.attr("border")});var t=m.css("display");if(c.css({borderCollapse:m.css("borderCollapse"),border:m.css("border"),display:t}),j||c.css("width","auto"),"none"===t&&(M=!0),c.addClass(pt.floatTableClass).css({margin:0,"border-bottom-width":0}),I){var s=function(t,e){var o=t.css("position"),n=t;if(!("relative"==o||"absolute"==o)||e){var r={paddingLeft:t.css("paddingLeft"),paddingRight:t.css("paddingRight")};R.css(r),n=t.data("floatThead-containerWrap")||t.wrap(ht("<div>").addClass(pt.floatWrapperClass).css({position:"relative",clear:"both"})).parent(),t.data("floatThead-containerWrap",n),W=!0}return n};j?(i=s(x,!0)).prepend(R):(i=s(m),m.before(R))}else m.before(R);R.css({position:I?"absolute":"fixed",marginTop:0,top:I?0:"auto",zIndex:pt.zIndex,willChange:"transform"}),R.addClass(pt.floatContainerClass),U();var D={"table-layout":"fixed"},F={"table-layout":m.css("tableLayout")||"auto"},O=m[0].style.width||"",N=m.css("minWidth")||"";function A(t){return t+".fth-"+e+".floatTHead"}function Q(){var t=0;if(d.children("tr:visible").each(function(){t+=ht(this).outerHeight(!0)}),"collapse"==m.css("border-collapse")){var e=parseInt(m.css("border-top-width"),10);parseInt(m.find("thead tr:first").find(">*:first").css("border-top-width"),10)<e&&(t-=e/2)}b.outerHeight(t),w.outerHeight(t)}function U(){y=(vt.isFunction(pt.top)?pt.top(m):pt.top)||0,T=(vt.isFunction(pt.bottom)?pt.bottom(m):pt.bottom)||0}function G(){if(!n){if(n=!0,I){var t=zt(m,k,!0);i.width()<t&&m.css("minWidth",t)}m.css(D),c.css(D),c.append(d),o.before(l),Q()}}function P(){n&&(n=!1,I&&m.width(O),l.detach(),m.prepend(d),m.css(F),c.css(F),m.css("minWidth",N),m.css("minWidth",zt(m,k)))}var V=!1;function X(t){V!=t&&(V=t,m.triggerHandler("floatThead",[t,R]))}function Y(t){I!=t&&(I=t,R.css({position:I?"absolute":"fixed"}))}function B(){var l,s=function(){var t,e=d.find(pt.headerCellSelector);if(h?t=p.find("col").length:(t=0,e.each(function(){t+=parseInt(ht(this).attr("colspan")||1,10)})),t!==f){f=t;for(var o,n=[],r=[],a=[],i=0;i<t;i++)o=e.eq(i).text(),n.push('<th class="floatThead-col" aria-label="'+o+'"/>'),r.push("<col/>"),a.push(ht("<fthtd>").css({display:"table-cell",height:0,width:"auto"}));r=r.join(""),n=n.join(""),mt&&(v.empty(),v.append(a),k=v.find("fthtd")),b.html(n),w=b.find("th"),h||p.html(r),g=p.find("col"),u.html(r),E=u.find("col")}return t}();return function(){var t=R.scrollLeft();g=p.find("col");var e,o,n,r,a=(e=m,o=g,n=k,r=wt,mt?n:r?pt.getSizingRow(e,o,n):o);if(a.length==s&&0<s){if(!h)for(l=0;l<s;l++)g.eq(l).css("width","");P();var i=[];for(l=0;l<s;l++)i[l]=jt(a.get(l));for(l=0;l<s;l++)E.eq(l).width(i[l]),g.eq(l).width(i[l]);G()}else c.append(d),m.css(F),c.css(F),Q();R.scrollLeft(t),m.triggerHandler("reflowed",[R])}}function K(t){var e=x.css("border-"+t+"-width"),o=0;return e&&~e.indexOf("px")&&(o=parseInt(e,10)),o}function $(){return"auto"==S.css("overflow-x")}function J(){var i,l=x.scrollTop(),s=0,d=L?r.outerHeight(!0):0,f=H?d:-d,c=R.height(),u=m.offset(),p=0,h=0;if(j){var t=x.offset();s=u.top-t.top+l,L&&H&&(s+=d),p=K("left"),h=K("top"),s-=h}else i=u.top-y-c+T+C.horizontal;var v=yt.scrollTop(),b=yt.scrollLeft(),w=function(){return($()?S:x).scrollLeft()||0},g=w();return function(t){z=$();var e=m[0].offsetWidth<=0&&m[0].offsetHeight<=0;if(!e&&M)return M=!1,setTimeout(function(){m.triggerHandler("reflow")},1),null;if(e&&(M=!0,!I))return null;if("windowScroll"==t)v=yt.scrollTop(),b=yt.scrollLeft();else if("containerScroll"==t)if(S.length){if(!z)return;g=S.scrollLeft()}else l=x.scrollTop(),g=x.scrollLeft();else"init"!=t&&(v=yt.scrollTop(),b=yt.scrollLeft(),l=x.scrollTop(),g=w());if(!gt||!(v<0||b<0)){if(q)Y("windowScrollDone"==t);else if("windowScrollDone"==t)return null;var o,n;u=m.offset(),L&&H&&(u.top+=d);var r=m.outerHeight();if(j&&I){if(l<=s){var a=s-l+h;o=0<a?a:0,X(!1)}else r-c<l-s?o=r-c-l-s:(o=W?h:l,X(!0));n=p}else!j&&I?(i+r+f<v?o=r-c+f+T:u.top>=v+y?(o=0,P(),X(!1)):(o=y+v-u.top+s+(H?d:0),G(),X(!0)),n=g):j&&!I?(l<s||r<l-s?(o=u.top-v,P(),X(!1)):(o=u.top+l-v-s,G(),X(!0)),n=u.left+g-b):j||I||(i+r+f<v?o=r+y-v+i+f:u.top>v+y?(o=u.top-v,G(),X(!1)):(o=y,X(!0)),n=u.left+g-b);return{top:Math.round(o),left:Math.round(n)}}}}function Z(){var i=null,l=null,s=null;return function(t,e,o){if(null!=t&&(i!=t.top||l!=t.left)){if(8===wt)R.css({top:t.top,left:t.left});else{var n="translateX("+t.left+"px) translateY("+t.top+"px)",r={"-webkit-transform":n,"-moz-transform":n,"-ms-transform":n,"-o-transform":n,transform:n,top:0};r[/rtl/i.test(document.documentElement.dir||"")?"right":"left"]=0,R.css(r)}i=t.top,l=t.left}e&&function(){var t=zt(m,k,!0),e=z?S:x,o=e.length?jt(e[0]):t,n="hidden"!=e.css("overflow-y")?o-C.vertical:o;if(R.width(n),j){var r=100*t/n;c.css("width",r+"%")}else c.css("width",t+"px")}(),o&&Q();var a=(z?S:x).scrollLeft();I&&s==a||(R.scrollLeft(a),s=a)}}function _(){if(x.length)if(pt.support&&pt.support.perfectScrollbar&&x.data().perfectScrollbar)C={horizontal:0,vertical:0};else{if("scroll"==x.css("overflow-x"))C.horizontal=St;else{var t=x.width(),e=zt(m,k),o=n<r?St:0;C.horizontal=t-o<e?St:0}if("scroll"==x.css("overflow-y"))C.vertical=St;else{var n=x.height(),r=m.height(),a=t<e?St:0;C.vertical=n-a<r?St:0}}}_();var tt=function(){B()()};tt();var et=J(),ot=Z();ot(et("init"),!0);var nt=vt.debounce(function(){ot(et("windowScrollDone"),!1)},1),rt=function(){ot(et("windowScroll"),!1),q&&nt()},at=function(){ot(et("containerScroll"),!1)},it=vt.debounce(function(){m.is(":hidden")||(_(),U(),tt(),et=J(),ot(et("reflow"),!0,!0))},1),lt=function(){P()},st=function(){G()},dt=function(t){t.matches?lt():st()},ft=null;if(window.matchMedia&&window.matchMedia("print").addListener&&!Tt?(ft=window.matchMedia("print")).addListener(dt):(yt.on("fth-beforeprint",lt),yt.on("fth-afterprint",st)),j?I?x.on(A("scroll"),at):(x.on(A("scroll"),at),yt.on(A("scroll"),rt)):(S.on(A("scroll"),at),yt.on(A("scroll"),rt)),yt.on(A("load"),it),function(t,e){if(8==wt){var o=yt.width(),n=vt.debounce(function(){var t=yt.width();o!=t&&(o=t,e())},1);yt.on(t,n)}else yt.on(t,vt.debounce(e,1))}(A("resize"),function(){m.is(":hidden")||(U(),_(),tt(),et=J(),(ot=Z())(et("resize"),!0,!0))}),m.on("reflow",it),pt.support&&pt.support.datatables&&function(t){if(t.dataTableSettings)for(var e=0;e<t.dataTableSettings.length;e++){var o=t.dataTableSettings[e].nTable;if(t[0]==o)return!0}return!1}(m)&&m.on("filter",it).on("sort",it).on("page",it),pt.support&&pt.support.bootstrap&&yt.on(A("shown.bs.tab"),it),pt.support&&pt.support.jqueryUI&&yt.on(A("tabsactivate"),it),bt){var ct=null;vt.isFunction(pt.autoReflow)&&(ct=pt.autoReflow(m,x)),ct||(ct=x.length?x[0]:m[0]),(ut=new MutationObserver(function(t){for(var e=function(t){return t&&t[0]&&("THEAD"==t[0].nodeName||"TD"==t[0].nodeName||"TH"==t[0].nodeName)},o=0;o<t.length;o++)if(!e(t[o].addedNodes)&&!e(t[o].removedNodes)){it();break}})).observe(ct,{childList:!0,subtree:!0})}m.data("floatThead-attached",{destroy:function(){var t=".fth-"+e;return P(),m.css(F),p.remove(),mt&&a.remove(),l.parent().length&&l.replaceWith(d),X(!1),bt&&(ut.disconnect(),ut=null),m.off("reflow reflowed"),x.off(t),S.off(t),W&&(x.length?x.unwrap():m.unwrap()),j?x.data("floatThead-containerWrap",!1):m.data("floatThead-containerWrap",!1),m.css("minWidth",N),R.remove(),m.data("floatThead-attached",!1),yt.off(t),yt.off("fth-beforeprint fth-afterprint"),ft&&ft.removeListener(dt),lt=st=function(){},function(){return m.floatThead(pt)}},reflow:function(){it()},setHeaderHeight:function(){Q()},getFloatContainer:function(){return R},getRowGroups:function(){return n?R.find(">table>thead").add(m.children("tbody,tfoot")):m.children("thead,tbody,tfoot")}})}),this}}(function(){var t=window.jQuery;return"undefined"!=typeof module&&module.exports&&!t&&(t=require("jquery")),t}()); | ||
/** @preserve jQuery.floatThead 2.1.4 - https://mkoryak.github.io/floatThead/ - Copyright (c) 2012 - 2019 Misha Koryak **/ | ||
!function(ht){ht.floatThead=ht.floatThead||{},ht.floatThead.defaults={headerCellSelector:"tr:visible:first>*:visible",zIndex:1001,position:"auto",top:0,bottom:0,scrollContainer:function(t){return ht([])},responsiveContainer:function(t){return ht([])},getSizingRow:function(t,e,o){return t.find("tbody tr:visible:first>*:visible")},ariaLabel:function(t,e,o){return e.text()},floatTableClass:"floatThead-table",floatWrapperClass:"floatThead-wrapper",floatContainerClass:"floatThead-container",copyTableClass:!0,autoReflow:!1,debug:!1,support:{bootstrap:!0,datatables:!0,jqueryUI:!0,perfectScrollbar:!0},floatContainerCss:{"overflow-x":"hidden"}};var vt=function(){var n={},o=Object.prototype.hasOwnProperty;n.has=function(t,e){return o.call(t,e)},n.keys=Object.keys||function(t){if(t!==Object(t))throw new TypeError("Invalid object");var e=[];for(var o in t)n.has(t,o)&&e.push(o);return e};var r=0;return n.uniqueId=function(t){var e=++r+"";return t?t+e:e},ht.each(["Arguments","Function","String","Number","Date","RegExp"],function(){var e=this;n["is"+e]=function(t){return Object.prototype.toString.call(t)==="[object "+e+"]"}}),n.debounce=function(o,n,r){var a,i,l,s,d;return function(){l=this,i=arguments,s=new Date;var e=function(){var t=new Date-s;t<n?a=setTimeout(e,n-t):(a=null,r||(d=o.apply(l,i)))},t=r&&!a;return a||(a=setTimeout(e,n)),t&&(d=o.apply(l,i)),d}},n}(),bt="undefined"!=typeof MutationObserver,wt=function(){for(var t=3,e=document.createElement("b"),o=e.all||[];t=1+t,e.innerHTML="\x3c!--[if gt IE "+t+"]><i><![endif]--\x3e",o[0];);return 4<t?t:document.documentMode}(),t=/Gecko\//.test(navigator.userAgent),gt=/WebKit\//.test(navigator.userAgent),mt=/rtl/i.test(document.documentElement.dir||"");wt||t||gt||(wt=11);var l=function(){if(gt){var t=ht("<div>").css("width",0).append(ht("<table>").css("max-width","100%").append(ht("<tr>").append(ht("<th>").append(ht("<div>").css("min-width",100).text("X")))));ht("body").append(t);var e=0===t.find("table").width();return t.remove(),e}return!1},yt=!t&&!wt,Tt=ht(window),Ct=t&&window.matchMedia;if(!window.matchMedia||Ct){var e=window.onbeforeprint,o=window.onafterprint;window.onbeforeprint=function(){e&&e(),Tt.triggerHandler("fth-beforeprint")},window.onafterprint=function(){o&&o(),Tt.triggerHandler("fth-afterprint")}}function xt(t){var e=t[0].parentElement;do{if("visible"!==window.getComputedStyle(e).getPropertyValue("overflow"))break}while(e=e.parentElement);return e===document.body?ht([]):ht(e)}function Lt(t){window&&window.console&&window.console.error&&window.console.error("jQuery.floatThead: "+t)}function St(t){var e=t.getBoundingClientRect();return e.width||e.right-e.left}function jt(){var t=document.createElement("scrolltester");t.style.cssText="width:100px;height:100px;overflow:scroll!important;position:absolute;top:-9999px;display:block",document.body.appendChild(t);var e=t.offsetWidth-t.clientWidth;return document.body.removeChild(t),e}function zt(t,e,o){var n=o?"outerWidth":"width";if(l&&t.css("max-width")){var r=0;o&&(r+=parseInt(t.css("borderLeft"),10),r+=parseInt(t.css("borderRight"),10));for(var a=0;a<e.length;a++)r+=St(e.get(a));return r}return t[n]()}ht.fn.floatThead=function(t){if(t=t||{},wt<8)return this;var ut=null;if(vt.isFunction(l)&&(l=l()),vt.isString(t)){var r=t,a=Array.prototype.slice.call(arguments,1),i=this;return this.filter("table").each(function(){var t=ht(this),e=t.data("floatThead-lazy");e&&t.floatThead(e);var o=t.data("floatThead-attached");if(o&&vt.isFunction(o[r])){var n=o[r].apply(this,a);void 0!==n&&(i=n)}}),i}var pt=ht.extend({},ht.floatThead.defaults||{},t);if(ht.each(t,function(t,e){t in ht.floatThead.defaults||!pt.debug||Lt("Used ["+t+"] key to init plugin, but that param is not an option for the plugin. Valid options are: "+vt.keys(ht.floatThead.defaults).join(", "))}),pt.debug){var e=ht.fn.jquery.split(".");1===parseInt(e[0],10)&&parseInt(e[1],10)<=7&&Lt("jQuery version "+ht.fn.jquery+" detected! This plugin supports 1.8 or better, or 1.7.x with jQuery UI 1.8.24 -> http://jqueryui.com/resources/download/jquery-ui-1.8.24.zip")}return this.filter(":not(."+pt.floatTableClass+")").each(function(){var e=vt.uniqueId(),m=ht(this);if(m.data("floatThead-attached"))return!0;if(!m.is("table"))throw new Error('jQuery.floatThead must be run on a table element. ex: $("table").floatThead();');bt=pt.autoReflow&&bt;var d=m.children("thead:first"),o=m.children("tbody:first");if(0===d.length||0===o.length)return pt.debug&&(0===d.length?Lt("The thead element is missing."):Lt("The tbody element is missing.")),m.data("floatThead-lazy",pt),void m.unbind("reflow").one("reflow",function(){m.floatThead(pt)});m.data("floatThead-lazy")&&m.unbind("reflow"),m.data("floatThead-lazy",!1);var y,T,n=!0,C={vertical:0,horizontal:0};vt.isFunction(jt)&&(jt=jt());var i=0;!0===pt.scrollContainer&&(pt.scrollContainer=xt);var x=pt.scrollContainer(m)||ht([]),L=0<x.length,S=L?ht([]):pt.responsiveContainer(m)||ht([]),j=$(),z=null;"auto"===pt.position?z=null:"fixed"===pt.position?z=!1:"absolute"===pt.position?z=!0:pt.debug&&Lt('Invalid value given to "position" option, valid is "fixed", "absolute" and "auto". You passed: ',pt.position),null==z&&(z=L);var r=m.find("caption"),I=1===r.length;if(I)var H="top"===(r.css("caption-side")||r.attr("align")||"top");var a=ht("<fthfoot>").css({display:"table-footer-group","border-spacing":0,height:0,"border-collapse":"collapse",visibility:"hidden"}),W=!1,l=ht([]),q=wt<=9&&!L&&z,f=ht("<table/>"),c=ht("<colgroup/>"),u=m.children("colgroup:first"),p=!0;0===u.length&&(u=ht("<colgroup/>"),p=!1);var h=ht("<fthtr>").css({display:"table-row","border-spacing":0,height:0,"border-collapse":"collapse"}),R=ht("<div>").css(pt.floatContainerCss).attr("aria-hidden","true"),E=!1,s=ht("<thead/>"),v=ht('<tr class="size-row"/>'),b=ht([]),w=ht([]),g=ht([]),M=ht([]);s.append(v),m.prepend(u),yt&&(a.append(h),m.append(a)),f.append(c),R.append(f),pt.copyTableClass&&f.attr("class",m.attr("class")),f.attr({cellpadding:m.attr("cellpadding"),cellspacing:m.attr("cellspacing"),border:m.attr("border")});var t=m.css("display");if(f.css({borderCollapse:m.css("borderCollapse"),border:m.css("border"),display:t}),L||f.css("width","auto"),"none"===t&&(E=!0),f.addClass(pt.floatTableClass).css({margin:0,"border-bottom-width":0}),z){var k=function(t,e){var o=t.css("position"),n=t;if(!("relative"===o||"absolute"===o)||e){var r={paddingLeft:t.css("paddingLeft"),paddingRight:t.css("paddingRight")};R.css(r),n=t.data("floatThead-containerWrap")||t.wrap(ht("<div>").addClass(pt.floatWrapperClass).css({position:"relative",clear:"both"})).parent(),t.data("floatThead-containerWrap",n),W=!0}return n};L?(l=k(x,!0)).prepend(R):(l=k(m),m.before(R))}else m.before(R);R.css({position:z?"absolute":"fixed",marginTop:0,top:z?0:"auto",zIndex:pt.zIndex,willChange:"transform"}),R.addClass(pt.floatContainerClass),U();var D={"table-layout":"fixed"},F={"table-layout":m.css("tableLayout")||"auto"},O=m[0].style.width||"",N=m.css("minWidth")||"";function A(t){return t+".fth-"+e+".floatTHead"}function Q(){var t=0;if(d.children("tr:visible").each(function(){t+=ht(this).outerHeight(!0)}),"collapse"===m.css("border-collapse")){var e=parseInt(m.css("border-top-width"),10);parseInt(m.find("thead tr:first").find(">*:first").css("border-top-width"),10)<e&&(t-=e/2)}v.outerHeight(t),b.outerHeight(t)}function U(){y=(vt.isFunction(pt.top)?pt.top(m):pt.top)||0,T=(vt.isFunction(pt.bottom)?pt.bottom(m):pt.bottom)||0}function G(){if(!n){if(n=!0,z){var t=zt(m,M,!0);l.width()<t&&m.css("minWidth",t)}m.css(D),f.css(D),f.append(d),o.before(s),Q()}}function P(){n&&(n=!1,z&&m.width(O),s.detach(),m.prepend(d),m.css(F),f.css(F),m.css("minWidth",N),m.css("minWidth",zt(m,M)))}var V=!1;function X(t){V!==t&&(V=t,m.triggerHandler("floatThead",[t,R]))}function Y(t){z!==t&&(z=t,R.css({position:z?"absolute":"fixed"}))}function B(){var l,s=function(){var t,e=d.find(pt.headerCellSelector);if(p?t=u.find("col").length:(t=0,e.each(function(){t+=parseInt(ht(this).attr("colspan")||1,10)})),t!==i){i=t;var o=[],n=[];v.empty();for(var r=0;r<t;r++){var a=document.createElement("th");a.setAttribute("aria-label",pt.ariaLabel(m,e.eq(r),r)),a.className="floatThead-col",v[0].appendChild(a),o.push("<col/>"),n.push(ht("<fthtd>").css({display:"table-cell",height:0,width:"auto"}))}o=o.join(""),yt&&(h.empty(),h.append(n),M=h.find("fthtd")),b=v.find("th"),p||u.html(o),w=u.find("col"),c.html(o),g=c.find("col")}return t}();return function(){var t=R.scrollLeft();w=u.find("col");var e,o,n,r,a=(e=m,o=w,n=M,r=wt,yt?n:r?pt.getSizingRow(e,o,n):o);if(a.length===s&&0<s){if(!p)for(l=0;l<s;l++)w.eq(l).css("width","");P();var i=[];for(l=0;l<s;l++)i[l]=St(a.get(l));for(l=0;l<s;l++)g.eq(l).width(i[l]),w.eq(l).width(i[l]);G()}else f.append(d),m.css(F),f.css(F),Q();R.scrollLeft(t),m.triggerHandler("reflowed",[R])}}function K(t){var e=x.css("border-"+t+"-width"),o=0;return e&&~e.indexOf("px")&&(o=parseInt(e,10)),o}function $(){return"auto"===S.css("overflow-x")}function J(){var i,l=x.scrollTop(),s=0,d=I?r.outerHeight(!0):0,f=H?d:-d,c=R.height(),u=m.offset(),p=0,h=0;if(L){var t=x.offset();s=u.top-t.top+l,I&&H&&(s+=d),p=K("left"),h=K("top"),s-=h}else i=u.top-y-c+T+C.horizontal;var v=Tt.scrollTop(),b=Tt.scrollLeft(),w=function(){return($()?S:x).scrollLeft()||0},g=w();return function(t){j=$();var e=m[0].offsetWidth<=0&&m[0].offsetHeight<=0;if(!e&&E)return E=!1,setTimeout(function(){m.triggerHandler("reflow")},1),null;if(e&&(E=!0,!z))return null;if("windowScroll"===t)v=Tt.scrollTop(),b=Tt.scrollLeft();else if("containerScroll"===t)if(S.length){if(!j)return;g=S.scrollLeft()}else l=x.scrollTop(),g=x.scrollLeft();else"init"!==t&&(v=Tt.scrollTop(),b=Tt.scrollLeft(),l=x.scrollTop(),g=w());if(!gt||!(v<0||mt&&0<b||!mt&&b<0)){if(q)Y("windowScrollDone"===t);else if("windowScrollDone"===t)return null;var o,n;u=m.offset(),I&&H&&(u.top+=d);var r=m.outerHeight();if(L&&z){if(l<=s){var a=s-l+h;o=0<a?a:0,X(!1)}else r-c<l-s?o=r-c-l-s:(o=W?h:l,X(!0));n=p}else!L&&z?(i+r+f<v?o=r-c+f+T:u.top>=v+y?(o=0,P(),X(!1)):(o=y+v-u.top+s+(H?d:0),G(),X(!0)),n=g):L&&!z?(l<s||r<l-s?(o=u.top-v,P(),X(!1)):(o=u.top+l-v-s,G(),X(!0)),n=u.left+g-b):L||z||(i+r+f<v?o=r+y-v+i+f:u.top>v+y?(o=u.top-v,G(),X(!1)):(o=y,X(!0)),n=u.left+g-b);return{top:Math.round(o),left:Math.round(n)}}}}function Z(){var i=null,l=null,s=null;return function(t,e,o){if(null!=t&&(i!==t.top||l!==t.left)){if(8===wt)R.css({top:t.top,left:t.left});else{var n="translateX("+t.left+"px) translateY("+t.top+"px)",r={"-webkit-transform":n,"-moz-transform":n,"-ms-transform":n,"-o-transform":n,transform:n,top:0,left:0};R.css(r)}i=t.top,l=t.left}e&&function(){var t=zt(m,M,!0),e=j?S:x,o=e.length?St(e[0]):t,n="hidden"!==e.css("overflow-y")?o-C.vertical:o;if(R.width(n),L){var r=100*t/n;f.css("width",r+"%")}else f.css("width",t+"px")}(),o&&Q();var a=(j?S:x).scrollLeft();z&&s===a||(R.scrollLeft(a),s=a)}}function _(){if(x.length)if(pt.support&&pt.support.perfectScrollbar&&x.data().perfectScrollbar)C={horizontal:0,vertical:0};else{if("scroll"===x.css("overflow-x"))C.horizontal=jt;else{var t=x.width(),e=zt(m,M),o=n<r?jt:0;C.horizontal=t-o<e?jt:0}if("scroll"===x.css("overflow-y"))C.vertical=jt;else{var n=x.height(),r=m.height(),a=t<e?jt:0;C.vertical=n-a<r?jt:0}}}_();var tt=function(){B()()};tt();var et=J(),ot=Z();ot(et("init"),!0);var nt=vt.debounce(function(){ot(et("windowScrollDone"),!1)},1),rt=function(){ot(et("windowScroll"),!1),q&&nt()},at=function(){ot(et("containerScroll"),!1)},it=vt.debounce(function(){m.is(":hidden")||(_(),U(),tt(),et=J(),ot(et("reflow"),!0,!0))},1),lt=function(){P()},st=function(){G()},dt=function(t){t.matches?lt():st()},ft=null;if(window.matchMedia&&window.matchMedia("print").addListener&&!Ct?(ft=window.matchMedia("print")).addListener(dt):(Tt.on("fth-beforeprint",lt),Tt.on("fth-afterprint",st)),L?z?x.on(A("scroll"),at):(x.on(A("scroll"),at),Tt.on(A("scroll"),rt)):(S.on(A("scroll"),at),Tt.on(A("scroll"),rt)),Tt.on(A("load"),it),function(t,e){if(8===wt){var o=Tt.width(),n=vt.debounce(function(){var t=Tt.width();o!==t&&(o=t,e())},1);Tt.on(t,n)}else Tt.on(t,vt.debounce(e,1))}(A("resize"),function(){m.is(":hidden")||(U(),_(),tt(),et=J(),(ot=Z())(et("resize"),!0,!0))}),m.on("reflow",it),pt.support&&pt.support.datatables&&function(t){if(t.dataTableSettings)for(var e=0;e<t.dataTableSettings.length;e++){var o=t.dataTableSettings[e].nTable;if(t[0]===o)return!0}return!1}(m)&&m.on("filter",it).on("sort",it).on("page",it),pt.support&&pt.support.bootstrap&&Tt.on(A("shown.bs.tab"),it),pt.support&&pt.support.jqueryUI&&Tt.on(A("tabsactivate"),it),bt){var ct=null;vt.isFunction(pt.autoReflow)&&(ct=pt.autoReflow(m,x)),ct||(ct=x.length?x[0]:m[0]),(ut=new MutationObserver(function(t){for(var e=function(t){return t&&t[0]&&("THEAD"===t[0].nodeName||"TD"===t[0].nodeName||"TH"===t[0].nodeName)},o=0;o<t.length;o++)if(!e(t[o].addedNodes)&&!e(t[o].removedNodes)){it();break}})).observe(ct,{childList:!0,subtree:!0})}m.data("floatThead-attached",{destroy:function(){var t=".fth-"+e;return P(),m.css(F),u.remove(),yt&&a.remove(),s.parent().length&&s.replaceWith(d),X(!1),bt&&(ut.disconnect(),ut=null),m.off("reflow reflowed"),x.off(t),S.off(t),W&&(x.length?x.unwrap():m.unwrap()),L?x.data("floatThead-containerWrap",!1):m.data("floatThead-containerWrap",!1),m.css("minWidth",N),R.remove(),m.data("floatThead-attached",!1),Tt.off(t),Tt.off("fth-beforeprint fth-afterprint"),ft&&ft.removeListener(dt),lt=st=function(){},function(){return m.floatThead(pt)}},reflow:function(){it()},setHeaderHeight:function(){Q()},getFloatContainer:function(){return R},getRowGroups:function(){return n?R.find(">table>thead").add(m.children("tbody,tfoot")):m.children("thead,tbody,tfoot")}})}),this}}(function(){var t=window.jQuery;return"undefined"!=typeof module&&module.exports&&!t&&(t=require("jquery")),t}()); |
{ | ||
"name": "floatthead", | ||
"version": "2.1.3", | ||
"version": "2.1.4", | ||
"description": "fixed table header plugin that works", | ||
@@ -5,0 +5,0 @@ "main": "dist/jquery.floatThead.min.js", |
@@ -34,4 +34,4 @@ <p align="left"> | ||
#### Via CDN | ||
[http://cdnjs.com/libraries/floatthead/](http://cdnjs.com/libraries/floatthead/) | ||
[http://www.jsdelivr.com/#!jquery.floatthead](http://www.jsdelivr.com/#!jquery.floatthead) | ||
[https://cdnjs.com/libraries/floatthead/](https://cdnjs.com/libraries/floatthead/) | ||
[https://www.jsdelivr.com/#!jquery.floatthead](https://www.jsdelivr.com/#!jquery.floatthead) | ||
[https://unpkg.com/floatthead](https://unpkg.com/floatthead) | ||
@@ -59,2 +59,3 @@ | ||
--------- | ||
- In prod @ big corporations and opensource projects. Maintained. See open issues. | ||
- Works on tables within a scrollable container or whole window scrolling | ||
@@ -106,4 +107,7 @@ - Works with responsive table wrappers | ||
### [Around 96K hits on guthub cod search](https://github.com/search?q=floatThead&ref=reposearch&type=Code&utf8=%E2%9C%93) | ||
### [Around 128K hits on guthub code search](https://github.com/search?q=floatThead&ref=reposearch&type=Code&utf8=%E2%9C%93) | ||
### [WheresTheGig.com](https://WheresTheGig.com) | ||
- A free service for the musical community | ||
### [Google](https://www.youtube.com/watch?v=dQw4w9WgXcQ) | ||
@@ -110,0 +114,0 @@ - Internally, I happen to know... |
@@ -1,2 +0,2 @@ | ||
/** @preserve jQuery.floatThead 2.1.2 - https://mkoryak.github.io/floatThead/ - Copyright (c) 2012 - 2018 Misha Koryak **/ | ||
/** @preserve jQuery.floatThead 2.1.4 - https://mkoryak.github.io/floatThead/ - Copyright (c) 2012 - 2019 Misha Koryak **/ | ||
// @license MIT | ||
@@ -37,2 +37,8 @@ | ||
}, | ||
ariaLabel: function($table, $headerCell, columnIndex) { // This function will run for every header cell that exists in the table when we add aria-labels. | ||
// Override to customize the aria-label. NOTE: These labels will be added to the 'sizer cells' which get added to the real table and are not visible by the user (only screen readers), | ||
// The number of sizer columns might not match the header columns in your real table - I insert one sizer header cell per column. This means that if your table uses colspans or multiple header rows, | ||
// this will not be reflected by sizer cells. This is why I am giving you the `columnIndex`. | ||
return $headerCell.text(); | ||
}, | ||
floatTableClass: 'floatThead-table', | ||
@@ -73,3 +79,3 @@ floatWrapperClass: 'floatThead-wrapper', | ||
that['is' + name] = function(obj) { | ||
return Object.prototype.toString.call(obj) == '[object ' + name + ']'; | ||
return Object.prototype.toString.call(obj) === '[object ' + name + ']'; | ||
}; | ||
@@ -110,2 +116,3 @@ }); | ||
var isWebkit = /WebKit\//.test(navigator.userAgent); | ||
var isRTL = /rtl/i.test(document.documentElement.dir || ''); | ||
@@ -120,12 +127,12 @@ if(!(ieVersion || isFF || isWebkit)){ | ||
var $test = $('<div>').css('width', 0).append( | ||
$('<table>').css('max-width', '100%').append( | ||
$('<tr>').append( | ||
$('<th>').append( | ||
$('<div>').css('min-width', 100).text('X') | ||
) | ||
$('<table>').css('max-width', '100%').append( | ||
$('<tr>').append( | ||
$('<th>').append( | ||
$('<div>').css('min-width', 100).text('X') | ||
) | ||
) | ||
) | ||
) | ||
); | ||
$("body").append($test); | ||
var ret = ($test.find("table").width() == 0); | ||
var ret = ($test.find("table").width() === 0); | ||
$test.remove(); | ||
@@ -161,7 +168,7 @@ return ret; | ||
function windowResize(eventName, cb){ | ||
if(ieVersion == 8){ //ie8 is crap: https://github.com/mkoryak/floatThead/issues/65 | ||
if(ieVersion === 8){ //ie8 is crap: https://github.com/mkoryak/floatThead/issues/65 | ||
var winWidth = $window.width(); | ||
var debouncedCb = util.debounce(function(){ | ||
var winWidthNew = $window.width(); | ||
if(winWidth != winWidthNew){ | ||
if(winWidth !== winWidthNew){ | ||
winWidth = winWidthNew; | ||
@@ -186,7 +193,7 @@ cb(); | ||
if (pos != 'visible') break; | ||
if (pos !== 'visible') break; | ||
} while (parent = parent.parentElement); | ||
if(parent == document.body){ | ||
if(parent === document.body){ | ||
return $([]); | ||
@@ -230,3 +237,3 @@ } | ||
var table = $table.dataTableSettings[i].nTable; | ||
if($table[0] == table){ | ||
if($table[0] === table){ | ||
return true; | ||
@@ -298,3 +305,3 @@ } | ||
var v = $.fn.jquery.split("."); | ||
if(parseInt(v[0], 10) == 1 && parseInt(v[1], 10) <= 7){ | ||
if(parseInt(v[0], 10) === 1 && parseInt(v[1], 10) <= 7){ | ||
debug("jQuery version "+$.fn.jquery+" detected! This plugin supports 1.8 or better, or 1.7.x with jQuery UI 1.8.24 -> http://jqueryui.com/resources/download/jquery-ui-1.8.24.zip") | ||
@@ -316,5 +323,5 @@ } | ||
var $tbody = $table.children('tbody:first'); | ||
if($header.length == 0 || $tbody.length == 0){ | ||
if($header.length === 0 || $tbody.length === 0){ | ||
if(opts.debug) { | ||
if($header.length == 0){ | ||
if($header.length === 0){ | ||
debug('The thead element is missing.'); | ||
@@ -372,3 +379,3 @@ } else{ | ||
var $caption = $table.find("caption"); | ||
var haveCaption = $caption.length == 1; | ||
var haveCaption = $caption.length === 1; | ||
if(haveCaption){ | ||
@@ -393,3 +400,3 @@ var captionAlignTop = ($caption.css("caption-side") || $caption.attr("align") || "top") === "top"; | ||
var existingColGroup = true; | ||
if($tableColGroup.length == 0){ | ||
if($tableColGroup.length === 0){ | ||
$tableColGroup = $("<colgroup/>"); | ||
@@ -407,3 +414,3 @@ existingColGroup = false; | ||
var $newHeader = $("<thead/>"); | ||
var $sizerRow = $('<tr class="size-row" aria-hidden="true"/>'); | ||
var $sizerRow = $('<tr class="size-row"/>'); | ||
var $sizerCells = $([]); | ||
@@ -427,12 +434,12 @@ var $tableCells = $([]); //used for sizing - either $sizerCells or $tableColGroup cols. $tableColGroup cols are only created in chrome for borderCollapse:collapse because of a chrome bug. | ||
$floatTable.attr({ //copy over some deprecated table attributes that people still like to use. Good thing people don't use colgroups... | ||
'cellpadding': $table.attr('cellpadding'), | ||
'cellspacing': $table.attr('cellspacing'), | ||
'border': $table.attr('border') | ||
}); | ||
'cellpadding': $table.attr('cellpadding'), | ||
'cellspacing': $table.attr('cellspacing'), | ||
'border': $table.attr('border') | ||
}); | ||
var tableDisplayCss = $table.css('display'); | ||
$floatTable.css({ | ||
'borderCollapse': $table.css('borderCollapse'), | ||
'border': $table.css('border'), | ||
'display': tableDisplayCss | ||
}); | ||
'borderCollapse': $table.css('borderCollapse'), | ||
'border': $table.css('border'), | ||
'display': tableDisplayCss | ||
}); | ||
if(!locked){ | ||
@@ -450,3 +457,3 @@ $floatTable.css('width', 'auto'); | ||
var positionCss = $container.css('position'); | ||
var relativeToScrollContainer = (positionCss == "relative" || positionCss == "absolute"); | ||
var relativeToScrollContainer = (positionCss === "relative" || positionCss === "absolute"); | ||
var $containerWrap = $container; | ||
@@ -457,6 +464,6 @@ if(!relativeToScrollContainer || alwaysWrap){ | ||
$containerWrap = $container.data('floatThead-containerWrap') || $container.wrap( | ||
$('<div>').addClass(opts.floatWrapperClass).css({ | ||
'position': 'relative', | ||
'clear': 'both' | ||
}) | ||
$('<div>').addClass(opts.floatWrapperClass).css({ | ||
'position': 'relative', | ||
'clear': 'both' | ||
}) | ||
).parent(); | ||
@@ -504,3 +511,3 @@ $container.data('floatThead-containerWrap', $containerWrap); //multiple tables inside one scrolling container - #242 | ||
}); | ||
if($table.css('border-collapse') == 'collapse') { | ||
if($table.css('border-collapse') === 'collapse') { | ||
var tableBorderTopHeight = parseInt($table.css('border-top-width'), 10); | ||
@@ -521,3 +528,3 @@ var cellBorderTopHeight = parseInt($table.find("thead tr:first").find(">*:first").css('border-top-width'), 10); | ||
var width = $container.length ? getOffsetWidth($container[0]) : tw; | ||
var floatContainerWidth = $container.css("overflow-y") != 'hidden' ? width - scrollbarOffset.vertical : width; | ||
var floatContainerWidth = $container.css("overflow-y") !== 'hidden' ? width - scrollbarOffset.vertical : width; | ||
$floatContainer.width(floatContainerWidth); | ||
@@ -553,13 +560,16 @@ if(locked){ | ||
lastColumnCount = count; | ||
var cells = [], cols = [], psuedo = [], content; | ||
var cells = [], cols = [], psuedo = []; | ||
$sizerRow.empty(); | ||
for(var x = 0; x < count; x++){ | ||
content = $headerColumns.eq(x).text(); | ||
cells.push('<th class="floatThead-col" aria-label="'+content+'"/>'); | ||
var cell = document.createElement('th'); | ||
cell.setAttribute('aria-label', opts.ariaLabel($table, $headerColumns.eq(x), x)); | ||
cell.className = 'floatThead-col'; | ||
$sizerRow[0].appendChild(cell); | ||
cols.push('<col/>'); | ||
psuedo.push( | ||
$('<fthtd>').css({ | ||
'display': 'table-cell', | ||
'height': 0, | ||
'width': 'auto' | ||
}) | ||
$('<fthtd>').css({ | ||
'display': 'table-cell', | ||
'height': 0, | ||
'width': 'auto' | ||
}) | ||
); | ||
@@ -569,4 +579,3 @@ } | ||
cols = cols.join(''); | ||
cells = cells.join(''); | ||
if(createElements){ | ||
@@ -577,4 +586,3 @@ $fthRow.empty(); | ||
} | ||
$sizerRow.html(cells); | ||
$sizerCells = $sizerRow.find("th"); | ||
@@ -626,3 +634,3 @@ if(!existingColGroup){ | ||
function triggerFloatEvent(isFloating){ | ||
if(isHeaderFloatingLogical != isFloating){ | ||
if(isHeaderFloatingLogical !== isFloating){ | ||
isHeaderFloatingLogical = isFloating; | ||
@@ -633,3 +641,3 @@ $table.triggerHandler("floatThead", [isFloating, $floatContainer]) | ||
function changePositioning(isAbsolute){ | ||
if(useAbsolutePositioning != isAbsolute){ | ||
if(useAbsolutePositioning !== isAbsolute){ | ||
useAbsolutePositioning = isAbsolute; | ||
@@ -665,3 +673,3 @@ $floatContainer.css({ | ||
if($rowCells.length == numCols && numCols > 0){ | ||
if($rowCells.length === numCols && numCols > 0){ | ||
if(!existingColGroup){ | ||
@@ -704,3 +712,3 @@ for(i=0; i < numCols; i++){ | ||
function isResponsiveContainerActive(){ | ||
return $responsiveContainer.css("overflow-x") == 'auto'; | ||
return $responsiveContainer.css("overflow-x") === 'auto'; | ||
} | ||
@@ -762,6 +770,6 @@ /** | ||
if(eventType == 'windowScroll'){ | ||
if(eventType === 'windowScroll'){ | ||
windowTop = $window.scrollTop(); | ||
windowLeft = $window.scrollLeft(); | ||
} else if(eventType == 'containerScroll'){ | ||
} else if(eventType === 'containerScroll'){ | ||
if($responsiveContainer.length){ | ||
@@ -776,3 +784,3 @@ if(!responsive){ | ||
} | ||
} else if(eventType != 'init') { | ||
} else if(eventType !== 'init') { | ||
windowTop = $window.scrollTop(); | ||
@@ -783,3 +791,4 @@ windowLeft = $window.scrollLeft(); | ||
} | ||
if(isWebkit && (windowTop < 0 || windowLeft < 0)){ //chrome overscroll effect at the top of the page - breaks fixed positioned floated headers | ||
if(isWebkit && (windowTop < 0 || (isRTL && windowLeft > 0 ) || ( !isRTL && windowLeft < 0 )) ){ | ||
//chrome overscroll effect at the top of the page - breaks fixed positioned floated headers | ||
return; | ||
@@ -789,3 +798,3 @@ } | ||
if(absoluteToFixedOnScroll){ | ||
if(eventType == 'windowScrollDone'){ | ||
if(eventType === 'windowScrollDone'){ | ||
changePositioning(true); //change to absolute | ||
@@ -795,3 +804,3 @@ } else { | ||
} | ||
} else if(eventType == 'windowScrollDone'){ | ||
} else if(eventType === 'windowScrollDone'){ | ||
return null; //event is fired when they stop scrolling. ignore it if not 'absoluteToFixedOnScroll' | ||
@@ -874,3 +883,3 @@ } | ||
return function(pos, setWidth, setHeight){ | ||
if(pos != null && (oldTop != pos.top || oldLeft != pos.left)){ | ||
if(pos != null && (oldTop !== pos.top || oldLeft !== pos.left)){ | ||
if(ieVersion === 8){ | ||
@@ -890,4 +899,4 @@ $floatContainer.css({ | ||
'top': 0, | ||
'left': 0, | ||
}; | ||
cssObj[/rtl/i.test(document.documentElement.dir || '') ? 'right': 'left'] = 0; | ||
$floatContainer.css(cssObj); | ||
@@ -905,3 +914,3 @@ } | ||
var scrollLeft = (responsive ? $responsiveContainer : $scrollContainer).scrollLeft(); | ||
if(!useAbsolutePositioning || oldScrollLeft != scrollLeft){ | ||
if(!useAbsolutePositioning || oldScrollLeft !== scrollLeft){ | ||
$floatContainer.scrollLeft(scrollLeft); | ||
@@ -921,3 +930,3 @@ oldScrollLeft = scrollLeft; | ||
} else { | ||
if($scrollContainer.css('overflow-x') == 'scroll'){ | ||
if($scrollContainer.css('overflow-x') === 'scroll'){ | ||
scrollbarOffset.horizontal = scrollbarWidth; | ||
@@ -929,3 +938,3 @@ } else { | ||
} | ||
if($scrollContainer.css('overflow-y') == 'scroll'){ | ||
if($scrollContainer.css('overflow-y') === 'scroll'){ | ||
scrollbarOffset.vertical = scrollbarWidth; | ||
@@ -1062,3 +1071,3 @@ } else { | ||
var wasTableRelated = function(nodes){ | ||
return nodes && nodes[0] && (nodes[0].nodeName == "THEAD" || nodes[0].nodeName == "TD"|| nodes[0].nodeName == "TH"); | ||
return nodes && nodes[0] && (nodes[0].nodeName === "THEAD" || nodes[0].nodeName === "TD"|| nodes[0].nodeName === "TH"); | ||
}; | ||
@@ -1065,0 +1074,0 @@ for(var i=0; i < e.length; i++){ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
125943
2150
133