ad2games-ui_components 2.0.5 → 2.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (24) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/ui_components.js.erb +1 -1
  3. data/app/assets/javascripts/ui_components/toolbar.coffee +1 -1
  4. data/app/assets/stylesheets/default_theme/button.scss +57 -32
  5. data/app/assets/stylesheets/default_theme/date_selector.scss +85 -0
  6. data/app/assets/stylesheets/default_theme/navbar.scss +1 -1
  7. data/app/assets/stylesheets/default_theme/toolbar.scss +97 -59
  8. data/app/assets/stylesheets/ui_components/checkbox_list.scss +29 -0
  9. data/app/assets/stylesheets/variables.scss +1 -1
  10. data/app/cells/checkbox_list/checkbox_list_cell.rb +4 -2
  11. data/lib/ui_components/version.rb +1 -1
  12. data/vendor/assets/bower_components/jquery-ujs/CONTRIBUTING.md +109 -0
  13. data/vendor/assets/bower_components/jquery-ujs/MIT-LICENSE +20 -0
  14. data/vendor/assets/bower_components/jquery-ujs/README.md +81 -0
  15. data/vendor/assets/bower_components/jquery-ujs/bower.json +19 -0
  16. data/vendor/assets/bower_components/jquery-ujs/src/rails.js +555 -0
  17. data/vendor/assets/bower_components/jquery.floatThead/CHANGELOG.md +142 -0
  18. data/vendor/assets/bower_components/jquery.floatThead/README.md +26 -201
  19. data/vendor/assets/bower_components/jquery.floatThead/dist/jquery.floatThead-slim.js +172 -52
  20. data/vendor/assets/bower_components/jquery.floatThead/dist/jquery.floatThead-slim.min.js +2 -2
  21. data/vendor/assets/bower_components/jquery.floatThead/dist/jquery.floatThead.js +173 -53
  22. data/vendor/assets/bower_components/jquery.floatThead/dist/jquery.floatThead.min.js +2 -2
  23. data/vendor/assets/bower_components/jquery.floatThead/license.txt +1 -1
  24. metadata +9 -16
@@ -1,3 +1,3 @@
1
- // @preserve jQuery.floatThead 1.3.2 - http://mkoryak.github.io/floatThead/ - Copyright (c) 2012 - 2015 Misha Koryak
1
+ // @preserve jQuery.floatThead 1.4.1 - http://mkoryak.github.io/floatThead/ - Copyright (c) 2012 - 2016 Misha Koryak
2
2
  // @license MIT
