dynamic load of javascript files now knows its relative path...
This commit is contained in:
parent
6bb117b2f5
commit
f864c9764f
|
@ -53,11 +53,14 @@ window.addEventListener('DOMContentLoaded', (e) => {
|
|||
document.querySelector("#TableOfContents > ol:first-child").insertBefore(s, document.querySelector("#TableOfContents > ol:first-child").firstChild)
|
||||
|
||||
if (document.querySelector(".soundcite")) {
|
||||
let relPath ="../".repeat(relPathDepth - 1);
|
||||
|
||||
var popcorn = document.createElement('script');
|
||||
popcorn.src = `/js/popcorn.min.js`;
|
||||
popcorn.src = `${relPath}js/popcorn.min.js`;
|
||||
document.body.appendChild(popcorn);
|
||||
|
||||
var soundcite = document.createElement('script');
|
||||
soundcite.src = `/js/soundcite.min.js`;
|
||||
soundcite.src = `${relPath}js/soundcite.min.js`;
|
||||
document.body.appendChild(soundcite);
|
||||
|
||||
}
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
<link rel="manifest" href="/site.webmanifest">
|
||||
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#996561">
|
||||
|
||||
<script type="text/javascript">var relPathDepth = {{ .RelPermalink | strings.Count "/" }};</script>
|
||||
|
||||
{{ $sjsopts := dict "targetPath" "js/sandpoints.js" "minify" "true"}}
|
||||
{{ $sjs := resources.Get "js/sandpoints.js" | js.Build $sjsopts }}
|
||||
<script defer src='{{ $sjs.Permalink }}' type="application/javascript"></script>
|
||||
|
|
Loading…
Reference in New Issue