From cf3416de1bdfdb4ecd74e0716806d76d78ffc3dd Mon Sep 17 00:00:00 2001 From: Lorem Ipsum Date: Thu, 21 Jan 2021 15:38:11 +0000 Subject: [PATCH] Add field length check and maxlength to inputs and textareas --- assets/js/index.js | 313 +++++++++++++++++++++++---------------------- 1 file changed, 160 insertions(+), 153 deletions(-) diff --git a/assets/js/index.js b/assets/js/index.js index 9dda1c3..ab92a29 100644 --- a/assets/js/index.js +++ b/assets/js/index.js @@ -150,168 +150,174 @@ window.onload = () => { gui.innerHTML = `

Message content

- +
-

Author

-
-
-
- - -
-
- -
+

Author

+
+
+
+ +
-
- - -
+ + +
-
-

Title

- -
-

Description

-
- -
-

Fields

-
-

Thumbnail

-
-
-
- -
- -
- - - -
-
+
+
+

Title

+ +
+

Description

+
+ +
+

Fields

+
+

Thumbnail

+
+
+
+ +
+ +
+ + + +
-

Image

-
-
-
- -
- -
- - - -
-
+
+

Image

+
+
+
+ +
+ +
+ + + +
- -
-
-
- - -
-
- -
+
+ +
+
+
+ +
-
- - -
`; + +

+
+ + +
`; let fieldsEditor = gui.querySelector('.fields ~ .edit'), addField = `
@@ -352,10 +358,10 @@ window.onload = () => {
- +
- +
@@ -423,6 +429,7 @@ window.onload = () => { document.querySelector('.addField').addEventListener('click', () => { !json.embed && (json.embed = {}); let arr = json.embed.fields || []; + if (arr.length >= 25) return error('Cannot have more than 25 fields', 5000); arr.push({ name: "Field name", value: "Field value", inline: false }); json.embed.fields = arr; update(json); @@ -653,4 +660,4 @@ window.onload = () => { let colrs = document.querySelector('.colrs'); document.querySelector('.pickerToggle').addEventListener('click', () => colrs.classList.toggle('display')); update(json); -}; +}; \ No newline at end of file