mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
mermaid: only load javascript if necessary #95
This commit is contained in:
parent
22180dcf07
commit
3446aa4230
2 changed files with 9 additions and 1 deletions
|
@ -1,4 +1,9 @@
|
|||
+++
|
||||
title = "Relearrrn Theme fer Cap'n Hugo"
|
||||
+++
|
||||
|
||||
{{% notice warning %}}
|
||||
Arrr fello pirrates, be awarrre some featurrres may not work fer us in this trrranslat'n. Like table of contents orrr seeing Merrrmaids.
|
||||
{{% /notice %}}
|
||||
|
||||
{{< piratify >}}
|
|
@ -25,6 +25,7 @@
|
|||
<script src="{{"js/jquery.svg.pan.zoom.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
|
||||
<script src="{{"js/featherlight.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
|
||||
<script src="{{"js/modernizr.custom-3.6.0.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
|
||||
{{- if .HasShortcode "mermaid" }}
|
||||
{{- if (or (and (ne .Params.disableMermaid nil) (not .Params.disableMermaid)) (not .Site.Params.disableMermaid)) }}
|
||||
{{- if isset .Params "custommermaidurl" }}
|
||||
<script src="{{ .Params.customMermaidURL }}"></script>
|
||||
|
@ -40,11 +41,13 @@
|
|||
{{- else }}
|
||||
{{- $.Scratch.Set "mermaidInitialize" "{ \"startOnLoad\": true }" }}
|
||||
{{- end }}
|
||||
<script>
|
||||
|
||||
>
|
||||
if (typeof mermaid != 'undefined') {
|
||||
mermaid.mermaidAPI.initialize( Object.assign( { "securityLevel": "antiscript" }, JSON.parse({{ $.Scratch.Get "mermaidInitialize" }}), { startOnLoad: false } ) );
|
||||
}
|
||||
</script>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
<script src="{{"js/relearn.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
|
||||
{{- partial "custom-footer.html" . }}
|
||||
|
|
Loading…
Reference in a new issue