3
- !function(a){function b(a,b){if(8==j){var c=o.width(),d=h.debounce(function(){var a=o.width();c!=a&&(c=a,b())},1);o.on(a,d)}else o.on(a,h.debounce(b,1))}function c(a){window&&window.console&&window.console.error&&window.console.error("jQuery.floatThead: "+a)}function d(a){var b=a.getBoundingClientRect();return b.width||b.right-b.left}function e(){var b=a('<div style="width:50px;height:50px;overflow-y:scroll;position:absolute;top:-200px;left:-200px;"><div style="height:100px;width:100%"></div>');a("body").append(b);var c=b.innerWidth(),d=a("div",b).innerWidth();return b.remove(),c-d}function f(a){if(a.dataTableSettings)for(var b=0;b<a.dataTableSettings.length;b++){var c=a.dataTableSettings[b].nTable;if(a[0]==c)return!0}return!1}function g(a,b,c){var d=c?"outerWidth":"width";if(m&&a.css("max-width")){var e=0;c&&(e+=parseInt(a.css("borderLeft"),10),e+=parseInt(a.css("borderRight"),10));for(var f=0;f<b.length;f++)e+=b.get(f).offsetWidth;return e}return a[d]()}a.floatThead=a.floatThead||{},a.floatThead.defaults={headerCellSelector:"tr:visible:first>*:visible",zIndex:1001,position:"auto",top:0,bottom:0,scrollContainer:function(){return a([])},getSizingRow:function(a){return a.find("tbody tr:visible:first>*:visible")},floatTableClass:"floatThead-table",floatWrapperClass:"floatThead-wrapper",floatContainerClass:"floatThead-container",copyTableClass:!0,enableAria:!1,autoReflow:!1,debug:!1};var h=window._,i="undefined"!=typeof MutationObserver,j=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 a>4?a:document.documentMode}(),k=/Gecko\//.test(navigator.userAgent),l=/WebKit\//.test(navigator.userAgent),m=function(){if(l){var b=a('<div style="width:0px"><table style="max-width:100%"><tr><th><div style="min-width:100px;">X</div></th></tr></table></div>');a("body").append(b);var c=0==b.find("table").width();return b.remove(),c}return!1},n=!k&&!j,o=a(window);a.fn.floatThead=function(k){if(k=k||{},!h&&(h=window._||a.floatThead._,!h))throw new Error("jquery.floatThead-slim.js requires underscore. You should use the non-lite version since you do not have underscore.");if(8>j)return this;var p=null;if(h.isFunction(m)&&(m=m()),h.isString(k)){var q=k,r=this;return this.filter("table").each(function(){var b=a(this),c=b.data("floatThead-lazy");c&&b.floatThead(c);var d=b.data("floatThead-attached");if(d&&h.isFunction(d[q])){var e=d[q]();"undefined"!=typeof e&&(r=e)}}),r}var s=a.extend({},a.floatThead.defaults||{},k);if(a.each(k,function(b){b in a.floatThead.defaults||!s.debug||c("Used ["+b+"] key to init plugin, but that param is not an option for the plugin. Valid options are: "+h.keys(a.floatThead.defaults).join(", "))}),s.debug){var t=a.fn.jquery.split(".");1==parseInt(t[0],10)&&parseInt(t[1],10)<=7&&c("jQuery version "+a.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(."+s.floatTableClass+")").each(function(){function k(a){return a+".fth-"+E+".floatTHead"}function m(){var b=0;if(G.children("tr:visible").each(function(){b+=a(this).outerHeight(!0)}),"collapse"==F.css("border-collapse")){var c=parseInt(F.css("border-top-width"),10),d=parseInt(F.find("thead tr:first").find(">*:first").css("border-top-width"),10);c>d&&(b-=c/2)}eb.outerHeight(b),fb.outerHeight(b)}function q(){var a=g(F,ib,!0),b=O.width()||a,c="hidden"!=O.css("overflow-y")?b-L.vertical:b;if(bb.width(c),P){var d=100*a/c;Y.css("width",d+"%")}else Y.outerWidth(a)}function r(){I=(h.isFunction(s.top)?s.top(F):s.top)||0,J=(h.isFunction(s.bottom)?s.bottom(F):s.bottom)||0}function t(){var b,c=G.find(s.headerCellSelector);if(_?b=$.find("col").length:(b=0,c.each(function(){b+=parseInt(a(this).attr("colspan")||1,10)})),b!=N){N=b;for(var d,e=[],f=[],g=[],h=0;b>h;h++)e.push(s.enableAria&&(d=c.eq(h).text())?'<th scope="col" class="floatThead-col">'+d+"</th>":'<th class="floatThead-col"/>'),f.push("<col/>"),g.push("<fthtd style='display:table-cell;height:0;width:auto;'/>");f=f.join(""),e=e.join(""),n&&(g=g.join(""),ab.html(g),ib=ab.find("fthtd")),eb.html(e),fb=eb.find("th"),_||$.html(f),gb=$.find("col"),Z.html(f),hb=Z.find("col")}return b}function u(){if(!K){if(K=!0,Q){var a=g(F,ib,!0),b=W.width();a>b&&F.css("minWidth",a)}F.css(lb),Y.css(lb),Y.append(G),H.before(db),m()}}function v(){K&&(K=!1,Q&&F.width(nb),db.detach(),F.prepend(G),F.css(mb),Y.css(mb),F.css("minWidth",ob),F.css("minWidth",g(F,ib)))}function w(a){pb!=a&&(pb=a,F.triggerHandler("floatThead",[a,bb]))}function x(a){Q!=a&&(Q=a,bb.css({position:Q?"absolute":"fixed"}))}function y(a,b,c,d){return n?c:d?s.getSizingRow(a,b,c):b}function z(){var a,b=t();return function(){gb=$.find("col");var c=y(F,gb,ib,j);if(c.length==b&&b>0){if(!_)for(a=0;b>a;a++)gb.eq(a).css("width","");v();var e=[];for(a=0;b>a;a++)e[a]=d(c.get(a));for(a=0;b>a;a++)hb.eq(a).width(e[a]),gb.eq(a).width(e[a]);u()}else Y.append(G),F.css(mb),Y.css(mb),m();F.triggerHandler("reflowed",[bb])}}function A(a){var b=O.css("border-"+a+"-width"),c=0;return b&&~b.indexOf("px")&&(c=parseInt(b,10)),c}function B(){var a,b=O.scrollTop(),c=0,d=S?R.outerHeight(!0):0,e=T?d:-d,f=bb.height(),g=F.offset(),h=0,i=0;if(P){var j=O.offset();c=g.top-j.top+b,S&&T&&(c+=d),h=A("left"),i=A("top"),c-=i}else a=g.top-I-f+J+L.horizontal;var k=o.scrollTop(),m=o.scrollLeft(),n=O.scrollLeft();return function(j){var p=F[0].offsetWidth<=0&&F[0].offsetHeight<=0;if(!p&&cb)return cb=!1,setTimeout(function(){F.triggerHandler("reflow")},1),null;if(p&&(cb=!0,!Q))return null;if("windowScroll"==j?(k=o.scrollTop(),m=o.scrollLeft()):"containerScroll"==j?(b=O.scrollTop(),n=O.scrollLeft()):"init"!=j&&(k=o.scrollTop(),m=o.scrollLeft(),b=O.scrollTop(),n=O.scrollLeft()),!l||!(0>k||0>m)){if(X)x("windowScrollDone"==j?!0:!1);else if("windowScrollDone"==j)return null;g=F.offset(),S&&T&&(g.top+=d);var q,r,s=F.outerHeight();if(P&&Q){if(c>=b){var t=c-b+i;q=t>0?t:0,w(!1)}else q=V?i:b,w(!0);r=h}else!P&&Q?(k>a+s+e?q=s-f+e:g.top>=k+I?(q=0,v(),w(!1)):(q=I+k-g.top+c+(T?d:0),u(),w(!0)),r=0):P&&!Q?(c>b||b-c>s?(q=g.top-k,v(),w(!1)):(q=g.top+b-k-c,u(),w(!0)),r=g.left+n-m):P||Q||(k>a+s+e?q=s+I-k+a+e:g.top>k+I?(q=g.top-k,u(),w(!1)):(q=I,w(!0)),r=g.left-m);return{top:q,left:r}}}}function C(){var a=null,b=null,c=null;return function(d,e,f){null==d||a==d.top&&b==d.left||(bb.css({top:d.top,left:d.left}),a=d.top,b=d.left),e&&q(),f&&m();var g=O.scrollLeft();Q&&c==g||(bb.scrollLeft(g),c=g)}}function D(){if(O.length)if(O.data().perfectScrollbar)L={horizontal:0,vertical:0};else{var a=O.width(),b=O.height(),c=F.height(),d=g(F,ib),e=d>a?M:0,f=c>b?M:0;L.horizontal=d>a-f?M:0,L.vertical=c>b-e?M:0}}var E=h.uniqueId(),F=a(this);if(F.data("floatThead-attached"))return!0;if(!F.is("table"))throw new Error('jQuery.floatThead must be run on a table element. ex: $("table").floatThead();');i=s.autoReflow&&i;var G=F.children("thead:first"),H=F.children("tbody:first");if(0==G.length||0==H.length)return F.data("floatThead-lazy",s),void F.unbind("reflow").one("reflow",function(){F.floatThead(s)});F.data("floatThead-lazy")&&F.unbind("reflow"),F.data("floatThead-lazy",!1);var I,J,K=!0,L={vertical:0,horizontal:0},M=e(),N=0,O=s.scrollContainer(F)||a([]),P=O.length>0,Q=null;"undefined"!=typeof s.useAbsolutePositioning&&(s.position="auto",s.useAbsolutePositioning&&(s.position=s.useAbsolutePositioning?"absolute":"fixed"),c("option 'useAbsolutePositioning' has been removed in v1.3.0, use `position:'"+s.position+"'` instead. See docs for more info: http://mkoryak.github.io/floatThead/#options")),"undefined"!=typeof s.scrollingTop&&(s.top=s.scrollingTop,c("option 'scrollingTop' has been renamed to 'top' in v1.3.0. See docs for more info: http://mkoryak.github.io/floatThead/#options")),"undefined"!=typeof s.scrollingBottom&&(s.bottom=s.scrollingBottom,c("option 'scrollingBottom' has been renamed to 'bottom' in v1.3.0. See docs for more info: http://mkoryak.github.io/floatThead/#options")),"auto"==s.position?Q=null:"fixed"==s.position?Q=!1:"absolute"==s.position?Q=!0:s.debug&&c('Invalid value given to "position" option, valid is "fixed", "absolute" and "auto". You passed: ',s.position),null==Q&&(Q=P);var R=F.find("caption"),S=1==R.length;if(S)var T="top"===(R.css("caption-side")||R.attr("align")||"top");var U=a('<fthfoot style="display:table-footer-group;border-spacing:0;height:0;border-collapse:collapse;visibility:hidden"/>'),V=!1,W=a([]),X=9>=j&&!P&&Q,Y=a("<table/>"),Z=a("<colgroup/>"),$=F.children("colgroup:first"),_=!0;0==$.length&&($=a("<colgroup/>"),_=!1);var ab=a('<fthtr style="display:table-row;border-spacing:0;height:0;border-collapse:collapse"/>'),bb=a('<div style="overflow: hidden;" aria-hidden="true"></div>'),cb=!1,db=a("<thead/>"),eb=a('<tr class="size-row"/>'),fb=a([]),gb=a([]),hb=a([]),ib=a([]);db.append(eb),F.prepend($),n&&(U.append(ab),F.append(U)),Y.append(Z),bb.append(Y),s.copyTableClass&&Y.attr("class",F.attr("class")),Y.attr({cellpadding:F.attr("cellpadding"),cellspacing:F.attr("cellspacing"),border:F.attr("border")});var jb=F.css("display");if(Y.css({borderCollapse:F.css("borderCollapse"),border:F.css("border"),display:jb}),"none"==jb&&(cb=!0),Y.addClass(s.floatTableClass).css({margin:0,"border-bottom-width":0}),Q){var kb=function(a,b){var c=a.css("position"),d="relative"==c||"absolute"==c,e=a;if(!d||b){var f={paddingLeft:a.css("paddingLeft"),paddingRight:a.css("paddingRight")};bb.css(f),e=a.data("floatThead-containerWrap")||a.wrap("<div class='"+s.floatWrapperClass+"' style='position: relative; clear:both;'></div>").parent(),a.data("floatThead-containerWrap",e),V=!0}return e};P?(W=kb(O,!0),W.prepend(bb)):(W=kb(F),F.before(bb))}else F.before(bb);bb.css({position:Q?"absolute":"fixed",marginTop:0,top:Q?0:"auto",zIndex:s.zIndex}),bb.addClass(s.floatContainerClass),r();var lb={"table-layout":"fixed"},mb={"table-layout":F.css("tableLayout")||"auto"},nb=F[0].style.width||"",ob=F.css("minWidth")||"",pb=!1;D();var qb,rb=function(){(qb=z())()};rb();var sb=B(),tb=C();tb(sb("init"),!0);var ub=h.debounce(function(){tb(sb("windowScrollDone"),!1)},1),vb=function(){tb(sb("windowScroll"),!1),X&&ub()},wb=function(){tb(sb("containerScroll"),!1)},xb=function(){F.is(":hidden")||(r(),D(),rb(),sb=B(),(tb=C())(sb("resize"),!0,!0))},yb=h.debounce(function(){F.is(":hidden")||(D(),r(),rb(),sb=B(),tb(sb("reflow"),!0))},1);if(P?Q?O.on(k("scroll"),wb):(O.on(k("scroll"),wb),o.on(k("scroll"),vb)):o.on(k("scroll"),vb),o.on(k("load"),yb),b(k("resize"),xb),F.on("reflow",yb),f(F)&&F.on("filter",yb).on("sort",yb).on("page",yb),o.on(k("shown.bs.tab"),yb),o.on(k("tabsactivate"),yb),i){var zb=null;h.isFunction(s.autoReflow)&&(zb=s.autoReflow(F,O)),zb||(zb=O.length?O[0]:F[0]),p=new MutationObserver(function(a){for(var b=function(a){return a&&a[0]&&("THEAD"==a[0].nodeName||"TD"==a[0].nodeName||"TH"==a[0].nodeName)},c=0;c<a.length;c++)if(!b(a[c].addedNodes)&&!b(a[c].removedNodes)){yb();break}}),p.observe(zb,{childList:!0,subtree:!0})}F.data("floatThead-attached",{destroy:function(){var a=".fth-"+E;v(),F.css(mb),$.remove(),n&&U.remove(),db.parent().length&&db.replaceWith(G),i&&(p.disconnect(),p=null),F.off("reflow reflowed"),O.off(a),V&&(O.length?O.unwrap():F.unwrap()),P?O.data("floatThead-containerWrap",!1):F.data("floatThead-containerWrap",!1),F.css("minWidth",ob),bb.remove(),F.data("floatThead-attached",!1),o.off(a)},reflow:function(){yb()},setHeaderHeight:function(){m()},getFloatContainer:function(){return bb},getRowGroups:function(){return K?bb.find(">table>thead").add(F.children("tbody,tfoot")):F.children("thead,tbody,tfoot")}})}),this}}(jQuery);
3
+ !function(a){function b(a,b){if(8==k){var c=p.width(),d=i.debounce(function(){var a=p.width();c!=a&&(c=a,b())},1);p.on(a,d)}else p.on(a,i.debounce(b,1))}function c(b){var c=b[0],d=c.parentElement;do{var e=window.getComputedStyle(d).getPropertyValue("overflow");if("visible"!=e)break}while(d=d.parentElement);return a(d==document.body?[]:d)}function d(a){window&&window.console&&window.console.error&&window.console.error("jQuery.floatThead: "+a)}function e(a){var b=a.getBoundingClientRect();return b.width||b.right-b.left}function f(){var b=a('<div style="width:50px;height:50px;overflow-y:scroll;position:absolute;top:-200px;left:-200px;"><div style="height:100px;width:100%"></div>');a("body").append(b);var c=b.innerWidth(),d=a("div",b).innerWidth();return b.remove(),c-d}function g(a){if(a.dataTableSettings)for(var b=0;b<a.dataTableSettings.length;b++){var c=a.dataTableSettings[b].nTable;if(a[0]==c)return!0}return!1}function h(a,b,c){var d=c?"outerWidth":"width";if(n&&a.css("max-width")){var e=0;c&&(e+=parseInt(a.css("borderLeft"),10),e+=parseInt(a.css("borderRight"),10));for(var f=0;f<b.length;f++)e+=b.get(f).offsetWidth;return e}return a[d]()}a.floatThead=a.floatThead||{},a.floatThead.defaults={headerCellSelector:"tr:visible:first>*:visible",zIndex:1001,position:"auto",top:0,bottom:0,scrollContainer:function(){return a([])},responsiveContainer:function(){return a([])},getSizingRow:function(a){return a.find("tbody tr:visible:first>*:visible")},floatTableClass:"floatThead-table",floatWrapperClass:"floatThead-wrapper",floatContainerClass:"floatThead-container",copyTableClass:!0,enableAria:!1,autoReflow:!1,debug:!1,support:{bootstrap:!0,datatables:!0,jqueryUI:!0,perfectScrollbar:!0}};var i=window._,j="undefined"!=typeof MutationObserver,k=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 a>4?a:document.documentMode}(),l=/Gecko\//.test(navigator.userAgent),m=/WebKit\//.test(navigator.userAgent);k||l||m||(k=11);var n=function(){if(m){var b=a('<div style="width:0px"><table style="max-width:100%"><tr><th><div style="min-width:100px;">X</div></th></tr></table></div>');a("body").append(b);var c=0==b.find("table").width();return b.remove(),c}return!1},o=!l&&!k,p=a(window);if(!window.matchMedia){var q=window.onbeforeprint,r=window.onafterprint;window.onbeforeprint=function(){q&&q(),p.triggerHandler("beforeprint")},window.onafterprint=function(){r&&r(),p.triggerHandler("afterprint")}}a.fn.floatThead=function(l){if(l=l||{},!i&&(i=window._||a.floatThead._,!i))throw new Error("jquery.floatThead-slim.js requires underscore. You should use the non-lite version since you do not have underscore.");if(8>k)return this;var q=null;if(i.isFunction(n)&&(n=n()),i.isString(l)){var r=l,s=this;return this.filter("table").each(function(){var b=a(this),c=b.data("floatThead-lazy");c&&b.floatThead(c);var d=b.data("floatThead-attached");if(d&&i.isFunction(d[r])){var e=d[r]();"undefined"!=typeof e&&(s=e)}}),s}var t=a.extend({},a.floatThead.defaults||{},l);if(a.each(l,function(b){b in a.floatThead.defaults||!t.debug||d("Used ["+b+"] key to init plugin, but that param is not an option for the plugin. Valid options are: "+i.keys(a.floatThead.defaults).join(", "))}),t.debug){var u=a.fn.jquery.split(".");1==parseInt(u[0],10)&&parseInt(u[1],10)<=7&&d("jQuery version "+a.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(."+t.floatTableClass+")").each(function(){function l(a){return a+".fth-"+G+".floatTHead"}function n(){var b=0;if(I.children("tr:visible").each(function(){b+=a(this).outerHeight(!0)}),"collapse"==H.css("border-collapse")){var c=parseInt(H.css("border-top-width"),10),d=parseInt(H.find("thead tr:first").find(">*:first").css("border-top-width"),10);c>d&&(b-=c/2)}ib.outerHeight(b),jb.outerHeight(b)}function r(){var a=h(H,mb,!0),b=T?S:Q,c=b.width()||a,d="hidden"!=b.css("overflow-y")?c-N.vertical:c;if(fb.width(d),R){var e=100*a/d;ab.css("width",e+"%")}else ab.outerWidth(a)}function s(){K=(i.isFunction(t.top)?t.top(H):t.top)||0,L=(i.isFunction(t.bottom)?t.bottom(H):t.bottom)||0}function u(){var b,c=I.find(t.headerCellSelector);if(db?b=cb.find("col").length:(b=0,c.each(function(){b+=parseInt(a(this).attr("colspan")||1,10)})),b!=P){P=b;for(var d,e=[],f=[],g=[],h=0;b>h;h++)e.push(t.enableAria&&(d=c.eq(h).text())?'<th scope="col" class="floatThead-col">'+d+"</th>":'<th class="floatThead-col"/>'),f.push("<col/>"),g.push("<fthtd style='display:table-cell;height:0;width:auto;'/>");f=f.join(""),e=e.join(""),o&&(g=g.join(""),eb.html(g),mb=eb.find("fthtd")),ib.html(e),jb=ib.find("th"),db||cb.html(f),kb=cb.find("col"),bb.html(f),lb=bb.find("col")}return b}function v(){if(!M){if(M=!0,U){var a=h(H,mb,!0),b=$.width();a>b&&H.css("minWidth",a)}H.css(pb),ab.css(pb),ab.append(I),J.before(hb),n()}}function w(){M&&(M=!1,U&&H.width(rb),hb.detach(),H.prepend(I),H.css(qb),ab.css(qb),H.css("minWidth",sb),H.css("minWidth",h(H,mb)))}function x(a){tb!=a&&(tb=a,H.triggerHandler("floatThead",[a,fb]))}function y(a){U!=a&&(U=a,fb.css({position:U?"absolute":"fixed"}))}function z(a,b,c,d){return o?c:d?t.getSizingRow(a,b,c):b}function A(){var a,b=u();return function(){var c=fb.scrollLeft();kb=cb.find("col");var d=z(H,kb,mb,k);if(d.length==b&&b>0){if(!db)for(a=0;b>a;a++)kb.eq(a).css("width","");w();var f=[];for(a=0;b>a;a++)f[a]=e(d.get(a));for(a=0;b>a;a++)lb.eq(a).width(f[a]),kb.eq(a).width(f[a]);v()}else ab.append(I),H.css(qb),ab.css(qb),n();fb.scrollLeft(c),H.triggerHandler("reflowed",[fb])}}function B(a){var b=Q.css("border-"+a+"-width"),c=0;return b&&~b.indexOf("px")&&(c=parseInt(b,10)),c}function C(){return"auto"==S.css("overflow-x")}function D(){var a,b=Q.scrollTop(),c=0,d=W?V.outerHeight(!0):0,e=X?d:-d,f=fb.height(),g=H.offset(),h=0,i=0;if(R){var j=Q.offset();c=g.top-j.top+b,W&&X&&(c+=d),h=B("left"),i=B("top"),c-=i}else a=g.top-K-f+L+N.horizontal;var k=p.scrollTop(),l=p.scrollLeft(),n=(C()?S:Q).scrollLeft();return function(j){T=C();var o=H[0].offsetWidth<=0&&H[0].offsetHeight<=0;if(!o&&gb)return gb=!1,setTimeout(function(){H.triggerHandler("reflow")},1),null;if(o&&(gb=!0,!U))return null;if("windowScroll"==j)k=p.scrollTop(),l=p.scrollLeft();else if("containerScroll"==j)if(S.length){if(!T)return;n=S.scrollLeft()}else b=Q.scrollTop(),n=Q.scrollLeft();else"init"!=j&&(k=p.scrollTop(),l=p.scrollLeft(),b=Q.scrollTop(),n=(T?S:Q).scrollLeft());if(!m||!(0>k||0>l)){if(_)y("windowScrollDone"==j?!0:!1);else if("windowScrollDone"==j)return null;g=H.offset(),W&&X&&(g.top+=d);var q,r,s=H.outerHeight();if(R&&U){if(c>=b){var t=c-b+i;q=t>0?t:0,x(!1)}else q=Z?i:b,x(!0);r=h}else!R&&U?(k>a+s+e?q=s-f+e:g.top>=k+K?(q=0,w(),x(!1)):(q=K+k-g.top+c+(X?d:0),v(),x(!0)),r=n):R&&!U?(c>b||b-c>s?(q=g.top-k,w(),x(!1)):(q=g.top+b-k-c,v(),x(!0)),r=g.left+n-l):R||U||(k>a+s+e?q=s+K-k+a+e:g.top>k+K?(q=g.top-k,v(),x(!1)):(q=K,x(!0)),r=g.left+n-l);return{top:q,left:r}}}}function E(){var a=null,b=null,c=null;return function(d,e,f){null==d||a==d.top&&b==d.left||(fb.css({top:d.top,left:d.left}),a=d.top,b=d.left),e&&r(),f&&n();var g=(T?S:Q).scrollLeft();U&&c==g||(fb.scrollLeft(g),c=g)}}function F(){if(Q.length)if(t.support&&t.support.perfectScrollbar&&Q.data().perfectScrollbar)N={horizontal:0,vertical:0};else{if("scroll"==Q.css("overflow-x"))N.horizontal=O;else{var a=Q.width(),b=h(H,mb),c=e>d?O:0;N.horizontal=b>a-c?O:0}if("scroll"==Q.css("overflow-y"))N.vertical=O;else{var d=Q.height(),e=H.height(),f=b>a?O:0;N.vertical=e>d-f?O:0}}}var G=i.uniqueId(),H=a(this);if(H.data("floatThead-attached"))return!0;if(!H.is("table"))throw new Error('jQuery.floatThead must be run on a table element. ex: $("table").floatThead();');j=t.autoReflow&&j;var I=H.children("thead:first"),J=H.children("tbody:first");if(0==I.length||0==J.length)return H.data("floatThead-lazy",t),void H.unbind("reflow").one("reflow",function(){H.floatThead(t)});H.data("floatThead-lazy")&&H.unbind("reflow"),H.data("floatThead-lazy",!1);var K,L,M=!0,N={vertical:0,horizontal:0},O=f(),P=0;t.scrollContainer===!0&&(t.scrollContainer=c);var Q=t.scrollContainer(H)||a([]),R=Q.length>0,S=R?a([]):t.responsiveContainer(H)||a([]),T=C(),U=null;"undefined"!=typeof t.useAbsolutePositioning&&(t.position="auto",t.useAbsolutePositioning&&(t.position=t.useAbsolutePositioning?"absolute":"fixed"),d("option 'useAbsolutePositioning' has been removed in v1.3.0, use `position:'"+t.position+"'` instead. See docs for more info: http://mkoryak.github.io/floatThead/#options")),"undefined"!=typeof t.scrollingTop&&(t.top=t.scrollingTop,d("option 'scrollingTop' has been renamed to 'top' in v1.3.0. See docs for more info: http://mkoryak.github.io/floatThead/#options")),"undefined"!=typeof t.scrollingBottom&&(t.bottom=t.scrollingBottom,d("option 'scrollingBottom' has been renamed to 'bottom' in v1.3.0. See docs for more info: http://mkoryak.github.io/floatThead/#options")),"auto"==t.position?U=null:"fixed"==t.position?U=!1:"absolute"==t.position?U=!0:t.debug&&d('Invalid value given to "position" option, valid is "fixed", "absolute" and "auto". You passed: ',t.position),null==U&&(U=R);var V=H.find("caption"),W=1==V.length;if(W)var X="top"===(V.css("caption-side")||V.attr("align")||"top");var Y=a('<fthfoot style="display:table-footer-group;border-spacing:0;height:0;border-collapse:collapse;visibility:hidden"/>'),Z=!1,$=a([]),_=9>=k&&!R&&U,ab=a("<table/>"),bb=a("<colgroup/>"),cb=H.children("colgroup:first"),db=!0;0==cb.length&&(cb=a("<colgroup/>"),db=!1);var eb=a('<fthtr style="display:table-row;border-spacing:0;height:0;border-collapse:collapse"/>'),fb=a('<div style="overflow: hidden;" aria-hidden="true"></div>'),gb=!1,hb=a("<thead/>"),ib=a('<tr class="size-row"/>'),jb=a([]),kb=a([]),lb=a([]),mb=a([]);hb.append(ib),H.prepend(cb),o&&(Y.append(eb),H.append(Y)),ab.append(bb),fb.append(ab),t.copyTableClass&&ab.attr("class",H.attr("class")),ab.attr({cellpadding:H.attr("cellpadding"),cellspacing:H.attr("cellspacing"),border:H.attr("border")});var nb=H.css("display");if(ab.css({borderCollapse:H.css("borderCollapse"),border:H.css("border"),display:nb}),R||ab.css("width","auto"),"none"==nb&&(gb=!0),ab.addClass(t.floatTableClass).css({margin:0,"border-bottom-width":0}),U){var ob=function(a,b){var c=a.css("position"),d="relative"==c||"absolute"==c,e=a;if(!d||b){var f={paddingLeft:a.css("paddingLeft"),paddingRight:a.css("paddingRight")};fb.css(f),e=a.data("floatThead-containerWrap")||a.wrap("<div class='"+t.floatWrapperClass+"' style='position: relative; clear:both;'></div>").parent(),a.data("floatThead-containerWrap",e),Z=!0}return e};R?($=ob(Q,!0),$.prepend(fb)):($=ob(H),H.before(fb))}else H.before(fb);fb.css({position:U?"absolute":"fixed",marginTop:0,top:U?0:"auto",zIndex:t.zIndex}),fb.addClass(t.floatContainerClass),s();var pb={"table-layout":"fixed"},qb={"table-layout":H.css("tableLayout")||"auto"},rb=H[0].style.width||"",sb=H.css("minWidth")||"",tb=!1;F();var ub,vb=function(){(ub=A())()};vb();var wb=D(),xb=E();xb(wb("init"),!0);var yb=i.debounce(function(){xb(wb("windowScrollDone"),!1)},1),zb=function(){xb(wb("windowScroll"),!1),_&&yb()},Ab=function(){xb(wb("containerScroll"),!1)},Bb=function(){H.is(":hidden")||(s(),F(),vb(),wb=D(),(xb=E())(wb("resize"),!0,!0))},Cb=i.debounce(function(){H.is(":hidden")||(F(),s(),vb(),wb=D(),xb(wb("reflow"),!0))},1),Db=function(){H.floatThead("destroy",[!0])},Eb=function(){H.floatThead(t)},Fb=function(a){a.matches?Db():Eb()};if(window.matchMedia?window.matchMedia("print").addListener(Fb):(p.on("beforeprint",Db),p.on("afterprint",Eb)),R?U?Q.on(l("scroll"),Ab):(Q.on(l("scroll"),Ab),p.on(l("scroll"),zb)):(S.on(l("scroll"),Ab),p.on(l("scroll"),zb)),p.on(l("load"),Cb),b(l("resize"),Bb),H.on("reflow",Cb),t.support&&t.support.datatables&&g(H)&&H.on("filter",Cb).on("sort",Cb).on("page",Cb),t.support&&t.support.bootstrap&&p.on(l("shown.bs.tab"),Cb),t.support&&t.support.jqueryUI&&p.on(l("tabsactivate"),Cb),j){var Gb=null;i.isFunction(t.autoReflow)&&(Gb=t.autoReflow(H,Q)),Gb||(Gb=Q.length?Q[0]:H[0]),q=new MutationObserver(function(a){for(var b=function(a){return a&&a[0]&&("THEAD"==a[0].nodeName||"TD"==a[0].nodeName||"TH"==a[0].nodeName)},c=0;c<a.length;c++)if(!b(a[c].addedNodes)&&!b(a[c].removedNodes)){Cb();break}}),q.observe(Gb,{childList:!0,subtree:!0})}H.data("floatThead-attached",{destroy:function(a,b){var c=".fth-"+G;w(),H.css(qb),cb.remove(),o&&Y.remove(),hb.parent().length&&hb.replaceWith(I),x(!1),j&&(q.disconnect(),q=null),H.off("reflow reflowed"),Q.off(c),S.off(c),Z&&(Q.length?Q.unwrap():H.unwrap()),R?Q.data("floatThead-containerWrap",!1):H.data("floatThead-containerWrap",!1),H.css("minWidth",sb),fb.remove(),H.data("floatThead-attached",!1),p.off(c),b||(window.matchMedia&&window.matchMedia("print").removeListener(Fb),Db=Eb=function(){})},reflow:function(){Cb()},setHeaderHeight:function(){n()},getFloatContainer:function(){return fb},getRowGroups:function(){return M?fb.find(">table>thead").add(H.children("tbody,tfoot")):H.children("thead,tbody,tfoot")}})}),this}}(jQuery);
@@ -1,4 +1,4 @@
1
- // @preserve jQuery.floatThead 1.3.2 - http://mkoryak.github.io/floatThead/ - Copyright (c) 2012 - 2015 Misha Koryak
1
+ // @preserve jQuery.floatThead 1.4.1 - http://mkoryak.github.io/floatThead/ - Copyright (c) 2012 - 2016 Misha Koryak
2
2
  // @license MIT
