From 8382e90659a44092e23e84a5ed0b31d0805d8fa9 Mon Sep 17 00:00:00 2001 From: ElementalAlchemist Date: Sun, 29 Oct 2023 18:51:15 -0500 Subject: [PATCH] Highlight the chapter description field as an error if it contains angle brackets --- thrimbletrimmer/scripts/edit.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/thrimbletrimmer/scripts/edit.js b/thrimbletrimmer/scripts/edit.js index 7a265c2..866d311 100644 --- a/thrimbletrimmer/scripts/edit.js +++ b/thrimbletrimmer/scripts/edit.js @@ -789,6 +789,17 @@ function validateVideoDescription() { } } +function validateChapterDescription(chapterDescField) { + const chapterDesc = chapterDescField.value; + if (chapterDesc.indexOf("<") !== -1 || chapterDesc.indexOf(">") !== -1) { + chapterDescField.classList.add("input-error"); + chapterDescField.title = "Chapter description may not contain angle brackets (< or >)"; + } else { + chapterDescField.classList.remove("input-error"); + chapterDescField.title = ""; + } +} + async function submitVideo() { return sendVideoData("EDITED", false); } @@ -1572,6 +1583,9 @@ function chapterMarkerDefinitionDOM() { descriptionField.type = "text"; descriptionField.classList.add("range-definition-chapter-marker-description"); descriptionField.placeholder = "Description"; + descriptionField.addEventListener("input", (event) => { + validateChapterDescription(descriptionField); + }); const removeButton = document.createElement("img"); removeButton.src = "images/minus.png";