function updateMainTable() { var pctTag = $("#primary_change_type option:selected").attr("tag"); var sctTag = $("#secondary_change_type option:selected").attr("tag"); var pmtTag = ($("#incl_premature_changes:checked").length == 1) ? "_pmt" : ""; var divName = "div_mt_" + pctTag + "_" + sctTag + pmtTag; // Hide all main tables but the current one: $('div[id^="div_mt_"]').css("display", "none"); $("#" + divName).css("display", "block"); } function updateRankingTarget() { var pctName = $("#primary_change_type option:selected").attr("singular_name"); $("#last_change").text("Most recent " + pctName); $("#max_change_last_week").text("Strongest " + pctName + " last week"); $("#max_change_last_month").text("Strongest " + pctName + " last month"); $("#max_change_last_6_months").text( "Strongest " + pctName + " last six months"); $("#max_change_ever").text("Strongest " + pctName + " ever"); $("#incl_premature_changes_label").text( "Include premature " + pctName + "s"); updateMainTable(); } function initMainTable(tableSel) { $(tableSel).tablesorter({ headers: { 3: { sorter: "mixed_numeric_desc_before_missing" }, // rank pos 0 4: { sorter: false }, // 1 5: { sorter: false }, // 2 6: { sorter: false }, // 3 7: { sorter: false }, // 4 8: { sorter: false }, // 5 9: { sorter: false }, // 6 10: { sorter: false }, // 7 11: { sorter: false }, // 8 12: { sorter: false } // 9 } }); // // Note: The nth-child selector below uses 1-based indexing! // setTooltip($(tableSel).find("th:nth-child(2)"), tooltipText_ms()); // setTooltip($(tableSel).find("th:nth-child(3)"), tooltipText_lsd()); // setTooltip($(tableSel).find("th:nth-child(4)"), tooltipText_ni()); // setTooltip($(tableSel).find("th:nth-child(5)"), tooltipText_nz()); // setTooltip($(tableSel).find("th:nth-child(6)"), tooltipText_nc()); // setTooltip($(tableSel).find("th:nth-child(7)"), tooltipText_mdrse()); // setTooltip($(tableSel).find("th:nth-child(8)"), tooltipText_rsemd()); // setTooltip($(tableSel).find("th:nth-child(9)"), tooltipText_qs()); // setTooltip($(tableSel).find("th:nth-child(10)"), tooltipText_lc()); // setTooltip($(tableSel).find("th:nth-child(11)"), tooltipText_lcda()); // setTooltip($(tableSel).find("th:nth-child(12)"), tooltipText_lcms()); // setTooltip($(tableSel).find("th:nth-child(13)"), tooltipText_lcss()); // setTooltip($(tableSel).find("th:nth-child(14)"), tooltipText_lcss1()); // setTooltip($(tableSel).find("th:nth-child(15)"), tooltipText_lcgss()); // setTooltip($(tableSel).find("th:nth-child(16)"), tooltipText_lclss()); // setTooltip($(tableSel).find("th:nth-child(17)"), tooltipText_lcds1()); // setTooltip($(tableSel).find("th:nth-child(18)"), tooltipText_lcds2()); // $(tableSel).bind("sortStart",function() { // $("#pbmTable_sortInProgress").show(); // }).bind("sortEnd",function() { // $("#pbmTable_sortInProgress").hide(); // }); } $(document).ready(function() { initTablesorter(); // Initialize all main tables: $('table[id^="mt_"]').each(function() { initMainTable("#" + $(this).attr("id")); }); // Initialize ranking target: $("#primary_change_type option[singular_name='regression']").attr( "selected", true); $("#incl_premature_changes").attr("checked", false) updateRankingTarget(); fetchContexts(); });