Move validation function for ChatGPT web custom data to the utils js file and update imports
This commit is contained in:
parent
2e22cea996
commit
504ff391bb
2 changed files with 7 additions and 7 deletions
|
|
@ -424,6 +424,12 @@ export function sanitizeChatGPTWebCustomData(input) {
|
|||
return input.replace(/[^\p{L}\p{N}\/-]+/gu, '');
|
||||
}
|
||||
|
||||
export function validateCustomData_ChatGPTWeb(event) {
|
||||
let is_valid = validateChatGPTWebCustomData(event.target.value);
|
||||
event.target.style.borderColor = is_valid ? 'green' : 'red';
|
||||
document.getElementById(event.target.id + '_info').style.color = is_valid ? '' : 'red';
|
||||
}
|
||||
|
||||
// The following methods are a modified version derived from https://github.com/ali-raheem/Aify/blob/13ff87583bc520fb80f555ab90a90c5c9df797a7/plugin/content_scripts/compose.js
|
||||
|
||||
const insertHtml = function (replyHtml, fullBody_string) {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import { OpenAI } from '../js/api/openai.js';
|
|||
import { Ollama } from '../js/api/ollama.js';
|
||||
import { OpenAIComp } from '../js/api/openai_comp.js'
|
||||
import { GoogleGemini } from '../js/api/google_gemini.js';
|
||||
import { checkSparksPresence, isThunderbird128OrGreater, openTab, validateChatGPTWebCustomData, sanitizeChatGPTModelData, sanitizeChatGPTWebCustomData } from '../js/mzta-utils.js';
|
||||
import { checkSparksPresence, isThunderbird128OrGreater, openTab, validateChatGPTWebCustomData, sanitizeChatGPTModelData, sanitizeChatGPTWebCustomData, validateCustomData_ChatGPTWeb } from '../js/mzta-utils.js';
|
||||
|
||||
let taLog = new taLogger("mzta-options",true);
|
||||
let _isThunderbird128OrGreater = true;
|
||||
|
|
@ -313,12 +313,6 @@ async function disable_GetCalendarEvent(){
|
|||
wrong_sparks_text.style.display = (is_spark_present == 0) ? 'inline' : 'none';
|
||||
}
|
||||
|
||||
function validateCustomData_ChatGPTWeb(event) {
|
||||
let is_valid = validateChatGPTWebCustomData(event.target.value);
|
||||
event.target.style.borderColor = is_valid ? 'green' : 'red';
|
||||
document.getElementById(event.target.id + '_info').style.color = is_valid ? '' : 'red';
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
await restoreOptions();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue