aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--index.html2
-rw-r--r--main.js25
2 files changed, 26 insertions, 1 deletions
diff --git a/index.html b/index.html
index 4e44a5e..b5d4381 100644
--- a/index.html
+++ b/index.html
@@ -47,7 +47,7 @@
</li>
</ul>
<p class="small text-muted info-credits">Webbkartan är utvecklad av
- <a href="mailto:guilhem@fripost.org" target="_blank">Guilhem Moulin</a> på uppdrag av
+ <a href="mailto:Z3VpbGhlbQ __AT__ ZnJpcG9zdA __DOT__ b3Jn" 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>
diff --git a/main.js b/main.js
index 2822cf4..80b487d 100644
--- a/main.js
+++ b/main.js
@@ -424,6 +424,30 @@ if (window.location === window.parent.location) {
};
}
+const decodeEmailAddress = function(element) {
+ const MAILTO = 'mailto:';
+ const CLASSNAME = 'email-address-b64';
+ for (const a of element.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+/)) {
+ switch (part) {
+ case '__AT__':
+ href += '@';
+ break;
+ case '__DOT__':
+ href += '.';
+ break;
+ default:
+ href += atob(part);
+ }
+ }
+ a.href = href;
+ a.classList.remove(CLASSNAME);
+ }
+ }
+};
+
/* info button */
(function() {
const div = document.createElement('div');
@@ -447,6 +471,7 @@ if (window.location === window.parent.location) {
const modal = new Modal(panel, {
backdrop: false,
});
+ decodeEmailAddress(panel);
const backdrop = document.getElementById('info-modal-backdrop');
backdrop.onclick = function() {