the api settings table container is now in the html page. see #102

This commit is contained in:
mic 2026-01-02 10:21:47 +01:00
parent 92fba4a1b3
commit 56362266e2
2 changed files with 7 additions and 31 deletions

View file

@ -109,7 +109,11 @@
</tr> </tr>
<tr id="api_additional_info" style="display: none;"><!-- API settings additional info --> <tr id="api_additional_info" style="display: none;"><!-- API settings additional info -->
<td colspan="5" id="api_ui_container"> <td colspan="5" id="api_ui_container">
</td> <table style="width: 100%; text-align: left;">
<tr id="api_ui_anchor">
</tr>
</table>
</td>
</tr> </tr>
</table> </table>
<div class="go_right_float">* __MSG_customPrompts_form_required_fields__</div> <div class="go_right_float">* __MSG_customPrompts_form_required_fields__</div>

View file

@ -125,8 +125,6 @@ document.addEventListener('DOMContentLoaded', async () => {
}); });
}); });
i18n.updateDocument();
const apiSettingsToggle = document.getElementById('api_additional_info_toggle'); const apiSettingsToggle = document.getElementById('api_additional_info_toggle');
const apiSettingsRow = document.getElementById('api_additional_info'); const apiSettingsRow = document.getElementById('api_additional_info');
@ -141,34 +139,6 @@ document.addEventListener('DOMContentLoaded', async () => {
} }
}); });
const apiTable = document.createElement('table');
apiTable.style.width = '100%';
apiTable.style.textAlign = 'left';
const tr = document.createElement('tr');
tr.id = 'api_ui_anchor';
const td1 = document.createElement('td');
td1.classList.add('w30');
td1.textContent = browser.i18n.getMessage('prefs_Connection_type') + ':';
const td2 = document.createElement('td');
const select = document.createElement('select');
select.id = 'new_prompt_api_type';
select.classList.add('input_new');
const option = document.createElement('option');
option.value = '';
option.textContent = '-- ' + browser.i18n.getMessage('Custom') + ' --';
select.appendChild(option);
td2.appendChild(select);
tr.appendChild(td1);
tr.appendChild(td2);
apiTable.appendChild(tr);
document.getElementById('api_ui_container').appendChild(apiTable);
await injectConnectionUI({ await injectConnectionUI({
afterTrId: 'api_ui_anchor', afterTrId: 'api_ui_anchor',
selectId: 'new_prompt_api_type', selectId: 'new_prompt_api_type',
@ -176,6 +146,8 @@ document.addEventListener('DOMContentLoaded', async () => {
taLog: taLog taLog: taLog
}); });
i18n.updateDocument();
const apiSelect = document.getElementById('new_prompt_api_type'); const apiSelect = document.getElementById('new_prompt_api_type');
// Remove chatgpt_web // Remove chatgpt_web
// for (let i = 0; i < apiSelect.options.length; i++) { // for (let i = 0; i < apiSelect.options.length; i++) {