3
3
 
4
4
  /* @author Misha Koryak
@@ -24,8 +24,11 @@
24
24
  position: 'auto', // 'fixed', 'absolute', 'auto'. auto picks the best for your table scrolling type.
25
25
  top: 0, //String or function($table) - offset from top of window where the header should not pass above
26
26
  bottom: 0, //String or function($table) - offset from the bottom of the table where the header should stop scrolling
27
- scrollContainer: function($table){
28
- return $([]); //if the table has horizontal scroll bars then this is the container that has overflow:auto and causes those scroll bars
27
+ scrollContainer: function($table) { // or boolean 'true' (use offsetParent) | function -> if the table has horizontal scroll bars then this is the container that has overflow:auto and causes those scroll bars
28
+ return $([]);
29
+ },
30
+ responsiveContainer: function($table) { // only valid if scrollContainer is not used (ie window scrolling). this is the container which will control y scrolling at some mobile breakpoints
31
+ return $([]);
29
32
  },
30
33
  getSizingRow: function($table, $cols, $fthCells){ // this is only called when using IE,
31
34
  // override it if the first row of the table is going to contain colgroups (any cell spans greater than one col)
@@ -38,7 +41,13 @@
38
41
  copyTableClass: true, //copy 'class' attribute from table into the floated table so that the styles match.
39
42
  enableAria: false, //will copy header text from the floated header back into the table for screen readers. Might cause the css styling to be off. beware!
40
43
  autoReflow: false, //(undocumented) - use MutationObserver api to reflow automatically when internal table DOM changes
41
- debug: false //print possible issues (that don't prevent script loading) to console, if console exists.
44
+ debug: false, //print possible issues (that don't prevent script loading) to console, if console exists.
45
+ support: { //should we bind events that expect these frameworks to be present and/or check for them?
46
+ bootstrap: true,
47
+ datatables: true,
48
+ jqueryUI: true,
49
+ perfectScrollbar: true
50
+ }
42
51
  };
43
52
 
44
53
  var util = window._;
@@ -51,6 +60,10 @@
51
60
  var isFF = /Gecko\//.test(navigator.userAgent);
52
61
  var isWebkit = /WebKit\//.test(navigator.userAgent);
53
62
 
63
+ if(!(ieVersion || isFF || isWebkit)){
64
+ ieVersion = 11; //yey a hack!
65
+ }
66
+
54
67
  //safari 7 (and perhaps others) reports table width to be parent container's width if max-width is set on table. see: https://github.com/mkoryak/floatThead/issues/108
55
68
  var isTableWidthBug = function(){
56
69
  if(isWebkit) {
@@ -67,6 +80,20 @@
67
80
 
68
81
  var $window = $(window);
69
82
 
83
+ if(!window.matchMedia) {
84
+ //these will be used by the plugin to go into print mode (destroy and remake itself)
85
+ var _beforePrint = window.onbeforeprint;
86
+ var _afterPrint = window.onafterprint;
87
+ window.onbeforeprint = function () {
88
+ _beforePrint && _beforePrint();
89
+ $window.triggerHandler("beforeprint");
90
+ };
91
+ window.onafterprint = function () {
92
+ _afterPrint && _afterPrint();
93
+ $window.triggerHandler("afterprint");
94
+ };
95
+ }
96
+
70
97
  /**
71
98
  * @param debounceMs
72
99
  * @param cb
@@ -87,6 +114,25 @@
87
114
  }
88
115
  }
89
116
 
117
+ function getClosestScrollContainer($elem) {
118
+ var elem = $elem[0];
119
+ var parent = elem.parentElement;
120
+
121
+ do {
122
+ var pos = window
123
+ .getComputedStyle(parent)
124
+ .getPropertyValue('overflow');
125
+
126
+ if (pos != 'visible') break;
127
+
128
+ } while (parent = parent.parentElement);
129
+
130
+ if(parent == document.body){
131
+ return $([]);
132
+ }
133
+ return $(parent);
134
+ }
135
+
90
136
 
91
137
  function debug(str){
92
138
  window && window.console && window.console.error && window.console.error("jQuery.floatThead: " + str);
@@ -104,9 +150,9 @@
104
150
  */
