From 33fdd0cc9b2e2bc8e61e3993fa6ecea0028d6a19 Mon Sep 17 00:00:00 2001 From: mic Date: Fri, 2 Jan 2026 09:54:04 +0100 Subject: [PATCH] correctyl showing and hiding api settings elements. see #102 --- pages/_lib/connection-ui.js | 16 ++++++++-------- pages/customprompts/mzta-custom-prompts.js | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pages/_lib/connection-ui.js b/pages/_lib/connection-ui.js index 485f6f1e..f5d39800 100644 --- a/pages/_lib/connection-ui.js +++ b/pages/_lib/connection-ui.js @@ -1132,28 +1132,28 @@ export function showConnectionOptions(conntype_select, modelId_prefix = '') { }else{ anthropic_api_display = 'none'; } - document.querySelectorAll(".conntype_chatgpt_web").forEach(element => { + parent.parentElement.querySelectorAll(".conntype_chatgpt_web").forEach(element => { element.style.display = chatgpt_web_display; }); - document.querySelectorAll(".conntype_chatgpt_api").forEach(element => { + parent.parentElement.querySelectorAll(".conntype_chatgpt_api").forEach(element => { element.style.display = chatgpt_api_display; }); - document.querySelectorAll(".conntype_ollama_api").forEach(element => { + parent.parentElement.querySelectorAll(".conntype_ollama_api").forEach(element => { element.style.display = ollama_api_display; }); - document.querySelectorAll(".conntype_openai_comp_api").forEach(element => { + parent.parentElement.querySelectorAll(".conntype_openai_comp_api").forEach(element => { element.style.display = openai_comp_api_display; }); - document.querySelectorAll(".conntype_google_gemini_api").forEach(element => { + parent.parentElement.querySelectorAll(".conntype_google_gemini_api").forEach(element => { element.style.display = google_gemini_api_display; }); - document.querySelectorAll(".conntype_anthropic_api").forEach(element => { + parent.parentElement.querySelectorAll(".conntype_anthropic_api").forEach(element => { element.style.display = anthropic_api_display; }); if (varConnectionUI.permission_all_urls) { - const openaiCompWarning = document.getElementById((modelId_prefix ? modelId_prefix : '') + 'openai_comp_api_cors_warning'); + const openaiCompWarning = parent.parentElement.getElementById((modelId_prefix ? modelId_prefix : '') + 'openai_comp_api_cors_warning'); if (openaiCompWarning) openaiCompWarning.style.display = 'none'; - const ollamaWarning = document.getElementById((modelId_prefix ? modelId_prefix : '') + 'ollama_api_cors_warning'); + const ollamaWarning = parent.parentElement.getElementById((modelId_prefix ? modelId_prefix : '') + 'ollama_api_cors_warning'); if (ollamaWarning) ollamaWarning.style.display = 'none'; } } diff --git a/pages/customprompts/mzta-custom-prompts.js b/pages/customprompts/mzta-custom-prompts.js index d24c26e9..33d2159c 100644 --- a/pages/customprompts/mzta-custom-prompts.js +++ b/pages/customprompts/mzta-custom-prompts.js @@ -245,13 +245,13 @@ document.addEventListener('DOMContentLoaded', async () => { document.querySelectorAll('.api_additional_info_toggle').forEach(element => { element.addEventListener('click', (e) => { e.preventDefault(); - let additionalInfoRow = e.target.closest('td').querySelector('.api_additional_info'); + let additionalInfoRow = element.nextElementSibling; if (additionalInfoRow.style.display === 'none' || additionalInfoRow.style.display === '') { additionalInfoRow.style.display = 'block'; - e.target.innerText = browser.i18n.getMessage('customPrompts_hide_additional_info') + ' [API]'; + element.innerText = browser.i18n.getMessage('customPrompts_hide_additional_info') + ' [API]'; } else { additionalInfoRow.style.display = 'none'; - e.target.innerText = browser.i18n.getMessage('customPrompts_show_additional_info') + ' [API]'; + element.innerText = browser.i18n.getMessage('customPrompts_show_additional_info') + ' [API]'; } }); });