pkrm.dev/app/templates/contact.html
2023-11-25 23:40:30 -06:00

244 lines
6.9 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://fonts.googleapis.com/css2?family=Kanit:wght@200;300;400;500;600;700&display=swap" rel="stylesheet">
<title>Contact | pkrm.dev</title>
<meta name="robots" content="index, follow">
<meta name="theme-color" content="#000" />
<meta name="apple-mobile-web-app-title" content="Parker M. | Contact" />
<meta property="og:title" content="Parker M. | Contact" />
<meta property="og:url" content="https://pkrm.dev" />
<meta property="og:type" content="website" />
<meta property="og:description" content="Fill out this form in order to contact me." />
<meta name="description" content="Fill out this form in order to contact me." />
<meta name="robots" content="index, follow" />
<meta name="http-equiv" content="X-Robots-Tag : index, follow" />
<meta name="googlebot" content="index, follow" />
<meta http-equiv="Onion-Location" content="http://dazz5im5t55mdzyfgegonv4d5nug2bt5nzck4m7zhqwynxo3xcvc77ad.onion/contact">
<meta name="twitter:card" content="summary" />
<script src="/static/contact.js" defer></script>
</head>
<body>
<a href="/" id="back-home">Back Home</a>
<div class="container">
<p id="attention">ATTENTION: To send any sensitive information, please email me at <a href="mailto:contact@pkrm.dev" id="contact-email">contact@pkrm.dev</a> and encrypt the message with my <a href="/static/contact.asc" id="pgp-key">PGP public key</a>. This form should not be thought of as a secure way of communication.</p>
<form actions="/contact" method="POST" name="contact" onsubmit="event.preventDefault(); checkForm();">
<input name="name" placeholder="Name">
<input name="email" placeholder="Email">
<textarea name="message" placeholder="Message"></textarea>
<button>Send</button>
</form>
{% if success %}
<p class="success">Thank you for contacting me! I will get back to you soon.</p>
{% endif %}
{% if error %}
<p class="error">There was an error sending your message. Please try again later.</p>
{% endif %}
</div>
</body>
</html>
<script>
const nameInput = document.querySelector('input[name="name"]');
const email = document.querySelector('input[name="email"]');
const message = document.querySelector('textarea[name="message"]');
window.onload = validateForm();
function validateForm() {
nameInput.addEventListener('input', () => {
if (nameInput.value.length > 0) {
nameInput.style.border = '2px solid #242424';
} else {
nameInput.style.border = '2px solid #FA5B5B';
}
});
email.addEventListener('input', () => {
if (email.value.length > 0) {
email.style.border = '2px solid #242424';
} else {
email.style.border = '2px solid #FA5B5B';
}
});
message.addEventListener('input', () => {
if (message.value.length > 0) {
message.style.border = '2px solid #242424';
} else {
message.style.border = '2px solid #FA5B5B';
}
});
}
function checkForm() {
// If nothing is empty, submit
if (nameInput.value.length > 0 && email.value.length > 0 && message.value.length > 0) {
document.forms['contact'].submit();
// Otherwise, outline the empty fields in red
} else {
if (nameInput.value.length == 0) {
nameInput.style.border = '2px solid #FA5B5B';
}
if (email.value.length == 0) {
email.style.border = '2px solid #FA5B5B';
}
if (message.value.length == 0) {
message.style.border = '2px solid #FA5B5B';
}
}
}
</script>
<style>
* {
font-family: 'Kanit', sans-serif;
margin: 0;
scroll-behavior: smooth;
}
body{
overflow-x: hidden;
background-image: url(/static/bg.png);
background-size: cover;
color: #fff;
}
#back-home {
font-weight: bold;
position: absolute;
top: 0;
left: 50%;
transform: translateX(-50%);
padding-top: 2.604vw;
font-size: 2.083vw;
color: #fff;
text-decoration: none;
}
a:hover {
cursor: pointer;
opacity: 0.6;
}
/* "Back Home" media query for mobile */
@media only screen and (max-width: 600px) {
#back-home {
font-size: 7vw;
padding-top: 4.167vw;
width: 90%;
display: flex;
justify-content: center;
align-items: center;
}
}
.container {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
/* Container media query for mobile */
@media only screen and (max-width: 600px) {
.container {
position: absolute;
top: 60%;
left: 50%;
transform: translate(-50%, -50%);
}
}
#attention {
font-size: 1.302vw;
text-align: center;
margin: 0.521vw;
}
/* Attention media query for mobile */
@media only screen and (max-width: 600px) {
#attention, #attention a {
font-size: 5vw;
}
}
#pgp-key, #contact-email {
color: #fff;
text-decoration: underline;
font-size: 1.302vw;
}
form {
display: flex;
flex-direction: column;
border-radius: 10px;
}
form input, form textarea, form button {
color: white;
background-color: #242424;
border: 2px solid #242424;
border-radius: 10px;
padding: 0.521vw;
margin: 0.521vw;
width: 50vw;
font-size: 1.563vw;
resize: none;
}
form button {
width: 20vw;
}
form button:hover {
cursor: pointer;
background-color: #333;
}
/* Form media query for mobile */
@media only screen and (max-width: 600px) {
form input, form textarea, form button {
width: 70vw;
font-size: 7vw;
margin: 5px;
}
form button {
width: 50vw;
margin-left: 50%;
transform: translateX(-50%);
}
}
.success {
font-size: 1.302vw;
text-align: center;
color: #73C276;
}
.error {
font-size: 1.302vw;
text-align: center;
color: #FA5B5B
}
/* Response media query for mobile */
@media only screen and (max-width: 600px) {
.error,
.success {
font-size: 3.125vw;
}
}
</style>