105
151
  function scrollbarWidth() {
106
152
  var $div = $( //borrowed from anti-scroll
107
- '<div style="width:50px;height:50px;overflow-y:scroll;'
108
- + 'position:absolute;top:-200px;left:-200px;"><div style="height:100px;width:100%">'
109
- + '</div>'
153
+ '<div style="width:50px;height:50px;overflow-y:scroll;'
154
+ + 'position:absolute;top:-200px;left:-200px;"><div style="height:100px;width:100%">'
155
+ + '</div>'
110
156
  );
111
157
  $('body').append($div);
112
158
  var w1 = $div.innerWidth();
@@ -229,8 +275,15 @@
229
275
  var scrollbarOffset = {vertical: 0, horizontal: 0};
230
276
  var scWidth = scrollbarWidth();
231
277
  var lastColumnCount = 0; //used by columnNum()
278
+
279
+ if(opts.scrollContainer === true){
280
+ opts.scrollContainer = getClosestScrollContainer;
281
+ }
282
+
232
283
  var $scrollContainer = opts.scrollContainer($table) || $([]); //guard against returned nulls
233
284
  var locked = $scrollContainer.length > 0;
285
+ var $responsiveContainer = locked ? $([]) : opts.responsiveContainer($table) || $([]);
286
+ var responsive = isResponsiveContainerActive();
234
287
 
235
288
  var useAbsolutePositioning = null;
236
289
  if(typeof opts.useAbsolutePositioning !== 'undefined'){
@@ -245,8 +298,8 @@
245
298
  debug("option 'scrollingTop' has been renamed to 'top' in v1.3.0. See docs for more info: http://mkoryak.github.io/floatThead/#options");
246
299
  }
247
300
  if(typeof opts.scrollingBottom !== 'undefined'){
248
- opts.bottom = opts.scrollingBottom;
249
- debug("option 'scrollingBottom' has been renamed to 'bottom' in v1.3.0. See docs for more info: http://mkoryak.github.io/floatThead/#options");
301
+ opts.bottom = opts.scrollingBottom;
302
+ debug("option 'scrollingBottom' has been renamed to 'bottom' in v1.3.0. See docs for more info: http://mkoryak.github.io/floatThead/#options");
250
303
  }
251
304
 
252
305
 
@@ -305,16 +358,19 @@
305
358
  $floatTable.attr('class', $table.attr('class'));
306
359
  }
307
360
  $floatTable.attr({ //copy over some deprecated table attributes that people still like to use. Good thing people don't use colgroups...
308
- 'cellpadding': $table.attr('cellpadding'),
309
- 'cellspacing': $table.attr('cellspacing'),
310
- 'border': $table.attr('border')
311
- });
361
+ 'cellpadding': $table.attr('cellpadding'),
362
+ 'cellspacing': $table.attr('cellspacing'),
363
+ 'border': $table.attr('border')
364
+ });
312
365
  var tableDisplayCss = $table.css('display');
313
366
  $floatTable.css({
314
- 'borderCollapse': $table.css('borderCollapse'),
315
- 'border': $table.css('border'),
316
- 'display': tableDisplayCss
317
- });
367
+ 'borderCollapse': $table.css('borderCollapse'),
368
+ 'border': $table.css('border'),
369
+ 'display': tableDisplayCss
370
+ });
371
+ if(!locked){
372
+ $floatTable.css('width', 'auto');
373
+ }
318
374
  if(tableDisplayCss == 'none'){
319
375
  floatTableHidden = true;
320
376
  }
@@ -348,11 +404,11 @@
348
404
 
349
405
 
350
406
  $floatContainer.css({
351
- position: useAbsolutePositioning ? 'absolute' : 'fixed',
352
- marginTop: 0,
353
- top: useAbsolutePositioning ? 0 : 'auto',
354
- zIndex: opts.zIndex
355
- });
407
+ position: useAbsolutePositioning ? 'absolute' : 'fixed',
408
+ marginTop: 0,
409
+ top: useAbsolutePositioning ? 0 : 'auto',
410
+ zIndex: opts.zIndex
411
+ });
356
412
  $floatContainer.addClass(opts.floatContainerClass);
