forked from ilot/ilot-io
content/join: push javascript to dedicated file
This commit is contained in:
parent
cbd14dc901
commit
4aa8370ec3
8 changed files with 95 additions and 214 deletions
85
basewiki/join.js
Normal file
85
basewiki/join.js
Normal file
|
@ -0,0 +1,85 @@
|
|||
async function checkDuplicate() {
|
||||
var url='https://lab.ilot.io/api/v4/projects/99/issues';
|
||||
var email = document.getElementById("email").value;
|
||||
|
||||
const response = await fetch(url, {
|
||||
headers: {
|
||||
'PRIVATE-TOKEN': 'glpat-RaoZSW_3XMhkGr19k6Wv',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
})
|
||||
const result = await response.json();
|
||||
let index = result
|
||||
.findIndex(item => item.title === email);
|
||||
|
||||
if (index !== -1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async function createIssue() {
|
||||
var baseurl = 'https://lab.ilot.io/api/v4/projects/99/issues?&labels=Request';
|
||||
var emptyfield = document.getElementById("emptyfield").value;
|
||||
var mathspamtrap = document.getElementById("math-spam-trap").value;
|
||||
var agreetoterms = document.getElementById("agree-to-terms").checked;
|
||||
var email = document.getElementById("email").value;
|
||||
|
||||
if(!agreetoterms) {
|
||||
alert("Registration requires agreement of Code of Conduct");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!email) {
|
||||
alert("Email cannot be empty");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(emptyfield) {
|
||||
alert("Empty field should be empty");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(mathspamtrap != "9") {
|
||||
alert("Wrong math answer");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(await checkDuplicate(email) === true) {
|
||||
alert("This email address has already requested an account");
|
||||
return false;
|
||||
}
|
||||
|
||||
var name = document.getElementById("name").value;
|
||||
var name = name.replace (/^/,'Name: ');
|
||||
var aboutme = document.getElementById("about-me").value;
|
||||
var aboutme = aboutme.replace (/^/,'About me: ');
|
||||
var aboutme = aboutme.replace(/\r?\n/g, "%0A%0A");
|
||||
var howfound = document.getElementById("how-found").value;
|
||||
var howfound = howfound.replace (/^/,'How I found ilot: ');
|
||||
var howfound = howfound.replace(/\r?\n/g, "%0A%0A");
|
||||
// add back on oc is setup
|
||||
// var ocuser = document.getElementById("oc-user").value;
|
||||
// var ocuser = ocuser.replace (/^/,'OpenCollective Profile: ');
|
||||
// var description = name + "%0A%0A" + aboutme + "%0A%0A" + howfound + "%0A%0A" + ocuser;
|
||||
var description = name + "%0A%0A" + aboutme + "%0A%0A" + howfound;
|
||||
var url = baseurl.concat("&title=", email, "&description=", description);
|
||||
console.log('Description:', description);
|
||||
|
||||
fetch(url, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'PRIVATE-TOKEN': 'glpat-RaoZSW_3XMhkGr19k6Wv',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(result => {
|
||||
console.log('Success:', result);
|
||||
alert("Request submitted. A working group member will process your registration shortly. If you receive no contact within seven days of registration, please send an email to support@ilot.io");
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error)
|
||||
});
|
||||
}
|
|
@ -7,7 +7,7 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2024-06-20 22:14-0400\n"
|
||||
"POT-Creation-Date: 2024-06-20 23:55-0400\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2024-06-20 22:14-0400\n"
|
||||
"POT-Creation-Date: 2024-06-20 23:55-0400\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: ilot.io\n"
|
||||
"POT-Creation-Date: 2024-06-20 21:50-0400\n"
|
||||
"POT-Creation-Date: 2024-06-20 23:55-0400\n"
|
||||
"PO-Revision-Date: 2024-06-20 21:54-0400\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: dev@ayakael.net\n"
|
||||
|
@ -21,84 +21,6 @@ msgstr ""
|
|||
msgid "[[!meta title=\"Join\"]]"
|
||||
msgstr "[[!meta title=\"Se joindre\"]]"
|
||||
|
||||
#. type: Content of: <script>
|
||||
msgid ""
|
||||
"async function checkDuplicate() { var url='https://lab.ilot.io/api/v4/"
|
||||
"projects/99/issues'; var email = document.getElementById(\"email\").value; "
|
||||
"const response = await fetch(url, { headers: { 'PRIVATE-TOKEN': 'glpat-"
|
||||
"RaoZSW_3XMhkGr19k6Wv', 'Content-Type': 'application/json', }, }) const "
|
||||
"result = await response.json(); let index = result .findIndex(item => item."
|
||||
"title === email); if (index !== -1) { return true; } else { return "
|
||||
"false; } } async function createIssue() { var baseurl = 'https://lab.ilot.io/"
|
||||
"api/v4/projects/99/issues?&labels=Request'; var emptyfield = document."
|
||||
"getElementById(\"emptyfield\").value; var mathspamtrap = document."
|
||||
"getElementById(\"math-spam-trap\").value; var agreetoterms = document."
|
||||
"getElementById(\"agree-to-terms\").checked; var email = document."
|
||||
"getElementById(\"email\").value; if(!agreetoterms) { alert(\"Registration "
|
||||
"requires agreement of Code of Conduct\"); return false; } if(!email) "
|
||||
"{ alert(\"Email cannot be empty\"); return false; } if(emptyfield) "
|
||||
"{ alert(\"Empty field should be empty\"); return false; } if(mathspamtrap != "
|
||||
"\"9\") { alert(\"Wrong math answer\"); return false; } if(await "
|
||||
"checkDuplicate(email) === true) { alert(\"This email address has already "
|
||||
"requested an account\"); return false; } var name = document."
|
||||
"getElementById(\"name\").value; var name = name.replace (/^/,'Name: '); var "
|
||||
"aboutme = document.getElementById(\"about-me\").value; var aboutme = aboutme."
|
||||
"replace (/^/,'About me: '); var aboutme = aboutme.replace(/\\r?\\n/g, "
|
||||
"\"%0A%0A\"); var howfound = document.getElementById(\"how-found\").value; "
|
||||
"var howfound = howfound.replace (/^/,'How I found ilot: '); var howfound = "
|
||||
"howfound.replace(/\\r?\\n/g, \"%0A%0A\"); // add back on oc is setup // var "
|
||||
"ocuser = document.getElementById(\"oc-user\").value; // var ocuser = ocuser."
|
||||
"replace (/^/,'OpenCollective Profile: '); // var description = name + "
|
||||
"\"%0A%0A\" + aboutme + \"%0A%0A\" + howfound + \"%0A%0A\" + ocuser; var "
|
||||
"description = name + \"%0A%0A\" + aboutme + \"%0A%0A\" + howfound; var url = "
|
||||
"baseurl.concat(\"&title=\", email, \"&description=\", description); console."
|
||||
"log('Description:', description); fetch(url, { method: 'POST', headers: "
|
||||
"{ 'PRIVATE-TOKEN': 'glpat-RaoZSW_3XMhkGr19k6Wv', 'Content-Type': "
|
||||
"'application/json', }, }) .then(response => response.json()) .then(result "
|
||||
"=> { console.log('Success:', result); alert(\"Request submitted. A working "
|
||||
"group member will process your registration shortly. If you receive no "
|
||||
"contact within seven days of registration, please send an email to "
|
||||
"support@ilot.io\"); }) .catch(error => { console.error('Error:', "
|
||||
"error) }); }"
|
||||
msgstr ""
|
||||
"async function checkDuplicate() { var url='https://lab.ilot.io/api/v4/"
|
||||
"projects/99/issues'; var email = document.getElementById(\"email\").value; "
|
||||
"const response = await fetch(url, { headers: { 'PRIVATE-TOKEN': 'glpat-"
|
||||
"RaoZSW_3XMhkGr19k6Wv', 'Content-Type': 'application/json', }, }) const "
|
||||
"result = await response.json(); let index = result .findIndex(item => item."
|
||||
"title === email); if (index !== -1) { return true; } else { return "
|
||||
"false; } } async function createIssue() { var baseurl = 'https://lab.ilot.io/"
|
||||
"api/v4/projects/99/issues?&labels=Request'; var emptyfield = document."
|
||||
"getElementById(\"emptyfield\").value; var mathspamtrap = document."
|
||||
"getElementById(\"math-spam-trap\").value; var agreetoterms = document."
|
||||
"getElementById(\"agree-to-terms\").checked; var email = document."
|
||||
"getElementById(\"email\").value; if(!agreetoterms) { alert(\"L'inscription "
|
||||
"requiert l'acceptation du code de conduite\"); return false; } if(!email) "
|
||||
"{ alert(\"Le courriel ne peut pas être vide\"); return false; } "
|
||||
"if(emptyfield) { alert(\"Le champ vide doit être vide\"); return false; } "
|
||||
"if(mathspamtrap != \"9\") { alert(\"Mauvaise réponse mathématique\"); return "
|
||||
"false; } if(await checkDuplicate(email) === true) { alert(\"Cette adresse e-"
|
||||
"mail a déjà demandé un compte\"); return false; } var name = document."
|
||||
"getElementById(\"name\").value; var name = name.replace (/^/,'Name: '); var "
|
||||
"aboutme = document.getElementById(\"about-me\").value; var aboutme = aboutme."
|
||||
"replace (/^/,'About me: '); var aboutme = aboutme.replace(/\\r?\\n/g, "
|
||||
"\"%0A%0A\"); var howfound = document.getElementById(\"how-found\").value; "
|
||||
"var howfound = howfound.replace (/^/,'How I found ilot: '); var howfound = "
|
||||
"howfound.replace(/\\r?\\n/g, \"%0A%0A\"); // add back on oc is setup // var "
|
||||
"ocuser = document.getElementById(\"oc-user\").value; // var ocuser = ocuser."
|
||||
"replace (/^/,'OpenCollective Profile: '); // var description = name + "
|
||||
"\"%0A%0A\" + aboutme + \"%0A%0A\" + howfound + \"%0A%0A\" + ocuser; var "
|
||||
"description = name + \"%0A%0A\" + aboutme + \"%0A%0A\" + howfound; var url = "
|
||||
"baseurl.concat(\"&title=\", email, \"&description=\", description); console."
|
||||
"log('Description:', description); fetch(url, { method: 'POST', headers: "
|
||||
"{ 'PRIVATE-TOKEN': 'glpat-RaoZSW_3XMhkGr19k6Wv', 'Content-Type': "
|
||||
"'application/json', }, }) .then(response => response.json()) .then(result "
|
||||
"=> { console.log('Success:', result); alert(\"Demande soumise. Un membre du "
|
||||
"groupe de travail traitera votre inscription dans les plus brefs délais. Si "
|
||||
"vous n'êtes pas contacté dans les sept jours suivant votre inscription, "
|
||||
"veuillez envoyer un courriel à support@ilot.io.\"); }) .catch(error => "
|
||||
"{ console.error('Error:', error) }); }"
|
||||
|
||||
#. type: Content of: <header><h1>
|
||||
msgid "Registration Form"
|
||||
msgstr "Formulaire d'inscription"
|
||||
|
@ -278,6 +200,9 @@ msgstr ""
|
|||
"maxlength=\"50\"></p> <input type=\"button\" value=\"Soumettre\" id = "
|
||||
"\"submit\" onClick = \"createIssue()\"> </form>"
|
||||
|
||||
#~ msgid "alert(\"Email cannot be empty\")"
|
||||
#~ msgstr "alert(\"Le courriel ne peut pas être vide\")"
|
||||
|
||||
#~ msgid "Registration requires agreement of Code of Conduct"
|
||||
#~ msgstr "Inscription nécéssite votre accord avec le Code de conduite"
|
||||
|
||||
|
|
|
@ -1,93 +1,6 @@
|
|||
[[!meta title="Join"]]
|
||||
|
||||
<script>
|
||||
async function checkDuplicate() {
|
||||
var url='https://lab.ilot.io/api/v4/projects/99/issues';
|
||||
var email = document.getElementById("email").value;
|
||||
|
||||
const response = await fetch(url, {
|
||||
headers: {
|
||||
'PRIVATE-TOKEN': 'glpat-RaoZSW_3XMhkGr19k6Wv',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
})
|
||||
const result = await response.json();
|
||||
let index = result
|
||||
.findIndex(item => item.title === email);
|
||||
|
||||
if (index !== -1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async function createIssue() {
|
||||
var baseurl = 'https://lab.ilot.io/api/v4/projects/99/issues?&labels=Request';
|
||||
var emptyfield = document.getElementById("emptyfield").value;
|
||||
var mathspamtrap = document.getElementById("math-spam-trap").value;
|
||||
var agreetoterms = document.getElementById("agree-to-terms").checked;
|
||||
var email = document.getElementById("email").value;
|
||||
|
||||
if(!agreetoterms) {
|
||||
alert("Registration requires agreement of Code of Conduct");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!email) {
|
||||
alert("Email cannot be empty");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(emptyfield) {
|
||||
alert("Empty field should be empty");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(mathspamtrap != "9") {
|
||||
alert("Wrong math answer");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(await checkDuplicate(email) === true) {
|
||||
alert("This email address has already requested an account");
|
||||
return false;
|
||||
}
|
||||
|
||||
var name = document.getElementById("name").value;
|
||||
var name = name.replace (/^/,'Name: ');
|
||||
var aboutme = document.getElementById("about-me").value;
|
||||
var aboutme = aboutme.replace (/^/,'About me: ');
|
||||
var aboutme = aboutme.replace(/\r?\n/g, "%0A%0A");
|
||||
var howfound = document.getElementById("how-found").value;
|
||||
var howfound = howfound.replace (/^/,'How I found ilot: ');
|
||||
var howfound = howfound.replace(/\r?\n/g, "%0A%0A");
|
||||
// add back on oc is setup
|
||||
// var ocuser = document.getElementById("oc-user").value;
|
||||
// var ocuser = ocuser.replace (/^/,'OpenCollective Profile: ');
|
||||
// var description = name + "%0A%0A" + aboutme + "%0A%0A" + howfound + "%0A%0A" + ocuser;
|
||||
var description = name + "%0A%0A" + aboutme + "%0A%0A" + howfound;
|
||||
var url = baseurl.concat("&title=", email, "&description=", description);
|
||||
console.log('Description:', description);
|
||||
|
||||
fetch(url, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'PRIVATE-TOKEN': 'glpat-RaoZSW_3XMhkGr19k6Wv',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(result => {
|
||||
console.log('Success:', result);
|
||||
alert("Request submitted. A working group member will process your registration shortly. If you receive no contact within seven days of registration, please send an email to support@ilot.io");
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error)
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
<script src=/join.js></script>
|
||||
|
||||
<header class="text-center">
|
||||
<h1 class="post-title">Registration Form</h1>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2024-06-20 22:14-0400\n"
|
||||
"POT-Creation-Date: 2024-06-20 23:55-0400\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -20,48 +20,6 @@ msgstr ""
|
|||
msgid "[[!meta title=\"Join\"]]"
|
||||
msgstr ""
|
||||
|
||||
#. type: Content of: <script>
|
||||
msgid ""
|
||||
"async function checkDuplicate() { var "
|
||||
"url='https://lab.ilot.io/api/v4/projects/99/issues'; var email = "
|
||||
"document.getElementById(\"email\").value; const response = await fetch(url, "
|
||||
"{ headers: { 'PRIVATE-TOKEN': 'glpat-RaoZSW_3XMhkGr19k6Wv', 'Content-Type': "
|
||||
"'application/json', }, }) const result = await response.json(); let index = "
|
||||
"result .findIndex(item => item.title === email); if (index !== -1) { return "
|
||||
"true; } else { return false; } } async function createIssue() { var baseurl "
|
||||
"= 'https://lab.ilot.io/api/v4/projects/99/issues?&labels=Request'; var "
|
||||
"emptyfield = document.getElementById(\"emptyfield\").value; var mathspamtrap "
|
||||
"= document.getElementById(\"math-spam-trap\").value; var agreetoterms = "
|
||||
"document.getElementById(\"agree-to-terms\").checked; var email = "
|
||||
"document.getElementById(\"email\").value; if(!agreetoterms) { "
|
||||
"alert(\"Registration requires agreement of Code of Conduct\"); return false; "
|
||||
"} if(!email) { alert(\"Email cannot be empty\"); return false; } "
|
||||
"if(emptyfield) { alert(\"Empty field should be empty\"); return false; } "
|
||||
"if(mathspamtrap != \"9\") { alert(\"Wrong math answer\"); return false; } "
|
||||
"if(await checkDuplicate(email) === true) { alert(\"This email address has "
|
||||
"already requested an account\"); return false; } var name = "
|
||||
"document.getElementById(\"name\").value; var name = name.replace (/^/,'Name: "
|
||||
"'); var aboutme = document.getElementById(\"about-me\").value; var aboutme = "
|
||||
"aboutme.replace (/^/,'About me: '); var aboutme = "
|
||||
"aboutme.replace(/\\r?\\n/g, \"%0A%0A\"); var howfound = "
|
||||
"document.getElementById(\"how-found\").value; var howfound = "
|
||||
"howfound.replace (/^/,'How I found ilot: '); var howfound = "
|
||||
"howfound.replace(/\\r?\\n/g, \"%0A%0A\"); // add back on oc is setup // var "
|
||||
"ocuser = document.getElementById(\"oc-user\").value; // var ocuser = "
|
||||
"ocuser.replace (/^/,'OpenCollective Profile: '); // var description = name + "
|
||||
"\"%0A%0A\" + aboutme + \"%0A%0A\" + howfound + \"%0A%0A\" + ocuser; var "
|
||||
"description = name + \"%0A%0A\" + aboutme + \"%0A%0A\" + howfound; var url = "
|
||||
"baseurl.concat(\"&title=\", email, \"&description=\", description); "
|
||||
"console.log('Description:', description); fetch(url, { method: 'POST', "
|
||||
"headers: { 'PRIVATE-TOKEN': 'glpat-RaoZSW_3XMhkGr19k6Wv', 'Content-Type': "
|
||||
"'application/json', }, }) .then(response => response.json()) .then(result "
|
||||
"=> { console.log('Success:', result); alert(\"Request submitted. A working "
|
||||
"group member will process your registration shortly. If you receive no "
|
||||
"contact within seven days of registration, please send an email to "
|
||||
"support@ilot.io\"); }) .catch(error => { console.error('Error:', error) "
|
||||
"}); }"
|
||||
msgstr ""
|
||||
|
||||
#. type: Content of: <header><h1>
|
||||
msgid "Registration Form"
|
||||
msgstr ""
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2024-06-20 22:14-0400\n"
|
||||
"POT-Creation-Date: 2024-06-20 23:55-0400\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2024-06-20 22:14-0400\n"
|
||||
"POT-Creation-Date: 2024-06-20 23:55-0400\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
|
Loading…
Add table
Reference in a new issue