/* * jQuery Basic Table * Author: Jerry Low */(function(e){e.fn.basictable=function(t){var n=[],r=function(t,r){r.tableWrap&&t.wrap('
');var s="";t.find("thead tr th").length?s="thead th":t.find("tbody tr th").length?s="tbody tr th":t.find("th").length?s="tr:first th":s="tr:first td",e.each(t.find(s),function(){var t=e(this),r=parseInt(t.attr("colspan"),10)||1,i=t.closest("tr").index();n[i]||(n[i]=[]);for(var s=0;s')}})},s=function(t){e.each(t.find("td"),function(){var t=e(this),n=t.children(".bt-content").html();t.html(n)})},o=function(t,n){n.forceResponsive?e(window).width()<=n.breakpoint?u(t,n):a(t,n):t.removeClass("bt").outerWidth()>t.parent().width()?u(t,n):a(t,n)},u=function(e,t){e.addClass("bt"),t.tableWrap&&e.parent(".bt-wrapper").addClass("active")},a=function(e,t){e.removeClass("bt"),t.tableWrap&&e.parent(".bt-wrapper").removeClass("active")},f=function(e,t){e.find("td").removeAttr("data-th"),t.tableWrap&&e.unwrap(),t.contentWrap&&s(e),e.removeData("basictable")},l=function(e){e.data("basictable")&&o(e,e.data("basictable"))},c=this;if(c.length===0||c.data("basictable"))return c.data("basictable")&&(t=="destroy"?f(c,c.data("basictable")):t==="start"?u(c,c.data("basictable")):t==="stop"?a(c,c.data("basictable")):o(c,c.data("basictable"))),!1;var h=e.extend({},e.fn.basictable.defaults,t),p={breakpoint:h.breakpoint,contentWrap:h.contentWrap,forceResponsive:h.forceResponsive,noResize:h.noResize,tableWrap:h.tableWrap};c.data("basictable",p),r(c,c.data("basictable")),p.noResize||(o(c,c.data("basictable")),e(window).bind("resize.basictable",function(){l(c)}))},e.fn.basictable.defaults={breakpoint:568,contentWrap:!0,forceResponsive:!0,noResize:!1,tableWrap:!1}})(jQuery);