mirror of
https://github.com/thegeeklab/hugo-geekblog.git
synced 2024-11-28 07:50:34 +00:00
fix: remove inline script usage (#49)
This commit is contained in:
parent
55adaddc30
commit
29b10769b7
@ -1,8 +1,4 @@
|
|||||||
{{ if default true .Site.Params.GeekblogAnchorCopy }}
|
{{ if default true .Site.Params.GeekblogAnchorCopy }}
|
||||||
<script defer src="{{ index .Site.Data.assets "js/clipboard.min.js" | relURL }}"></script>
|
<script defer src="{{ index .Site.Data.assets "js/clipboard.min.js" | relURL }}"></script>
|
||||||
<script>
|
<script defer src="{{ index .Site.Data.assets "js/clipboard-loader.min.js" | relURL }}"></script>
|
||||||
document.addEventListener("DOMContentLoaded", function(event) {
|
|
||||||
var clipboard = new ClipboardJS('.clip');
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@ -1,13 +1,7 @@
|
|||||||
{{ if not (.Page.Scratch.Get "mermaid") }}
|
{{ if not (.Page.Scratch.Get "mermaid") }}
|
||||||
<!-- Include mermaid only first time -->
|
<!-- Include mermaid only first time -->
|
||||||
<script defer src="{{ index .Site.Data.assets "js/mermaid.min.js" | relURL }}"></script>
|
<script defer src="{{ index .Site.Data.assets "js/mermaid.min.js" | relURL }}"></script>
|
||||||
<script>
|
<script defer src="{{ index .Site.Data.assets "js/mermaid-loader.min.js" | relURL }}"></script>
|
||||||
document.addEventListener("DOMContentLoaded", function(event) {
|
|
||||||
mermaid.initialize({
|
|
||||||
flowchart: { useMaxWidth: true }
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
{{ .Page.Scratch.Set "mermaid" true }}
|
{{ .Page.Scratch.Set "mermaid" true }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
3
src/js/clipboard-loader.js
Normal file
3
src/js/clipboard-loader.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
document.addEventListener("DOMContentLoaded", function (event) {
|
||||||
|
var clipboard = new ClipboardJS(".clip");
|
||||||
|
});
|
13
src/js/mermaid-loader.js
Normal file
13
src/js/mermaid-loader.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
document.addEventListener("DOMContentLoaded", function (event) {
|
||||||
|
let primaryColor = "#ececff";
|
||||||
|
let darkMode = false;
|
||||||
|
|
||||||
|
mermaid.initialize({
|
||||||
|
flowchart: { useMaxWidth: true },
|
||||||
|
theme: "base",
|
||||||
|
themeVariables: {
|
||||||
|
darkMode: darkMode,
|
||||||
|
primaryColor: primaryColor,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user