fix: Minification

This commit is contained in:
Simon 2020-11-26 22:02:41 +01:00
parent adad53fb6a
commit d3721df4e9
4 changed files with 23 additions and 17 deletions

View File

@ -1,19 +1,19 @@
const obfuscates = document.getElementsByClassName("obfuscate") const obfuscates = document.getElementsByClassName("obfuscate");
for (const element of obfuscates) { for (const element of obfuscates) {
const link = document.createElement("a") const link = document.createElement("a");
const separators = element.dataset.separators const separators = element.dataset.separators;
const protocol = element.dataset.param1.split("").reverse().join("") const protocol = element.dataset.param1.split("").reverse().join("");
let url = protocol let url = protocol;
for (let i = 0; i < separators.length; i++) { for (let i = 0; i < separators.length; i++) {
url += separators[i] + element.dataset["param" + (i+2)].split("").reverse().join("") url += separators[i] + element.dataset["param" + (i+2)].split("").reverse().join("");
} }
let text = element.dataset.param2.split("").reverse().join("") let text = element.dataset.param2.split("").reverse().join("");
for (let i = 1; i < separators.length; i++) { for (let i = 1; i < separators.length; i++) {
text += separators[i] + element.dataset["param" + (i+2)].split("").reverse().join("") text += separators[i] + element.dataset["param" + (i+2)].split("").reverse().join("");
} }
link.innerText = url.replace(new RegExp(element.dataset.regex, 'i'), element.dataset.replace) link.innerText = url.replace(new RegExp(element.dataset.regex, 'i'), element.dataset.replace);
link.href = url link.href = url;
link.rel = "nofollow" link.rel = "nofollow";
element.parentElement.insertBefore(link, element); element.parentElement.insertBefore(link, element);
} }
while (obfuscates.length > 0) obfuscates[0].remove() while (obfuscates.length > 0) obfuscates[0].remove();

View File

@ -24,7 +24,7 @@
{{ end }} {{ end }}
<div class="text"> <div class="text">
{{ $ellipsis := print " <a href='" .RelPermalink "'></a>" | safeHTML }} {{ $ellipsis := print " <a href='" .RelPermalink "'></a>" | safeHTML }}
{{ .Content | plainify | htmlUnescape | truncate $truncateSize $ellipsis }} {{ .Content | plainify | replace "\n" " " | htmlUnescape | truncate $truncateSize $ellipsis }}
</div> </div>
</div> </div>
</div> </div>

View File

@ -8,8 +8,15 @@
<p>{{ .RenderString "[](tel:0477625067)" }}</p> <p>{{ .RenderString "[](tel:0477625067)" }}</p>
<p>{{ .RenderString "[](mailto:mairie@cremeaux.fr)" }}</p> <p>{{ .RenderString "[](mailto:mairie@cremeaux.fr)" }}</p>
<p> <p>
<a href="/actualites/index.xml"><img src="/icons/rss.svg" alt="Flux RSS de l'actualité à Crémeaux" title="Flux RSS de l'actualité à Crémeaux" class="icons" /></a> <a href="/actualites/index.xml">
<a target="_blank" rel="noopener" href="https://www.facebook.com/vivre.a.cremeaux/"><img src="/icons/facebook.svg" alt="Facebook : Vivre à Crémeaux" title="Facebook : Vivre à Crémeaux" class="icons" /></a> <img src="/icons/rss.svg" alt="Flux RSS de l'actualité à Crémeaux" title="Flux RSS de l'actualité à Crémeaux" class="icons" />
{{- /* Remove whitespace */ -}}
</a>
{{- /* Remove whitespace */ -}}
<a target="_blank" rel="noopener" href="https://www.facebook.com/vivre.a.cremeaux/">
{{- /* Remove whitespace */ -}}
<img src="/icons/facebook.svg" alt="Facebook : Vivre à Crémeaux" title="Facebook : Vivre à Crémeaux" class="icons" />
</a>
</p> </p>
</div> </div>
<div class="logo"> <div class="logo">

View File

@ -20,8 +20,7 @@
{{ range .Site.Menus.main }} {{ range .Site.Menus.main }}
<li class="menu{{ if .HasChildren }} withSubmenu{{ end }}"> <li class="menu{{ if .HasChildren }} withSubmenu{{ end }}">
<a href="{{ .URL }}"> <a href="{{ .URL }}">
<img class="icons" src="/icons/{{ .Identifier }}.svg" alt="{{ .Name }}" /> <img class="icons" src="/icons/{{ .Identifier }}.svg" alt="{{ .Name }}" /><span>{{ .Name }}</span>
<span>{{ .Name }}</span>
</a> </a>
{{ if .HasChildren }} {{ if .HasChildren }}
<ol class="submenu"> <ol class="submenu">