upd: scripts
- add check for escape key and input validation for new speaker and series
This commit is contained in:
@@ -305,7 +305,12 @@ function newSpeaker() {
|
|||||||
* @return {Promise} A Promise that resolves with the results of the fetch request.
|
* @return {Promise} A Promise that resolves with the results of the fetch request.
|
||||||
*/
|
*/
|
||||||
function saveSpeaker(event) {
|
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', {
|
fetch('/save-speaker', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
@@ -352,7 +357,12 @@ function newSeries() {
|
|||||||
* @return {Promise} A Promise that resolves with the response from the server.
|
* @return {Promise} A Promise that resolves with the response from the server.
|
||||||
*/
|
*/
|
||||||
function saveSeries(event) {
|
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', {
|
fetch('/save-series', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
|
Reference in New Issue
Block a user