357
413
  updateScrollingOffsets();
358
414
 
@@ -384,8 +440,9 @@
384
440
 
385
441
  function setFloatWidth(){
386
442
  var tw = tableWidth($table, $fthCells, true);
387
- var width = $scrollContainer.width() || tw;
388
- var floatContainerWidth = $scrollContainer.css("overflow-y") != 'hidden' ? width - scrollbarOffset.vertical : width;
443
+ var $container = responsive ? $responsiveContainer : $scrollContainer;
444
+ var width = $container.width() || tw;
445
+ var floatContainerWidth = $container.css("overflow-y") != 'hidden' ? width - scrollbarOffset.vertical : width;
389
446
  $floatContainer.width(floatContainerWidth);
390
447
  if(locked){
391
448
  var percent = 100 * tw / (floatContainerWidth);
@@ -411,7 +468,7 @@
411
468
  } else {
412
469
  count = 0;
413
470
  $headerColumns.each(function () {
414
- count += parseInt(($(this).attr('colspan') || 1), 10);
471
+ count += parseInt(($(this).attr('colspan') || 1), 10);
415
472
  });
416
473
  }
417
474
  if(count != lastColumnCount){
@@ -492,8 +549,8 @@
492
549
  if(useAbsolutePositioning != isAbsolute){
493
550
  useAbsolutePositioning = isAbsolute;
494
551
  $floatContainer.css({
495
- position: useAbsolutePositioning ? 'absolute' : 'fixed'
496
- });
552
+ position: useAbsolutePositioning ? 'absolute' : 'fixed'
553
+ });
497
554
  }
