Add toggle functionality for ChatGPT additional properties in custom prompts. see #277 and #168

This commit is contained in:
Mic 2025-04-27 22:10:00 +02:00
parent c33c294ea1
commit 9b170c9982
4 changed files with 37 additions and 1 deletions

View file

@ -1418,5 +1418,13 @@
"customPrompts_Properties": {
"message": "Properties",
"description": ""
},
"customPrompts_show_additional_info": {
"message": "Show ChatGPT additional properties",
"description": ""
},
"customPrompts_hide_additional_info": {
"message": "Hide ChatGPT additional properties",
"description": ""
}
}

View file

@ -227,6 +227,15 @@ table .sort.desc {
cursor: pointer;
}
#chatgpt_web_additional_info_toggle:hover{
background-color: rgb(255, 189, 153);
text-decoration: underline;
}
#chatgpt_web_additional_info_toggle td{
text-align: center;
}
#chatgpt_web_additional_info td{
vertical-align: top;
}

View file

@ -78,7 +78,7 @@
<input type="text" id="txtNameNew" name="name" class="input_new" tabindex="2">
</td>
</tr>
<tr id="chatgpt_web_additional_info_toggle"><td colspan="4"><span class="small_info">Show ChatGPT additional properties</span></td></tr>
<tr id="chatgpt_web_additional_info_toggle"><td colspan="4"><span class="small_info">__MSG_customPrompts_show_additional_info__</span></td></tr>
<tr id="chatgpt_web_additional_info"><!-- ChatGPT Web additional info -->
<td colspan="2">
<label for="chatGPTWebModelNew" class="field_title">__MSG_prefs_OptionText_chatgpt_web_model__:</label>

View file

@ -119,6 +119,25 @@ document.addEventListener('DOMContentLoaded', async () => {
// break;
}
const chatgptWebAdditionalPropToggle = document.getElementById('chatgpt_web_additional_info_toggle');
chatgptWebAdditionalPropToggle.addEventListener('click', (e) => {
e.preventDefault();
const additionalInfoRow = document.getElementById('chatgpt_web_additional_info');
if (additionalInfoRow.style.display === 'none' || additionalInfoRow.style.display === '') {
additionalInfoRow.style.display = 'table-row';
let subspan = chatgptWebAdditionalPropToggle.querySelector('td span');
if (subspan) {
subspan.innerText = browser.i18n.getMessage('customPrompts_hide_additional_info');
}
} else {
additionalInfoRow.style.display = 'none';
let subspan = chatgptWebAdditionalPropToggle.querySelector('td span');
if (subspan) {
subspan.innerText = browser.i18n.getMessage('customPrompts_show_additional_info');
}
}
});
//To add a new item
var txtIdNew = document.getElementById('txtIdNew');