upd: scripts

- add check for escape key and input validation for new speaker and series
This commit is contained in:
2025-08-11 12:53:03 -04:00
parent 44a8a72219
commit f6b4aeea83

View File

@@ -305,7 +305,12 @@ function newSpeaker() {
* @return {Promise} A Promise that resolves with the results of the fetch request.
*/
function saveSpeaker(event) {
if (event.keyCode == 13) {
if (event.keyCode == 27) {
document.querySelector('#newSpeaker').style.display = 'none';
document.querySelector('#speaker').style.display = 'inline-block';
document.querySelector('#speaker').value = 0;
}
if (event.keyCode == 13 && document.querySelector('#newSpeaker').value != '') {
fetch('/save-speaker', {
method: 'POST',
headers: {
@@ -352,7 +357,12 @@ function newSeries() {
* @return {Promise} A Promise that resolves with the response from the server.
*/
function saveSeries(event) {
if (event.keyCode == 13) {
if (event.keyCode == 27) {
document.querySelector('#newSeries').style.display = 'none';
document.querySelector('#series').style.display = 'inline-block';
document.querySelector('#series').value = 0;
}
if (event.keyCode == 13 && document.querySelector('#newSeries').value != '') {
fetch('/save-series', {
method: 'POST',
headers: {