custom prompts form improved

This commit is contained in:
Mic 2025-04-24 01:52:00 +02:00
parent d1fa3b3cbf
commit 0f543ab885
4 changed files with 43 additions and 39 deletions

View file

@ -1414,5 +1414,9 @@
"prefs_OptionText_chatgpt_web_custom_data_info2": {
"message": "You can find the correct value in the browser URL field when you open the related ChatGPT page.",
"description": ""
},
"customPrompts_Properties": {
"message": "Properties",
"description": ""
}
}

View file

@ -135,6 +135,15 @@ table .sort.desc {
font-style: italic;
}
.field_title{
font-weight: bold;
}
.field_title_s{
font-weight: bold;
font-size: small;
}
#txtIdNew, .id_output{
text-transform: lowercase;
}

View file

@ -27,29 +27,39 @@
<table class="width_all">
<tr>
<td class="w19">
<label for="txtIdNew">*__MSG_customPrompts_form_label_ID__:</label>
<label for="txtIdNew" class="field_title">*__MSG_customPrompts_form_label_ID__:</label>
<br>
<input type="text" id="txtIdNew" name="id" class="input_new" tabindex="1">
<br><span class="small_label">[__MSG_customPrompts_form_label_ID_rules__]</span>
</td>
<td rowspan="2" class="w25">
<label for="txtTextNew">*__MSG_customPrompts_form_label_Text__:</label>
<label for="txtTextNew" class="field_title">*__MSG_customPrompts_form_label_Text__:</label>
<br>
<div class="autocomplete-container">
<textarea id="txtTextNew" name="text" class="input_new text_output editor" tabindex="3"></textarea>
<ul class="autocomplete-list hidden"></ul>
</div>
</td>
<td class="w19">
<label for="selectTypeNew">__MSG_customPrompts_add_to_menu__:</label>
<td rowspan="2" class="w19">
<label for="selectTypeNew" class="field_title">__MSG_customPrompts_add_to_menu__:</label>
<br>
<select id="selectTypeNew" name="type" tabindex="4" class="type_output">
<option value="0">__MSG_customPrompts_add_to_menu_always__</option>
<option value="1">__MSG_customPrompts_add_to_menu_reading__</option>
<option value="2">__MSG_customPrompts_add_to_menu_composing__</option>
</select>
<br><br>
<label for="selectActionNew" class="field_title">__MSG_customPrompts_form_label_Action__:</label>
<br>
<select id="selectActionNew" name="action" tabindex="5">
<option value="0">__MSG_customPrompts_close_button__</option>
<option value="1">__MSG_customPrompts_do_reply__</option>
<option value="2">__MSG_customPrompts_substitute_text__</option>
</select>
</td>
<td rowspan="2" class="w19">
<label class="field_title">__MSG_customPrompts_Properties__:</label>
<br>
<span class="need_selected_span"><input type="checkbox" id="checkboxNeedSelectedNew" name="need_selected" class="need_selected_new" value="1" tabindex="6"> <label for="checkboxNeedSelectedNew">__MSG_customPrompts_form_label_need_selected__</label></span>
<br>
<input type="checkbox" id="checkboxNeedSignatureNew" name="need_signature" value="1" tabindex="7"> <label for="checkboxNeedSignatureNew">__MSG_customPrompts_form_label_need_signature__</label>
@ -63,19 +73,10 @@
</tr>
<tr>
<td class="w19">
<label for="txtNameNew">*__MSG_customPrompts_form_label_Name__:</label>
<label for="txtNameNew" class="field_title">*__MSG_customPrompts_form_label_Name__:</label>
<br>
<input type="text" id="txtNameNew" name="name" class="input_new" tabindex="2">
</td>
<td class="w19">
<label for="selectActionNew">__MSG_customPrompts_form_label_Action__:</label>
<br>
<select id="selectActionNew" name="action" tabindex="5">
<option value="0">__MSG_customPrompts_close_button__</option>
<option value="1">__MSG_customPrompts_do_reply__</option>
<option value="2">__MSG_customPrompts_substitute_text__</option>
</select>
</td>
</tr>
</table>
<div class="go_right_float">* __MSG_customPrompts_form_required_fields__</div>
@ -89,8 +90,8 @@
<th class="sort" data-sort="id">__MSG_customPrompts_form_label_ID__</th>
<th class="sort" data-sort="name">__MSG_customPrompts_form_label_Name__</th>
<th class="sort" data-sort="text">__MSG_customPrompts_form_label_Text__</th>
<th class="sort" data-sort="type">__MSG_customPrompts_add_to_menu__</th>
<th>Properties</th>
<th>&nbsp;</th>
<th>__MSG_customPrompts_Properties__</th>
<th>&nbsp;</th>
</tr>
</thead>

