summaryrefslogtreecommitdiff
path: root/src/js/index.js
diff options
context:
space:
mode:
authorAdam T. Carpenter <atc@53hor.net>2020-06-02 21:54:44 -0400
committerAdam T. Carpenter <atc@53hor.net>2020-06-02 21:54:44 -0400
commite8ab11225a306225d2be16c4464e68a4ad464918 (patch)
tree9fa3c7071f6f27cb0305b0ce6522a606ded864a3 /src/js/index.js
parent8f3bc0a5a3640be89da2815ca32fa63150f8ec18 (diff)
downloadcarpentertutoring-e8ab11225a306225d2be16c4464e68a4ad464918.tar.xz
carpentertutoring-e8ab11225a306225d2be16c4464e68a4ad464918.zip
basic cobalt layout
Diffstat (limited to 'src/js/index.js')
-rw-r--r--src/js/index.js85
1 files changed, 0 insertions, 85 deletions
diff --git a/src/js/index.js b/src/js/index.js
deleted file mode 100644
index 8f3a987..0000000
--- a/src/js/index.js
+++ /dev/null
@@ -1,85 +0,0 @@
-const showOffering = function(element) {
- const offeringModal = document.getElementById(element.id + "-modal");
- offeringModal.classList.add("is-active");
-}
-
-const hideOffering = function(element) {
- element.parentElement.classList.remove("is-active");
-}
-
-/*
- * Adds an event listener to all burgers to toggle navbar menu on click.
- * TODO: would be better off as a single function and onclicks inlined in html
- */
-document.addEventListener('DOMContentLoaded', function () {
- const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);
-
- if ($navbarBurgers.length > 0) {
- // add a click event on each of them
- $navbarBurgers.forEach(function(el) {
- el.addEventListener('click', function () {
- // get the target from the 'data-target' attribute
- const target = el.dataset.target;
- const $target = document.getElementById(target);
-
- // toggle the 'is-active' class on both the 'navbar-burger' and the 'navbar-menu'
- el.classList.toggle('is-active');
- $target.classList.toggle('is-active');
- });
- });
- }
-});
-
-const disableErrorBox = function() {
- document.getElementById("errorBox").style.display = "none";
-}
-
-const disableSuccessBox = function() {
- document.getElementById("successBox").style.display = "none";
-}
-
-const enableErrorBox = function(message) {
- const errorBox = document.getElementById("errorBox");
- let aTag = document.createElement('a');
- aTag.setAttribute("href", "mailto:amy@carpentertutoring.com");
- aTag.innerText = message + " Click here to send through your mail client.";
- while (errorBox.hasChildNodes()) { errorBox.removeChild(errorBox.lastChild); }
- errorBox.appendChild(aTag);
- errorBox.style.display = "block";
-}
-
-const enableSuccessBox = function() {
- document.getElementById("successBox").style.display = "block";
-}
-
-/*
- * Adds mail sender to form submit.
- */
-document.forms.inquiry.onsubmit = function() {
- disableErrorBox();
- disableSuccessBox();
- const form = document.forms.inquiry;
- const name = form.elements.name.value;
- const fromEmail = form.elements.from.value;
- const body = form.elements.body.value;
-
- Email.send({
- SecureToken : "cec9bc04-de48-48fd-b1ad-a95cffb41468",
- To : "amy@carpentertutoring.com",
- From : fromEmail,
- Subject : "Tutoring Inquiry from " + name,
- Body : body,
- }).then(message => {
- if (message == "OK") {
- form.reset();
- enableSuccessBox();
- }
- else {
- enableErrorBox(message);
- }
- }
- );
-
- return false;
-}
-