From 600b67814585ad5d1ec7f415c04e0542307d4e12 Mon Sep 17 00:00:00 2001 From: Thorsten Vitt Date: Mon, 10 May 2021 14:32:03 +0200 Subject: [PATCH] Switch to first non-empty search tab. Only happens when we are on the text tab, and after all searches have returned. Fixes #583 --- search.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/search.php b/search.php index 7497c2e..ca30f6d 100644 --- a/search.php +++ b/search.php @@ -218,10 +218,16 @@ document.getElementById("breadcrumbs").appendChild(Faust.createBreadcrumbs([{caption: "Suche"}, {caption: state.current.q}])); // Initially perform the queries - searchTexts(); - searchMetadata(); - searchTestimony(); - searchInfo(); + Promise.all([ + searchTexts(), + searchMetadata(), + searchTestimony(), + searchInfo() + ]).then(function () { + if (state.current.tab == "texts") { + $('.tab-bar [data-badge!="0"]').first().click(); + } + }); } catch (e) { Faust.error('Bug in der interaktiven Suche', e);