From c0f5b922a63b00afeb95ef2a20f23926fa8bca12 Mon Sep 17 00:00:00 2001 From: BynariStar Date: Wed, 19 Jul 2017 02:23:33 +0300 Subject: [PATCH] Fix dynamic headers function --- .../citra-bs-theme/layouts/game/list.html | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/site/themes/citra-bs-theme/layouts/game/list.html b/site/themes/citra-bs-theme/layouts/game/list.html index 20df2da..7641112 100644 --- a/site/themes/citra-bs-theme/layouts/game/list.html +++ b/site/themes/citra-bs-theme/layouts/game/list.html @@ -107,18 +107,32 @@ list.sort("title", {order: "asc"}); - list.on("updated", function(){ - $("#compatibility-list tbody tr.key").removeClass("key"); - if ($("#compatibility-list thead").find("th.asc[data-sort='title'], th.desc[data-sort='title']").length){ - $("#compatibility-list tbody tr[data-key]").each(function(){ + list.on("updated", function(list){ + var $list = $(list.list); + var $items = $list.children(); + $items.removeClass("key"); + if ('title' == getLastSorted(list)){ + $items.each(function(){ var key = $(this).attr("data-key") - if ($("tr[data-key='" + key + "']:first").is($(this))){ + if ( + $list + .children("[data-key='" + key + "']") + .first() + .is( $(this) ) + ){ $(this).addClass("key"); } }) } }) + function getLastSorted(list){ + var currentSorted = $(list.listContainer).find(".asc, .desc").attr("data-sort"); + if ('undefined' !== typeof currentSorted) + list.lastSorted = currentSorted; + return list.lastSorted; + } + function filterTable(_) { var rating = this.name; var index = this.index;