themes/ezhil: fix CSP violation from click analytics event [deploy]

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
Harsh Shandilya 2020-12-25 10:41:02 +05:30
parent 8df5c9867d
commit 0329424553
1 changed files with 9 additions and 6 deletions

View File

@ -1,8 +1,3 @@
<script nonce="ONQV6ZLWMVXHIX3IMVQWIZLSL5RWY2LDNMFA====">
function item_click(name) {
sa_event(`header_click_${name}`);
}
</script>
<div class="header">
<base href="{{ .Site.BaseURL }}">
<h1 class="site-title"><a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a></h1>
@ -13,7 +8,7 @@ function item_click(name) {
<nav class="nav social">
<ul class="flat">
{{- range $index, $key := .Site.Params.Social -}}
<a href="{{ $key.url }}" title="{{ $key.name }}" onclick="item_click({{ $key.icon }})"><i data-feather="{{ $key.icon }}"></i></a>
<a href="{{ $key.url }}" title="{{ $key.name }}" id="{{ $key.icon }}-header"><i data-feather="{{ $key.icon }}"></i></a>
{{- end -}}
</ul>
</nav>
@ -28,4 +23,12 @@ function item_click(name) {
{{ end }}
</ul>
</nav>
<script nonce="ONQV6ZLWMVXHIX3IMVQWIZLSL5RWY2LDNMFA====">
function item_click(name) {
sa_event(`header_click_${name}`);
}
{{- range $index, $key := .Site.Params.Social -}}
document.getElementById("{{ $key.icon }}-header").addEventListener('click', item_click("{{ $key.icon }}"));
{{- end -}}
</script>
</div>