···44import setupLink from './link_setup.js';
5566(function() {
77- document.body.innerHTML = getBase(false, false);
77+ document.body.innerHTML = getBase(false, false, false);
88 document.querySelector('.site-content').innerHTML = `
99 <div class="page-desc">
1010 <p class="markdown">"Creativity is an energy. It's a precious energy, and it's something to be protected. A lot of people take for granted that they're a creative person, but I know from experience, feeling it in myself, it is a magic; it is an energy. And it can't be taken for granted." --Ava DuVernay</p>
···11+import getBase from './base.js';
22+import parseMarkdown from './markdown.js';
33+import setupNavAnim from './nav_anim.js';
44+import setupLink from './link_setup.js';
55+66+var emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
77+88+function validateForm() {
99+ return (document.getElementById('contact-name').value !== '') && (document.getElementById('contact-email').value !== '') && (document.getElementById('contact-message').value !== '') && (document.getElementById('contact-email').value.match(emailRegex));
1010+}
1111+1212+function showValidation(el, name) {
1313+ if (name === 'email') {
1414+ if (el.value === '') {
1515+ alert('Email field is empty.');
1616+ } else if (!el.value.match(emailRegex)) {
1717+ alert('Email field does not contain an email.');
1818+ }
1919+ } else {
2020+ if (el.value === '') {
2121+ alert(name + ' field is empty.');
2222+ }
2323+ }
2424+}
2525+2626+(function () {
2727+ document.body.innerHTML = getBase(true, false, true);
2828+2929+ document.querySelector('.site-content').innerHTML = `
3030+ <div class="input"><input type="text" required placeholder="Name *" name="name" id="contact-name" /></div>
3131+ <div class="input"><input type="email" required placeholder="Email *" name="email" id="contact-email" /></div>
3232+ <div class="input"><textarea name="message" id="contact-message" placeholder="Message *"></textarea></div>
3333+ <ul class="cd-pagination custom-icons">
3434+ <li class="button-submit"><a href="#"><i>Submit</i></a></li>
3535+ </ul>
3636+ `;
3737+3838+ document.querySelectorAll('.cd-primary-nav li a').forEach((element, key, parent) => {
3939+ if (element.href.indexOf('contact.html') != -1) {
4040+ element.classList.add('selected');
4141+ } else {
4242+ element.classList.remove('selected');
4343+ }
4444+ });
4545+4646+ document.querySelector('.button-submit a').addEventListener('click', (e) => {
4747+ e.preventDefault();
4848+4949+ if (!validateForm()) {
5050+ showValidation(document.getElementById('contact-name'), 'Name');
5151+ showValidation(document.getElementById('contact-email'), 'email');
5252+ showValidation(document.getElementById('contact-message'), 'Message');
5353+ return false;
5454+ }
5555+5656+ alert('Your message is sending. You will see a notification saying "OK" if your message sent correctly. Press Okay to close this message.');
5757+5858+ var name = document.getElementById('contact-name').value;
5959+ var email = document.getElementById('contact-email').value;
6060+ var message = document.getElementById('contact-message').value;
6161+6262+ document.getElementById('contact-name').value = '';
6363+ document.getElementById('contact-email').value = '';
6464+ document.getElementById('contact-message').value = '';
6565+6666+ email.send({
6767+ SecureToken: '35f5af2e-8f3d-4aea-99a0-cefbd03bb7f6',
6868+ To: 'cityboundforest@gmail.com',
6969+ From: email,
7070+ Subject: 'Message from Website',
7171+ Body: name + ' just sent you a message!\n\n' + message
7272+ }).then(
7373+ message => alert(message)
7474+ );
7575+ });
7676+7777+ setupNavAnim(document);
7878+ parseMarkdown(document);
7979+8080+ setTimeout(() => {
8181+ document.body.classList.add('loaded');
8282+ }, 150);
8383+8484+ setupLink(document);
8585+})();
+11-1
scripts/head.js
···11-function getHeader(is_index) {
11+function getHeader(is_index, is_contact) {
22 if (is_index) {
33 return `
44 <header class="site-header cf">
···66 <div class="cf"></div>
77 <div class="site-tagline">
88 <p><strong>CityboundForest</strong></p><div style="font-size:18pt;" class="markdown">Hello I'm **Cass Unterholzner.** \nI'm a storyteller working in the media of !1[**film**], !2[**theatre**], !3[**video games**], and !4[**music**].</div>
99+ </div>
1010+ </header>
1111+ `;
1212+ } else if (is_contact) {
1313+ return `
1414+ <header class="site-header cf">
1515+ <div class="site-title"><a href="index.html">C/B/F</a></div>
1616+ <div class="cf"></div>
1717+ <div class="site-tagline">
1818+ <h1 id="blog-post-title">Contact Me</h1>
919 </div>
1020 </header>
1121 `;
+1-1
scripts/main.js
···55import setupLink from './link_setup.js';
6677(function () {
88- document.body.innerHTML = getBase(true, false);
88+ document.body.innerHTML = getBase(true, false, false);
99 document.querySelector('.site-content').innerHTML = `<div class="projects-feed cf"></div>`;
10101111 var projects = [{id: 'fourwoods', title: 'The Four Woods Podcast', description: 'An audio drama podcast about myth and magic - Writer, Director, Editor, Producer'}, {id: 'mememachine', title: 'Meme Machine', description: 'Download, Rate, and Create Memes - Programmer'}, {id: 'shutin', title: 'Shut In', description: 'Short Film - Gaffer, Foley Artist, Sound Editor'}, {id: 'bulletrush', title: 'Bullet Rush', description: 'Cuphead meets First Person Shooter games - Programmer, Project Manager'}, {id: 'dndcombatsim', title: 'Dungeons and Dragons Combat Simulator', description: 'Combat simulator for the 5th Edition of the Tabletop RPG Dungeons and Dragons - Programmer, Project Manager'}, {id: 'cansat', title: 'CanSat', description: 'A simulated sattelite in an enclosure the shape and size of a soda can - Programmer'}];