diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2025-10-18 13:22:09 +0200 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2025-10-18 14:10:18 +0200 |
commit | 9c68737c4074f9bec8366224cdb9f11628c71ef4 (patch) | |
tree | a352e8d60f050e33d11d342642626b42063b4985 | |
parent | 354e8aa6abfcc37452c8bcf8bab2d481612bb750 (diff) |
Rather than an href. This avoids validators complaining that the href
value is invalid.
-rw-r--r-- | index.html | 5 | ||||
-rw-r--r-- | main.js | 11 |
2 files changed, 9 insertions, 7 deletions
@@ -47,7 +47,8 @@ </li> </ul> <p class="small text-muted info-credits">Webbkartan är utvecklad av - <a href="mailto:Z3VpbGhlbQ __AT__ ZnJpcG9zdA __DOT__ b3Jn" target="_blank" class="email-address-b64">Guilhem Moulin</a> på uppdrag av + <a data-mailto-b64="Z3VpbGhlbQ __AT__ ZnJpcG9zdA __DOT__ b3Jn" href="#" target="_blank" class="email-address-b64">Guilhem Moulin</a> + på uppdrag av <a href="https://www.klimatanalysnorr.se" target="_blank">Klimatanalys Norr projektet</a>.</p> </div> </div> @@ -187,7 +188,7 @@ <h3>Buggrapporter och feedback</h3> <p>Tveka inte att skicka ett - <a href="mailto:Z3VpbGhlbQ __AT__ ZnJpcG9zdA __DOT__ b3Jn" target="_blank" class="link-secondary email-address-b64">mejl + <a data-mailto-b64="Z3VpbGhlbQ __AT__ ZnJpcG9zdA __DOT__ b3Jn" href="#" target="_blank" class="link-secondary email-address-b64">mejl <i class="bi bi-envelope-at"></i></a> med önskemål, buggrapporter, förslag till förbättring med flera. @@ -483,12 +483,12 @@ if (window.location === window.parent.location) { }; /* de-obfuscate email address */ - const MAILTO = 'mailto:'; const CLASSNAME = 'email-address-b64'; + const ATTRNAME = 'data-mailto-b64'; for (const a of panel.getElementsByClassName(CLASSNAME)) { - if (a.tagName.toLowerCase() === 'a' && a.href.toLowerCase().startsWith(MAILTO)) { - let href = MAILTO; - for (const part of a.href.substr(MAILTO.length).split(/\s+/)) { + if (a.tagName.toLowerCase() === 'a' && a.hasAttribute(ATTRNAME)) { + let href = 'mailto:'; + for (const part of a.getAttribute(ATTRNAME).split(/\s+/)) { switch (part) { case '__AT__': href += '@'; @@ -500,8 +500,9 @@ if (window.location === window.parent.location) { href += atob(part); } } - a.href = href; a.classList.remove(CLASSNAME); + a.removeAttribute(ATTRNAME); + a.href = href; } } |