/** * Toggles the table footer icon. * * @param {Object} footer */ function toggleFooter(footer) { if (footer.find("i").hasClass("icon-chevron-down")) { footer.find("i").removeClass("icon-chevron-down").addClass("icon-chevron-up"); } else { footer.find("i").removeClass("icon-chevron-up").addClass("icon-chevron-down"); } } function setBackground(table) { $(table).find(".table").each(function() { $(this).find(".table-row").not(".separator").filter(":even").each(function() { $(this).addClass("table-row-striped"); }); }); } /** * Table footer function. */ $("#content").on("click", ".standings-table .footer", function(e) { $(this).closest(".standings-table").find(".table-hide").slideToggle(1500); $(this).closest(".standings-table").find(".separator").slideToggle(1500); setTimeout(toggleFooter, 1500, $(this)); }); /** * Day table navigation */ $("#content").on("click", ".day-nav", function(e) { var a = $(this); $.ajax({ type: "GET", cache: false, dataType: "html", url: $(this).attr('href') + "/1", success: function(data) { var condensed = a.closest(".standings-table").find(".footer i").hasClass("icon-chevron-down"); var data = $(data); if (!condensed) { data.find(".separator").hide(); data.find(".table-hide").show(); toggleFooter(data.find(".footer")); } setBackground(data); a.closest(".standings-table").parent().html(data); } }); return false; }); /** * Footer tooltip */ $(".footer").tooltip({delay: 500}); $(".standings-table").each(function() { setBackground($(this)); });