blob: e8615cc4d84e585aad94cee05c47ee1ab8f9852a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
---
import Layout from "../layouts/Layout.astro";
const schema = {
"@context": "https://schema.org",
"@type": "ContactPage",
url: "https://www.costas.dev/contact",
headline: "Ponte en contacto conmigo",
};
---
<Layout title="Contacto" description="Ponte en contacto conmigo">
<script
is:inline
type="application/ld+json"
slot="head-jsonld"
set:html={JSON.stringify(schema)}
/>
<h1>Contacta conmigo</h1>
<p>
La forma más sencilla de contactar conmigo es a través de mi dirección
de correo electrónico:
<a href="#" id="email-addr">ACTIVA JAVASCRIPT PARA VER ESTO</a>. También
puedes usar <a href="https://wa.me/message/W7T7L4EZAELQI1">WhatsApp</a> con el número de teléfono
<a href="#" id="phone-number">ACTIVA JAVASCRIPT PARA VER ESTO</a>.
</p>
<p>También puedes encontrarme en algunas redes sociales:</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>
</Layout>
<script>
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;
(() => {
if (emailAddrLink == null || phoneNumberLink == null) {
return;
}
const emailAddress = xorData(encryptedEmail, key);
const phoneNumber = xorData(encryptedPhoneNumber, key);
emailAddrLink.href = `mailto:${emailAddress}`;
emailAddrLink.textContent = emailAddress;
phoneNumberLink.href = `tel:${phoneNumber}`;
phoneNumberLink.textContent = phoneNumber;
})();
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);
// 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);
}
for (let i = 0; i < dataLength; i++) {
result[i] = String.fromCharCode(actualData.charCodeAt(i) ^ actualKey.charCodeAt(i));
}
return result.join("");
}
</script>
|