Skip to content

Commit 04bd757

Browse files
Fixes for React.
1 parent 51b49fa commit 04bd757

File tree

3 files changed

+47
-51
lines changed

3 files changed

+47
-51
lines changed

Diff for: code.js

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
const name = document.getElementById('aiform-name').value;
2+
const email = document.getElementById('aiform-email').value;
3+
4+
if(name == '')
5+
{
6+
alert('Fill your name!');
7+
return false;
8+
}
9+
if(email == '')
10+
{
11+
alert('Fill your email!');
12+
return false;
13+
}
14+
15+
const data = { name: name, email: email };
16+
17+
fetch('https://jsightforms-ce0e.restdb.io/rest/aiform', {
18+
method: 'POST',
19+
headers: {
20+
'Content-Type': 'application/json',
21+
'x-apikey': '63f3ae20478852088da684cf',
22+
},
23+
body: JSON.stringify(data),
24+
})
25+
.then((response) => response.json())
26+
.then((data) => {
27+
console.log('Success:', data);
28+
})
29+
.catch((error) => {
30+
console.error('Error:', error);
31+
return false;
32+
});
33+
34+
document.getElementById('jsightai-form').innerHTML = '<p>Your API improvement request has been submitted. JSight API will send you the response soon.</p>';
35+
36+
return false;

Diff for: form.html

+10-50
Original file line numberDiff line numberDiff line change
@@ -7,56 +7,16 @@
77
</style>
88
<h1>JSight AI</h1>
99
<div id='jsightai-form'>
10-
<p>Our smart JSight AI can automatically improve your <b>“GYM REST API”</b> API design. <br />Please fill the form below and press the “Improve API” button. JSight AI will send the improved API version to your email.</p>
11-
<div>
12-
<form id='aiform'>
13-
<label for='aiform-name'>Name <span class='required'>*</span></label>
14-
<input type='text' id='aiform-name'/><br/>
15-
<label for='aiform-email'>Email <span class='required'>*</span></label>
16-
<input type='text' id='aiform-email'/><br/>
17-
<button onclick='return aiformOnclick();'>Improve API</button>
18-
</form>
19-
</div>
20-
<script type='text/javascript'>
21-
function aiformOnclick() {
22-
const name = document.getElementById('aiform-name').value;
23-
const email = document.getElementById('aiform-email').value;
24-
25-
if(name == '')
26-
{
27-
alert('Fill your name!');
28-
return false;
29-
}
30-
if(email == '')
31-
{
32-
alert('Fill your email!');
33-
return false;
34-
}
35-
36-
const data = { name: name, email: email };
37-
38-
fetch('https://jsightforms-ce0e.restdb.io/rest/aiform', {
39-
method: 'POST',
40-
headers: {
41-
'Content-Type': 'application/json',
42-
'x-apikey': '63f3ae20478852088da684cf',
43-
},
44-
body: JSON.stringify(data),
45-
})
46-
.then((response) => response.json())
47-
.then((data) => {
48-
console.log('Success:', data);
49-
})
50-
.catch((error) => {
51-
console.error('Error:', error);
52-
return false;
53-
});
54-
55-
document.getElementById('jsightai-form').innerHTML = '<p>Your API improvement request has been submitted. JSight API will send you the response soon.</p>';
56-
57-
return false;
58-
}
59-
</script>
10+
<p>Our smart JSight AI can automatically improve your <b>“GYM REST API”</b> API design. <br />Please fill the form below and press the “Improve API” button. JSight AI will send the improved API version to your email.</p>
11+
<div>
12+
<form id='aiform'>
13+
<label for='aiform-name'>Name <span class='required'>*</span></label>
14+
<input type='text' id='aiform-name'/><br/>
15+
<label for='aiform-email'>Email <span class='required'>*</span></label>
16+
<input type='text' id='aiform-email'/><br/>
17+
<button onclick="const name = document.getElementById('aiform-name').value; const email = document.getElementById('aiform-email').value; if(name == '') { alert('Fill your name!'); return false; } if(email == '') { alert('Fill your email!'); return false; } const data = { name: name, email: email }; fetch('https://jsightforms-ce0e.restdb.io/rest/aiform', { method: 'POST', headers: { 'Content-Type': 'application/json', 'x-apikey': '63f3ae20478852088da684cf', }, body: JSON.stringify(data), }) .then((response) => response.json()) .then((data) => { console.log('Success:', data); }) .catch((error) => { console.error('Error:', error); return false; }); document.getElementById('jsightai-form').innerHTML = '<p>Your API improvement request has been submitted. JSight API will send you the response soon.</p>'; return false;">Improve API</button>
18+
</form>
19+
</div>
6020
</div>
6121
</body>
6222
</html>

