Skip to content

Commit 8f366eb

Browse files
committed
Add mailling list modal for desktop
1 parent adefd07 commit 8f366eb

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

layouts/partials/header.html

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@
1818
<a href="http://discord.carletoncomputersciencesociety.ca"
1919
>{{- partial "button.html" (dict "label" "Discord") -}}</a
2020
>
21-
<a style="text-decoration: none" href="/mailing-list">
21+
<a
22+
style="text-decoration: none"
23+
data-eo-form-toggle-id="dd836c44-8774-11f0-9c6d-8b19c0f8937b"
24+
href="#"
25+
>
2226
<div class="home-header-discord">
2327
<div
2428
class="far fa-bell home-header-discord-arrow small-external-link-arrow"
@@ -56,3 +60,39 @@
5660
</div>
5761
</div>
5862
</div>
63+
<script>
64+
window.addEventListener("load", () => {
65+
const observer = new MutationObserver(() => {
66+
const form = document.querySelector("form.emailoctopus-form");
67+
if (form) {
68+
observer.disconnect();
69+
70+
const emailInput = form.querySelector('input[type="email"]');
71+
const submitButton = form.querySelector('input[type="submit"]');
72+
73+
if (!emailInput || !submitButton) return;
74+
75+
submitButton.addEventListener("click", (e) => {
76+
const email = emailInput.value.trim();
77+
if (/@cmail\.carleton\.ca$/i.test(email)) {
78+
e.preventDefault();
79+
alert(
80+
"Sorry, emails from cmail.carleton.ca are not allowed. We already sends emails to all Computer Science students with a cmail address."
81+
);
82+
} else {
83+
alert(
84+
"Thank you for subscribing! You will receive an email to confirm your subscription."
85+
);
86+
}
87+
});
88+
}
89+
});
90+
91+
observer.observe(document.body, { childList: true, subtree: true });
92+
});
93+
</script>
94+
<script
95+
async
96+
src="https://eocampaign1.com/form/dd836c44-8774-11f0-9c6d-8b19c0f8937b.js"
97+
data-form="dd836c44-8774-11f0-9c6d-8b19c0f8937b"
98+
></script>

0 commit comments

Comments
 (0)