498
555
  }
499
556
  function getSizingRow($table, $cols, $fthCells, ieVersion){
@@ -515,6 +572,8 @@
515
572
  var numCols = columnNum(); //if the tables columns changed dynamically since last time (datatables), rebuild the sizer rows and get a new count
516
573
 
517
574
  return function(){
575
+ //Cache the current scrollLeft value so that it can be reset post reflow
576
+ var scrollLeft = $floatContainer.scrollLeft();
518
577
  $tableCells = $tableColGroup.find('col');
519
578
  var $rowCells = getSizingRow($table, $tableCells, $fthCells, ieVersion);
520
579
 
@@ -540,6 +599,8 @@
540
599
  $floatTable.css(layoutAuto);
541
600
  setHeaderHeight();
542
601
  }
602
+ //Set back the current scrollLeft value on floatContainer
603
+ $floatContainer.scrollLeft(scrollLeft);
543
604
  $table.triggerHandler("reflowed", [$floatContainer]);
544
605
  };
545
606
  }
@@ -552,6 +613,10 @@
552
613
  }
553
614
  return w;
554
615
  }
616
+
617
+ function isResponsiveContainerActive(){
618
+ return $responsiveContainer.css("overflow-x") == 'auto';
619
+ }
555
620
  /**
556
621
  * first performs initial calculations that we expect to not change when the table, window, or scrolling container are scrolled.
557
622
  * returns a function that calculates the floating container's top and left coords. takes into account if we are using page scrolling or inner scrolling
@@ -584,9 +649,11 @@
584
649
  }
585
650
  var windowTop = $window.scrollTop();
586
651
  var windowLeft = $window.scrollLeft();
587
- var scrollContainerLeft = $scrollContainer.scrollLeft();
652
+ var scrollContainerLeft = (isResponsiveContainerActive() ? $responsiveContainer : $scrollContainer).scrollLeft();
588
653
 
589
654
  return function(eventType){
655
+ responsive = isResponsiveContainerActive();
656
+
590
657
  var isTableHidden = $table[0].offsetWidth <= 0 && $table[0].offsetHeight <= 0;
591
658
  if(!isTableHidden && floatTableHidden) {
592
659
  floatTableHidden = false;
@@ -606,13 +673,20 @@
606
673
  windowTop = $window.scrollTop();
607
674
  windowLeft = $window.scrollLeft();
608
675
  } else if(eventType == 'containerScroll'){
609
- scrollingContainerTop = $scrollContainer.scrollTop();
610
- scrollContainerLeft = $scrollContainer.scrollLeft();
676
+ if($responsiveContainer.length){
677
+ if(!responsive){
678
+ return; //we dont care about the event if we arent responsive right now
679
+ }
680
+ scrollContainerLeft = $responsiveContainer.scrollLeft();
681
+ } else {
682
+ scrollingContainerTop = $scrollContainer.scrollTop();
683
+ scrollContainerLeft = $scrollContainer.scrollLeft();
684
+ }
611
685
  } else if(eventType != 'init') {
612
686
  windowTop = $window.scrollTop();
613
687
  windowLeft = $window.scrollLeft();
614
688
  scrollingContainerTop = $scrollContainer.scrollTop();
615
- scrollContainerLeft = $scrollContainer.scrollLeft();
689
+ scrollContainerLeft = (responsive ? $responsiveContainer : $scrollContainer).scrollLeft();
616
690
  }
617
691
  if(isWebkit && (windowTop < 0 || windowLeft < 0)){ //chrome overscroll effect at the top of the page - breaks fixed positioned floated headers
618
692
  return;
@@ -658,7 +732,7 @@
658
732
  refloat(); //scrolling within table. header floated
659
733
  triggerFloatEvent(true);
660
734
  }
661
- left = 0;
735
+ left = scrollContainerLeft;
662
736
  } else if(locked && !useAbsolutePositioning){ //inner scrolling, fixed positioning
663
737
  if (tableContainerGap > scrollingContainerTop || scrollingContainerTop - tableContainerGap > tableHeight) {
664
738
  top = tableOffset.top - windowTop;
@@ -685,7 +759,7 @@
685
759
  top = scrollingTop;
686
760
  triggerFloatEvent(true);
687
761
  }
688
- left = tableOffset.left - windowLeft;
762
+ left = tableOffset.left + scrollContainerLeft - windowLeft;
689
763
  }
690
764
  return {top: top, left: left};
691
765
  };
@@ -701,9 +775,9 @@
701
775
  return function(pos, setWidth, setHeight){
702
776
  if(pos != null && (oldTop != pos.top || oldLeft != pos.left)){
703
777
  $floatContainer.css({
704
- top: pos.top,
705
- left: pos.left
706
- });
778
+ top: pos.top,
779
+ left: pos.left
780
+ });
707
781
  oldTop = pos.top;
708
782
  oldLeft = pos.left;
709
783
  }
@@ -713,7 +787,7 @@
713
787
  if(setHeight){
714
788
  setHeaderHeight();
715
789
  }
716
- var scrollLeft = $scrollContainer.scrollLeft();
790
+ var scrollLeft = (responsive ? $responsiveContainer : $scrollContainer).scrollLeft();
717
791
  if(!useAbsolutePositioning || oldScrollLeft != scrollLeft){
718
792
  $floatContainer.scrollLeft(scrollLeft);
719
793
  oldScrollLeft = scrollLeft;
@@ -726,14 +800,23 @@
726
800
  */
