(function(c){c.fn.stupidtable=function(b){return this.each(function(){var a=c(this);b=b||{};b=c.extend({},c.fn.stupidtable.default_sort_fns,b);a.data("sortFns",b);a.on("click.stupidtable","thead th",function(){c(this).stupidsort()});a.find("th[data-sort-onload=yes]").eq(0).stupidsort()})};c.fn.stupidsort=function(b){var a=c(this),g=0,f=c.fn.stupidtable.dir,d=a.closest("table"),k=a.data("sort")||null;if(null!==k){a.parents("tr").find("th").slice(0,c(this).index()).each(function(){var a=c(this).attr("colspan")||
1;g+=parseInt(a,10)});var e;1==arguments.length?e=b:(e=b||a.data("sort-default")||f.ASC,a.data("sort-dir")&&(e=a.data("sort-dir")===f.ASC?f.DESC:f.ASC));a.data("sort-dir",e);d.trigger("beforetablesort",{column:g,direction:e,$th:a});d.css("display");setTimeout(function(){var b=[],l=d.data("sortFns")[k],h=d.children("tbody").children("tr");h.each(function(a,e){var d=c(e).children().eq(g),f=d.data("sort-value");"undefined"===typeof f&&(f=d.text(),d.data("sort-value",f));b.push([f,e,a])});b.sort(function(a,
b){var c=l(a[0],b[0]);return 0===c?a[2]-b[2]:c});e!=f.ASC&&b.reverse();h=c.map(b,function(a){return a[1]});d.children("tbody").append(h);d.find("th").data("sort-dir",null).removeClass("sorting-desc sorting-asc");a.data("sort-dir",e).addClass("sorting-"+e);d.trigger("aftertablesort",{column:g,direction:e,$th:a});d.css("display")},10);return a}};c.fn.updateSortVal=function(b){var a=c(this);a.is("[data-sort-value]")&&a.attr("data-sort-value",b);a.data("sort-value",b);return a};c.fn.stupidtable.dir={ASC:"asc",
DESC:"desc"};c.fn.stupidtable.default_sort_fns={"int":function(b,a){return parseInt(b,10)-parseInt(a,10)},"float":function(b,a){return parseFloat(b)-parseFloat(a)},string:function(b,a){return b.toString().localeCompare(a.toString())},"string-ins":function(b,a){b=b.toString().toLocaleLowerCase();a=a.toString().toLocaleLowerCase();return b.localeCompare(a)}}})(jQuery);

(function(c){c.fn.stupidtable=function(b){return this.each(function(){var a=c(this);b=b||{};b=c.extend({},c.fn.stupidtable.default_sort_fns,b);a.data("sortFns",b);a.on("click.stupidtable","thead th",function(){c(this).stupidsort()});a.find("th[data-sort-onload=yes]").eq(0).stupidsort()})};c.fn.stupidtable_settings=function(b){return this.each(function(){var a=c(this),g=c.extend({},c.fn.stupidtable.default_settings,b);a.stupidtable.settings=g})};c.fn.stupidsort=function(b){var a=c(this),g=0,f=c.fn.stupidtable.dir,
d=a.closest("table"),h=a.data("sort")||null;d.stupidtable.settings||(d.stupidtable.settings=c.extend({},c.fn.stupidtable.default_settings));if(null!==h){var l=d.data("sortFns")[h];a.parents("tr").find("th").slice(0,c(this).index()).each(function(){var a=c(this).attr("colspan")||1;g+=parseInt(a,10)});var e;1==arguments.length?e=b:(e=b||a.data("sort-default")||f.ASC,a.data("sort-dir")&&(e=a.data("sort-dir")===f.ASC?f.DESC:f.ASC));a.data("sort-dir",e);d.trigger("beforetablesort",{column:g,direction:e,
$th:a});d.css("display");setTimeout(function(){var b=[],k=d.children("tbody").children("tr");k.each(function(a,d){var e=c(d).children().eq(g),f=e.data("sort-value");"undefined"===typeof f&&(f=e.text(),e.data("sort-value",f));b.push([f,d,a])});b.sort(function(a,b){var c=l(a[0],b[0]);return 0===c?a[2]-b[2]:c});e!=f.ASC&&b.reverse();d.stupidtable.settings.should_redraw({column:b,sort_dir:e,$th:a,th_index:g,$table:d,datatype:h,compare_fn:l})&&(k=c.map(b,function(a){return a[1]}),d.children("tbody").append(k),
d.find("th").data("sort-dir",null).removeClass("sorting-desc sorting-asc"),a.data("sort-dir",e).addClass("sorting-"+e),d.trigger("aftertablesort",{column:g,direction:e,$th:a}),d.css("display"))},10);return a}};c.fn.updateSortVal=function(b){var a=c(this);a.is("[data-sort-value]")&&a.attr("data-sort-value",b);a.data("sort-value",b);return a};c.fn.stupidtable.default_settings={should_redraw:function(b){return!0}};c.fn.stupidtable.dir={ASC:"asc",DESC:"desc"};c.fn.stupidtable.default_sort_fns={"int":function(b,
a){return parseInt(b,10)-parseInt(a,10)},"float":function(b,a){return parseFloat(b)-parseFloat(a)},string:function(b,a){return b.toString().localeCompare(a.toString())},"string-ins":function(b,a){b=b.toString().toLocaleLowerCase();a=a.toString().toLocaleLowerCase();return b.localeCompare(a)}}})(jQuery);

Update minified version