View file

@ -98,20 +98,6 @@ document.addEventListener('DOMContentLoaded', async () => {
});
});
// document.addEventListener('click', (e) => {
// // Check if the click was outside the textarea or suggestion list
// const isClickInsideTextarea = e.target.closest('.editor');
// const isClickInsideAutocompleteList = e.target.closest('.autocomplete-list');
// if (!isClickInsideTextarea && !isClickInsideAutocompleteList) {
// textareas.forEach(textarea => {
// const container = textarea.closest('.autocomplete-container');
// const autocompleteList = container.querySelector('.autocomplete-list');
// hideSuggestions(autocompleteList);
// });
// }
// });
i18n.updateDocument();
//To add a new item
@ -452,23 +438,27 @@ function loadPromptsList(values){
<td class="w08"><span class="id id_show"></span><input type="text" class="hiddendata id_output" value="` + values.id + `" /></td>
<td class="w08"><span class="name name_show"></span><input type="text" class="hiddendata name_output" value="` + values.name + `" /></td>
<td class="w40"><span class="text text_show"></span><div class="autocomplete-container"><textarea class="hiddendata text_output editor">` + values.text.replace(/<br\s*\/?>/gi, "\n") + `</textarea><ul class="autocomplete-list hidden"></ul></div></td>
<td class="w08"><span class="type_show">` + type_output + `</span>
<td class="w08"><span class="field_title_s">__MSG_customPrompts_add_to_menu__:</span>
<br>
<span class="type_show">` + type_output + `</span>
<select class="type_output hiddendata">
<option value="0"` + ((values.type == "0") ? ' selected':'') + `>__MSG_customPrompts_add_to_menu_always__</option>
<option value="1"` + ((values.type == "1") ? ' selected':'') + `>__MSG_customPrompts_add_to_menu_reading__</option>
<option value="2"` + ((values.type == "2") ? ' selected':'') + `>__MSG_customPrompts_add_to_menu_composing__</option>
</select>` +
`<span class="type hiddendata"></span>
<br><br>
<span class="field_title_s">__MSG_customPrompts_form_label_Action__:</span>
<br><span class="action_show">` + action_output + `</span>
<select class="action_output hiddendata">
<option value="0"` + ((values.action == "0") ? ' selected':'') + `>__MSG_customPrompts_close_button__</option>
<option value="1"` + ((values.action == "1") ? ' selected':'') + `>__MSG_customPrompts_do_reply__</option>
<option value="2"` + ((values.action == "2") ? ' selected':'') + `>__MSG_customPrompts_substitute_text__</option>
</select>` +
`<span class="action hiddendata"></span>
</td>
<td class="w17">
Action: <span class="action_show">` + action_output + `</span>
<select class="action_output hiddendata">
<option value="0"` + ((values.action == "0") ? ' selected':'') + `>__MSG_customPrompts_close_button__</option>
<option value="1"` + ((values.action == "1") ? ' selected':'') + `>__MSG_customPrompts_do_reply__</option>
<option value="2"` + ((values.action == "2") ? ' selected':'') + `>__MSG_customPrompts_substitute_text__</option>
</select>` +
`<span class="action hiddendata"></span>
<br>
<label><span class="need_selected_span"><input type="checkbox" class="need_selected" disabled> __MSG_customPrompts_form_label_need_selected__</span></label>
<br>
<label><input type="checkbox" class="need_signature" disabled> __MSG_customPrompts_form_label_need_signature__</label>