727
801
  function calculateScrollBarSize(){ //this should happen after the floating table has been positioned
728
802
  if($scrollContainer.length){
729
- if($scrollContainer.data().perfectScrollbar){
803
+ if(opts.support && opts.support.perfectScrollbar && $scrollContainer.data().perfectScrollbar){
730
804
  scrollbarOffset = {horizontal:0, vertical:0};
731
805
  } else {
732
- var sw = $scrollContainer.width(), sh = $scrollContainer.height(), th = $table.height(), tw = tableWidth($table, $fthCells);
733
- var offseth = sw < tw ? scWidth : 0;
734
- var offsetv = sh < th ? scWidth : 0;
735
- scrollbarOffset.horizontal = sw - offsetv < tw ? scWidth : 0;
736
- scrollbarOffset.vertical = sh - offseth < th ? scWidth : 0;
806
+ if($scrollContainer.css('overflow-x') == 'scroll'){
807
+ scrollbarOffset.horizontal = scWidth;
808
+ } else {
809
+ var sw = $scrollContainer.width(), tw = tableWidth($table, $fthCells);
810
+ var offsetv = sh < th ? scWidth : 0;
811
+ scrollbarOffset.horizontal = sw - offsetv < tw ? scWidth : 0;
812
+ }
813
+ if($scrollContainer.css('overflow-y') == 'scroll'){
814
+ scrollbarOffset.vertical = scWidth;
815
+ } else {
816
+ var sh = $scrollContainer.height(), th = $table.height();
817
+ var offseth = sw < tw ? scWidth : 0;
818
+ scrollbarOffset.vertical = sh - offseth < th ? scWidth : 0;
819
+ }
737
820
  }
738
821
  }
739
822
  }
@@ -790,6 +873,31 @@
790
873
  calculateFloatContainerPos = calculateFloatContainerPosFn();
791
874
  repositionFloatContainer(calculateFloatContainerPos('reflow'), true);
792
875
  }, 1);
876
+
877
+ /////// printing stuff
878
+ var beforePrint = function(){
879
+ $table.floatThead('destroy', [true]);
880
+ };
881
+ var afterPrint = function(){
882
+ $table.floatThead(opts);
883
+ };
884
+ var printEvent = function(mql){
885
+ //make printing the table work properly on IE10+
886
+ if(mql.matches) {
887
+ beforePrint();
888
+ } else {
889
+ afterPrint();
890
+ }
891
+ };
892
+ if(window.matchMedia){
893
+ window.matchMedia("print").addListener(printEvent);
894
+ } else {
895
+ $window.on('beforeprint', beforePrint);
896
+ $window.on('afterprint', afterPrint);
897
+ }
898
+ ////// end printing stuff
899
+
900
+
793
901
  if(locked){ //internal scrolling
794
902
  if(useAbsolutePositioning){
795
903
  $scrollContainer.on(eventName('scroll'), containerScrollEvent);
@@ -798,6 +906,7 @@
798
906
  $window.on(eventName('scroll'), windowScrollEvent);
799
907
  }
800
908
  } else { //window scrolling
909
+ $responsiveContainer.on(eventName('scroll'), containerScrollEvent);
801
910
  $window.on(eventName('scroll'), windowScrollEvent);
802
911
  }
803
912
 
@@ -805,15 +914,19 @@
805
914
 
806
915
  windowResize(eventName('resize'), windowResizeEvent);
807
916
  $table.on('reflow', reflowEvent);
808
- if(isDatatable($table)){
917
+ if(opts.support && opts.support.datatables && isDatatable($table)){
809
918
  $table
810
- .on('filter', reflowEvent)
811
- .on('sort', reflowEvent)
812
- .on('page', reflowEvent);
919
+ .on('filter', reflowEvent)
920
+ .on('sort', reflowEvent)
921
+ .on('page', reflowEvent);
813
922
  }
814
923
 
815
- $window.on(eventName('shown.bs.tab'), reflowEvent); // people cant seem to figure out how to use this plugin with bs3 tabs... so this :P
816
- $window.on(eventName('tabsactivate'), reflowEvent); // same thing for jqueryui
924
+ if(opts.support && opts.support.bootstrap) {
925
+ $window.on(eventName('shown.bs.tab'), reflowEvent); // people cant seem to figure out how to use this plugin with bs3 tabs... so this :P
926
+ }
927
+ if(opts.support && opts.support.jqueryUI) {
928
+ $window.on(eventName('tabsactivate'), reflowEvent); // same thing for jqueryui
929
+ }
817
930
 
818
931
 
819
932
  if (canObserveMutations) {
@@ -836,14 +949,14 @@
836
949
  }
837
950
  });
838
951
  mObs.observe(mutationElement, {
839
- childList: true,
840
- subtree: true
952
+ childList: true,
953
+ subtree: true
841
954
  });
842
955
  }
843
956
 
844
957
  //attach some useful functions to the table.
845
958
  $table.data('floatThead-attached', {
846
- destroy: function(){
959
+ destroy: function(e, isPrintEvent){
847
960
  var ns = '.fth-'+floatTheadId;
848
961
  unfloat();
849
962
  $table.css(layoutAuto);
@@ -852,12 +965,14 @@
852
965
  if($newHeader.parent().length){ //only if it's in the DOM
853
966
  $newHeader.replaceWith($header);
854
967
  }
968
+ triggerFloatEvent(false);
855
969
  if(canObserveMutations){
856
970
  mObs.disconnect();
857
971
  mObs = null;
858
972
  }
859
973
  $table.off('reflow reflowed');
860
974
  $scrollContainer.off(ns);
975
+ $responsiveContainer.off(ns);
861
976
  if (wrappedContainer) {
862
977
  if ($scrollContainer.length) {
863
978
  $scrollContainer.unwrap();
@@ -875,6 +990,11 @@
875
990
  $floatContainer.remove();
876
991
  $table.data('floatThead-attached', false);
877
992
  $window.off(ns);
993
+ if(!isPrintEvent){
994
+ //if we are in the middle of printing, we want this event to re-create the plugin
995
+ window.matchMedia && window.matchMedia("print").removeListener(printEvent);
996
+ beforePrint = afterPrint = function(){};
997
+ }
878
998
  },
879
999
  reflow: function(){
880
1000
  reflowEvent();
@@ -898,7 +1018,7 @@
898
1018
  };
899
1019
  })(jQuery);
900
1020
 
901
- /* jQuery.floatThead.utils - http://mkoryak.github.io/floatThead/ - Copyright (c) 2012 - 2014 Misha Koryak
1021
+ /* jQuery.floatThead.utils - http://mkoryak.github.io/floatThead/ - Copyright (c) 2012 - 2016 Misha Koryak
902
1022
  * License: MIT
903
1023
  *
904
1024
  * This file is required if you do not use underscore in your project and you want to use floatThead.