3 input#modalContact.modal(
5 @change="trySetEnterTime($event)"
9 data-checkbox="modalContact"
12 label.modal-close(for="modalContact")
13 a#discordLink(href="https://discord.gg/a9ZFKBe")
14 span {{ st.tr["Discord invitation"] }}
15 img(src="/images/icons/discord.svg")
17 label(for="userEmail") {{ st.tr["Email"] }}
18 input#userEmail(type="email" :value="st.user.email")
20 label(for="mailSubject") {{ st.tr["Subject"] }}
21 input#mailSubject(type="text")
23 textarea#mailContent(:placeholder="st.tr['Your message']")
24 button(@click="trySendMessage()") {{ st.tr["Send"] }}
25 #dialog.text-center {{ st.tr[infoMsg] }}
29 import { ajax } from "@/utils/ajax";
30 import { store } from "@/store";
31 import { checkNameEmail } from "@/data/userCheck";
32 import { processModalClick } from "@/utils/modalClick.js";
34 name: "my-contact-form",
37 enterTime: Number.MAX_SAFE_INTEGER, //for a basic anti-bot strategy
43 document.getElementById("contactDiv")
44 .addEventListener("click", processModalClick);
47 trySetEnterTime: function(event) {
48 if (event.target.checked) {
49 this.enterTime = Date.now();
53 trySendMessage: function() {
54 // Basic anti-bot strategy:
55 const exitTime = Date.now();
56 if (exitTime - this.enterTime < 5000) return;
57 let email = document.getElementById("userEmail");
58 let subject = document.getElementById("mailSubject");
59 let content = document.getElementById("mailContent");
60 let error = checkNameEmail({ email: email });
61 if (!error && content.value.trim().length == 0)
62 error = this.st.tr["Empty message"];
68 subject.value.trim().length == 0 &&
69 !confirm(this.st.tr["No subject. Send anyway?"])
80 subject: subject.value,
81 content: content.value
84 this.infoMsg = "Email sent!";
95 <style lang="sass" scoped>
96 [type="checkbox"].modal+div .card
110 display: inline-block