[basics] supression des informations contact, mise en place de l'adresse e-mail obfusquée

This commit is contained in:
max/sooulix 2024-08-15 20:11:33 +02:00
parent 991ec39404
commit d929eaac1a
3 changed files with 63 additions and 80 deletions

View File

@ -0,0 +1,25 @@
function obfuscateEmail(item) {
let href = item.href;
let innerHTML = item.innerHTML;
item.onmouseover = (_this) => {
const elt = _this.target;
const b64email = elt.href.match('[^/]*$').pop();
elt.href = 'mailto:' + atob(b64email);
elt.innerHTML = 'E-mail: ' + atob(b64email);
}
item.onmouseout = (_this) => {
_this.target.href = href;
_this.target.innerHTML = innerHTML;
}
}
function init() {
const elts = []
const query = document.getElementsByClassName("obfuscated_email")
for (let i = 0; i < query.length; i++) {
obfuscateEmail(query[i]);
}
}
window.onload = init

View File

@ -80,6 +80,7 @@
} }
}); });
</script> </script>
<script type="text/javascript" src="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/js/obfuscate_email.js"></script>
</body> </body>
</html> </html>

View File

@ -28,51 +28,9 @@
</span> </span>
{% endif %} {% endif %}
{% if basics.birth %}
{{ basics.birth }}
{% endif %}
<div id="contact"> <div id="contact">
{% if basics.url %} <a href="{{ basics.email }}" class="obfuscated_email">E-mail (hover me)</a>
<div class="website">
<span class="fas fa-external-link-alt"></span>
<a href="{{ basics.url }}">{{ basics.url }}</a>
</div> </div>
{% endif %}
{% if basics.email %}
<div class="email">
<span class="far fa-envelope"></span>
<a href="mailto:{{ basics.email }}">{{ basics.email }}</a>
</div>
{% endif %}
{% if basics.phone %}
<div class="phone">
<span class="fas fa-mobile-alt"></span>
<a href="tel:{{ basics.phone }}">{{ basics.phone }}</a>
</div>
{% endif %}
</div>
{% if basics.profiles %}
<div id="profiles">
{% for profile in basics.profiles %}
<div class="item">
{% if profile.network %}
<div class="username">
<span class="{{ profile.icon | d('fab fa-' + profile.network | replace(' ', '-') | lower) }} {{ profile.network | replace(' ', '-') | lower }} social"></span>
{% if profile.url %}
<span class="url">
<a href="{{ profile.url }}">{{ profile.username }}</a>
</span>
{% else %}
<span>{{ profile.username }}</span>
{% endif %}
</div>
{% endif %}
</div>
{% endfor %}
</div>
{% endif %}
</header> </header>
{% if basics.summary %} {% if basics.summary %}
@ -82,5 +40,4 @@
</section> </section>
</section> </section>
{% endif %} {% endif %}
{% endif %} {% endif %}