diff options
| author | Ariel Costas Guerrero <ariel@costas.dev> | 2025-04-10 21:42:41 +0200 |
|---|---|---|
| committer | Ariel Costas Guerrero <ariel@costas.dev> | 2025-04-10 21:42:41 +0200 |
| commit | e3141794b95e534656427fadf0354435c62254d6 (patch) | |
| tree | 95788249ac51475aea45ad17d7157dffd1564e47 /src/layouts/ContactPageLayout.astro | |
| parent | 3caee506c961ae0e78503164ed6a0f81db3c8c32 (diff) | |
Fix formatting
Diffstat (limited to 'src/layouts/ContactPageLayout.astro')
| -rw-r--r-- | src/layouts/ContactPageLayout.astro | 139 |
1 files changed, 69 insertions, 70 deletions
diff --git a/src/layouts/ContactPageLayout.astro b/src/layouts/ContactPageLayout.astro index 3b3c278..c09969f 100644 --- a/src/layouts/ContactPageLayout.astro +++ b/src/layouts/ContactPageLayout.astro @@ -5,95 +5,94 @@ import Layout from "./Layout.astro"; const t = useTranslations(Astro.currentLocale); const schema = { - "@context": "https://schema.org", - "@type": "ContactPage", - url: "https://www.costas.dev/contact", - headline: t.contactPage.headline, + "@context": "https://schema.org", + "@type": "ContactPage", + url: "https://www.costas.dev/contact", + headline: t.contactPage.headline, }; --- <Layout title={t.contactPage.title} description={t.contactPage.description}> - <script - is:inline - type="application/ld+json" - slot="head-jsonld" - set:html={JSON.stringify(schema)} - /> + <script + is:inline + type="application/ld+json" + slot="head-jsonld" + set:html={JSON.stringify(schema)} + /> - <h1>{t.contactPage.headline}</h1> + <h1>{t.contactPage.headline}</h1> - <noscript> - <div role="alert" class="warning"> - {t.contactPage.enableJs} - </div> - </noscript> + <noscript> + <div role="alert" class="warning"> + {t.contactPage.enableJs} + </div> + </noscript> - <p set:html={t.contactPage.intro} /> + <p set:html={t.contactPage.intro} /> - <p>{t.contactPage.socialMedia}</p> + <p>{t.contactPage.socialMedia}</p> - <dl> - <dt>GitHub</dt> - <dd><a href="https://github.com/arielcostas">@arielcostas</a></dd> - <dt>LinkedIn</dt> - <dd> - <a href="https://www.linkedin.com/in/ariel-costas/" - >/in/ariel-costas</a> - </dd> - <dt>BlueSky</dt> - <dd><a href="https://bsky.app/profile/costas.dev">@costas.dev</a></dd> - </dl> + <dl> + <dt>GitHub</dt> + <dd><a href="https://github.com/arielcostas">@arielcostas</a></dd> + <dt>LinkedIn</dt> + <dd> + <a href="https://www.linkedin.com/in/ariel-costas/">/in/ariel-costas</a> + </dd> + <dt>BlueSky</dt> + <dd><a href="https://bsky.app/profile/costas.dev">@costas.dev</a></dd> + </dl> </Layout> <script> - const encryptedEmail = "LygNLiMmFRo/GlQZaFIWBA=="; - const encryptedPhoneNumber = "ZWlQfX1QT0Z+XgVd"; - const key = "NZdKOfvuLn5jF6sryF0Q"; + const encryptedEmail = "LygNLiMmFRo/GlQZaFIWBA=="; + const encryptedPhoneNumber = "ZWlQfX1QT0Z+XgVd"; + const key = "NZdKOfvuLn5jF6sryF0Q"; - const emailAddrLink = document.getElementById( - "email-addr", - ) as HTMLAnchorElement; - const phoneNumberLink = document.getElementById( - "phone-number", - ) as HTMLAnchorElement; + const emailAddrLink = document.getElementById( + "email-addr", + ) as HTMLAnchorElement; + const phoneNumberLink = document.getElementById( + "phone-number", + ) as HTMLAnchorElement; - (() => { - if (emailAddrLink == null || phoneNumberLink == null) { - return; - } - - const emailAddress = xorData(encryptedEmail, key); - const phoneNumber = xorData(encryptedPhoneNumber, key); + (() => { + if (emailAddrLink == null || phoneNumberLink == null) { + return; + } - emailAddrLink.href = `mailto:${emailAddress}`; - emailAddrLink.textContent = emailAddress; + const emailAddress = xorData(encryptedEmail, key); + const phoneNumber = xorData(encryptedPhoneNumber, key); - phoneNumberLink.href = `tel:${phoneNumber}`; - phoneNumberLink.textContent = phoneNumber; - })(); + emailAddrLink.href = `mailto:${emailAddress}`; + emailAddrLink.textContent = emailAddress; - function xorData(data: string, key: string): string { - let actualData = atob(data); - let actualKey = key; - const keyLength = key.length; - const dataLength = actualData.length; - const result = new Array(dataLength); + phoneNumberLink.href = `tel:${phoneNumber}`; + phoneNumberLink.textContent = phoneNumber; + })(); - // If the key is 12 characters but the data is 30 characters, the key should be repeated 3 times and truncated to 30 characters - if (keyLength < dataLength) { - actualKey = key - .repeat(Math.ceil(dataLength / keyLength)) - .substring(0, dataLength); - } else if (keyLength > dataLength) { - actualKey = key.substring(0, dataLength); - } + function xorData(data: string, key: string): string { + let actualData = atob(data); + let actualKey = key; + const keyLength = key.length; + const dataLength = actualData.length; + const result = new Array(dataLength); - for (let i = 0; i < dataLength; i++) { - result[i] = String.fromCharCode( - actualData.charCodeAt(i) ^ actualKey.charCodeAt(i), - ); - } + // If the key is 12 characters but the data is 30 characters, the key should be repeated 3 times and truncated to 30 characters + if (keyLength < dataLength) { + actualKey = key + .repeat(Math.ceil(dataLength / keyLength)) + .substring(0, dataLength); + } else if (keyLength > dataLength) { + actualKey = key.substring(0, dataLength); + } - return result.join(""); + for (let i = 0; i < dataLength; i++) { + result[i] = String.fromCharCode( + actualData.charCodeAt(i) ^ actualKey.charCodeAt(i), + ); } + + return result.join(""); + } </script> |
