!function(a){a.fn.cardtable=function(b){var c=this,d={id:"stacktable small-only",hideOriginal:!0,headIndex:0},e=a.extend({},d,b);return headIndex=b&&b.headIndex?b.headIndex:0,c.each(function(){if($table=a(this),!$table.hasClass("stacktable")){var b=a(this).prop("class"),c=a("
");"undefined"!=typeof e.myClass&&c.addClass(e.myClass);var d="";$table.addClass("stacktable large-only"),$caption=$table.find("caption").clone(),$topRow=$table.find("tr").eq(0),$table.find("tbody tr").each(function(){headMarkup="",bodyMarkup="",tr_class=a(this).prop("class"),a(this).find("td,th").each(function(b){""!==a(this).html()&&(bodyMarkup+='',bodyMarkup+=$topRow.find("td,th").eq(b).html()?'| '+$table.find("thead th").eq(b).html()+" | ":' | ',bodyMarkup+=''+a(this).html()+" | ",bodyMarkup+="
")}),d+=''+headMarkup+bodyMarkup+"
"}),$table.find("tfoot tr td").each(function(c,f){""!==a.trim(a(f).text())&&(d+='")}),c.prepend($caption),c.append(a(d)),$table.before(c),e.hideOriginal||$table.show()}})},a.fn.stacktable=function(b){var c=this,d={id:"stacktable small-only",hideOriginal:!0,headIndex:0},e=a.extend({},d,b);return headIndex=b&&b.headIndex?b.headIndex:0,c.each(function(){var b=a(this).prop("class"),c=a('');"undefined"!=typeof e.myClass&&c.addClass(e.myClass);var d="";$table=a(this),$table.addClass("stacktable large-only"),$caption=$table.find("caption").clone(),$topRow=$table.find("tr").eq(0),$table.find("tr").each(function(b){headMarkup="",bodyMarkup="",tr_class=a(this).prop("class"),0===b?d+='| '+a(this).find("th,td").eq(headIndex).html()+" |
":(a(this).find("td,th").each(function(b){b===headIndex?headMarkup='| '+a(this).html()+" |
":""!==a(this).html()&&(bodyMarkup+='',bodyMarkup+=$topRow.find("td,th").eq(b).html()?'| '+$topRow.find("td,th").eq(b).html()+" | ":' | ',bodyMarkup+=''+a(this).html()+" | ",bodyMarkup+="
")}),d+=headMarkup+bodyMarkup)}),c.prepend($caption),c.append(a(d)),$table.before(c),e.hideOriginal||$table.show()})},a.fn.stackcolumns=function(b){var c=this,d={id:"stacktable small-only",hideOriginal:!0},e=a.extend({},d,b);return c.each(function(){$table=a(this);var b=$table.find("tr").eq(0).find("td,th").length;if(!(3>b)){var c=a('');"undefined"!=typeof e.myClass&&c.addClass(e.myClass),$table.addClass("stacktable large-only");for(var d=a(""),f=1;b>f;)$table.find("tr").each(function(b){var e=a("
");0===b&&e.addClass("st-head-row st-head-row-main"),first=a(this).find("td,th").eq(0).clone().addClass("st-key");var g=f;if(a(this).find("*[colspan]").length){var h=0;a(this).find("td,th").each(function(){var d=a(this).attr("colspan");return d?(d=parseInt(d,10),g-=d-1,h+d>f&&(g+=h+d-f-1),h+=d):h++,h>f?!1:void 0})}second=a(this).find("td,th").eq(g).clone().addClass("st-val").removeAttr("colspan"),e.append(first,second),d.append(e)}),++f;c.append(a(d)),$table.before(c),e.hideOriginal||$table.show()}})}}(jQuery);