Diff for: online-editor-custom-messages.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{
33
"id": "own",
44
"regex": "editor",
5-
"content": "<style> #aiform button {background: #8338ff; border-radius: 4px; box-shadow: 0 4px 16px rgb(131 56 255 / 25%), 0 0 12px rgb(131 56 255 / 4%), 0 2px 2px rgb(131 56 255 / 5%); color: #fff; font-size: 1.6rem; font-weight: 600; line-height: 2.4rem; margin-top: 1.5rem; padding: 1rem 4.6rem;} #aiform input {padding: 0.5rem; margin: 0.5rem 0.7rem; border: 1px solid #aaa; width: 300px;} #aiform .required {color: red;} </style><h1>JSight AI</h1><div id='jsightai-form'><p>Our smart JSight AI can automatically improve your <b>“GYM REST API”</b> API design. <br />Please fill the form below and press the “Improve API” button. JSight AI will send the improved API version to your email.</p><div><form id='aiform'><label for='aiform-name'>Name <span class='required'>*</span></label><input type='text' id='aiform-name'/><br/><label for='aiform-email'>Email <span class='required'>*</span></label><input type='text' id='aiform-email'/><br/><button onclick='return aiformOnclick();'>Improve API</button></form></div><script type='text/javascript'> function aiformOnclick() { const name = document.getElementById('aiform-name').value; const email = document.getElementById('aiform-email').value; if(name == '') { alert('Fill your name!'); return false; } if(email == '') { alert('Fill your email!'); return false; } const data = { name: name, email: email }; fetch('https://jsightforms-ce0e.restdb.io/rest/aiform', { method: 'POST', headers: { 'Content-Type': 'application/json', 'x-apikey': '63f3ae20478852088da684cf', }, body: JSON.stringify(data), }) .then((response) => response.json()) .then((data) => { console.log('Success:', data); }) .catch((error) => { console.error('Error:', error); return false; }); document.getElementById('jsightai-form').innerHTML = '<p>Your API improvement request has been submitted. JSight API will send you the response soon.</p>'; return false; } </script></div>"
5+
"content": "<html><body><style> #aiform button {background: #8338ff; border-radius: 4px; box-shadow: 0 4px 16px rgb(131 56 255 / 25%), 0 0 12px rgb(131 56 255 / 4%), 0 2px 2px rgb(131 56 255 / 5%); color: #fff; font-size: 1.6rem; font-weight: 600; line-height: 2.4rem; margin-top: 1.5rem; padding: 1rem 4.6rem;} #aiform input {padding: 0.5rem; margin: 0.5rem 0.7rem; border: 1px solid #aaa; width: 300px;} #aiform .required {color: red;} </style><h1>JSight AI</h1><div id='jsightai-form'><p>Our smart JSight AI can automatically improve your <b>“GYM REST API”</b> API design. <br />Please fill the form below and press the “Improve API” button. JSight AI will send the improved API version to your email.</p><div><form id='aiform'><label for='aiform-name'>Name <span class='required'>*</span></label><input type='text' id='aiform-name'/><br/><label for='aiform-email'>Email <span class='required'>*</span></label><input type='text' id='aiform-email'/><br/><button onclick=\"const name = document.getElementById('aiform-name').value; const email = document.getElementById('aiform-email').value; if(name == '') { alert('Fill your name!'); return false; } if(email == '') { alert('Fill your email!'); return false; } const data = { name: name, email: email }; fetch('https://jsightforms-ce0e.restdb.io/rest/aiform', { method: 'POST', headers: { 'Content-Type': 'application/json', 'x-apikey': '63f3ae20478852088da684cf', }, body: JSON.stringify(data), }) .then((response) => response.json()) .then((data) => { console.log('Success:', data); }) .catch((error) => { console.error('Error:', error); return false; }); document.getElementById('jsightai-form').innerHTML = '<p>Your API improvement request has been submitted. JSight API will send you the response soon.</p>'; return false;\">Improve API</button></form></div></div></body></html>"
66
},
77
{
88
"id": "R3-jotform-script",

0 commit comments

Comments
 (0)