From d929eaac1a55981e550f23212a489a842af356e1 Mon Sep 17 00:00:00 2001 From: max/sooulix Date: Thu, 15 Aug 2024 20:11:33 +0200 Subject: [PATCH] =?UTF-8?q?[basics]=20supression=20des=20informations=20co?= =?UTF-8?q?ntact,=20mise=20en=20place=20de=20l'adresse=20e-mail=20obfusqu?= =?UTF-8?q?=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/js/obfuscate_email.js | 25 +++++++ templates/base.html | 1 + templates/partials/basics.html | 117 +++++++++++---------------------- 3 files changed, 63 insertions(+), 80 deletions(-) create mode 100644 static/js/obfuscate_email.js diff --git a/static/js/obfuscate_email.js b/static/js/obfuscate_email.js new file mode 100644 index 0000000..f5bc692 --- /dev/null +++ b/static/js/obfuscate_email.js @@ -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 diff --git a/templates/base.html b/templates/base.html index 9d2b9a6..6781b59 100644 --- a/templates/base.html +++ b/templates/base.html @@ -80,6 +80,7 @@ } }); + diff --git a/templates/partials/basics.html b/templates/partials/basics.html index 292f369..ffde66f 100644 --- a/templates/partials/basics.html +++ b/templates/partials/basics.html @@ -1,86 +1,43 @@ {% set basics = page.resume.basics %} {% if basics %} - + {% if basics.summary %} +
+
+
{{ basics.summary | replace("\r\n", "
") | replace("\n", "
") | replace("\r", "
") }}
+
+
+ {% endif %} {% endif %}