Add "class" parameter
This commit is contained in:
parent
27689eccb0
commit
9118c82c70
|
@ -1,6 +1,7 @@
|
|||
{{/* Get address and protocol */}}
|
||||
{{- $address := .Get "address" | default (.Get 0) -}}
|
||||
{{- $protocol := .Get "protocol" | default "mailto" -}}
|
||||
{{- $class := .Get "class" -}}
|
||||
{{- $parts := split $address "@" -}}
|
||||
{{- $user := (index $parts 0) -}}
|
||||
{{- $domain := (index $parts 1) -}}
|
||||
|
@ -20,6 +21,9 @@
|
|||
var address = "{{ range $index := seq (sub (len $user) 1) 0}}{{ substr $user $index 1}}{{ end }}".split('').reverse().join('') + "@" + "{{ range $index := seq (sub (len $domain) 1) 0}}{{ substr $domain $index 1}}{{ end }}".split('').reverse().join('');
|
||||
link.href = {{ $protocol }} + ":" + address;
|
||||
link.innerText = address;
|
||||
{{ with $class }}
|
||||
link.className = "{{ $class }}";
|
||||
{{ end }}
|
||||
scriptTag.parentElement.insertBefore(link, scriptTag.previousElementSibling);
|
||||
scriptTag.parentElement.removeChild(scriptTag.previousElementSibling)
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue