forked from garrett/jekyll-springboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
email.html
33 lines (28 loc) · 776 Bytes
/
email.html
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
{% capture output %}
{% assign email = include.username
| append: " AT "
| append: include.domain
| replace: ".", " DOT "
| prepend: " RemoveThisText "
| append: " RemoveThisText "
%}
{% if include.script != true %}
<a href="mailto:{{ email }}" class="mailto-obfuscated">{{
include.name
}}</a>
{% else %}
<script>
document.addEventListener("DOMContentLoaded", function(event) {
document.querySelectorAll('.mailto-obfuscated').forEach(function(el){
setTimeout(function(){
el['href'] = el['href']
.replace(/AT/, '@')
.replace(/DOT/g, '.')
.replace(/RemoveThisText/g, '')
.replace(/ /g, '');
}, 300);
});
});
</script>
{% endif %}
{% endcapture %}{{ output | strip_newlines | strip }}{{ include.after }}