Skip to content

Commit 51b49fa

Browse files
Fix button position.
1 parent e4e183b commit 51b49fa

File tree

2 files changed

+63
-1
lines changed

2 files changed

+63
-1
lines changed

Diff for: form.html

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<html>
2+
<body>
3+
<style>
4+
#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;}
5+
#aiform input {padding: 0.5rem; margin: 0.5rem 0.7rem; border: 1px solid #aaa; width: 300px;}
6+
#aiform .required {color: red;}
7+
</style>
8+
<h1>JSight AI</h1>
9+
<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>
60+
</div>
61+
</body>
62+
</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-right: 20px; 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": "<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>"
66
},
77
{
88
"id": "R3-jotform-script",

0 commit comments

Comments
 (0)