From a2bc2a751636da34e1676b273346d744046e5205 Mon Sep 17 00:00:00 2001 From: Jaifroid Date: Thu, 22 Dec 2022 15:05:06 +0000 Subject: [PATCH] Match Kiwix JS coding for API panel Former-commit-id: 77d4b0aac60bae01e768d6df4fdfa3c5f798c08b --- www/js/lib/uiUtil.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/www/js/lib/uiUtil.js b/www/js/lib/uiUtil.js index ef529694..eb750b34 100644 --- a/www/js/lib/uiUtil.js +++ b/www/js/lib/uiUtil.js @@ -837,7 +837,7 @@ define(rqDef, function(util) { params.decompressorAPI.assemblerMachineType = assemblerMachineType; params.decompressorAPI.errorStatus = 'Error loading ' + decoderType + ' decompressor!'; var decompAPI = document.getElementById('decompressorAPIStatus'); - decompAPI.innerHTML = 'Decompressor API: ' + params.decompressorAPI.errorStatus; + decompAPI.textContent = 'Decompressor API: ' + params.decompressorAPI.errorStatus; decompAPI.className = 'apiBroken'; document.getElementById('apiStatusDiv').className = 'panel panel-danger'; } @@ -845,9 +845,11 @@ define(rqDef, function(util) { // Reports the search provider to the API Status Panel function reportSearchProviderToAPIStatusPanel(provider) { var providerAPI = document.getElementById('searchProviderStatus'); - providerAPI.innerHTML = 'Search Provider: ' + (/^fulltext/.test(provider) ? 'Title + Xapian [' + provider + ']' : - /^title/.test(provider) ? 'Title only [' + provider + ']' : 'Not initialized'); - providerAPI.className = /^fulltext/.test(provider) ? 'apiAvailable' : !/ERROR/.test(provider) ? 'apiUnavailable' : 'apiBroken'; + if (providerAPI) { // NB we need this so that tests don't fail + providerAPI.textContent = 'Search Provider: ' + (/^fulltext/.test(provider) ? 'Title + Xapian [' + provider + ']' : + /^title/.test(provider) ? 'Title only [' + provider + ']' : 'Not initialized'); + providerAPI.className = /^fulltext/.test(provider) ? 'apiAvailable' : !/ERROR/.test(provider) ? 'apiUnavailable' : 'apiBroken'; + } } /**