1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
{{ if eq .Section "search" }}
<script defer src="https://cdn.jsdelivr.net/npm/art-template@4.13.2/lib/template-web.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/fuse.js@6.4.6/dist/fuse.min.js"></script>
{{ else if eq .Section "archives" }}
{{ else }}
<script defer src="https://cdn.jsdelivr.net/npm/medium-zoom@1.0.6/dist/medium-zoom.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/lazysizes@5.3.0/lazysizes.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/components/prism-core.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/autoloader/prism-autoloader.min.js"></script>
{{ end }}
{{ $options := (dict "targetPath" "assets/js/fuji.min.js" "minify" true "target" "es2015" "format" "iife") }}
{{ $built := resources.Get "js/fuji.js" | js.Build $options }}
<script defer src="{{ $built.RelPermalink }}"></script>
{{ if or .Params.math .Site.Params.math }}
{{ partial "math.html" . }}
{{ end }}
{{ with .Params.aplayer }}
<script src="https://cdn.jsdelivr.net/npm/aplayer@1.10.1/dist/APlayer.min.js"></script>
<script>
// in-post aplayer
var pContainers = document.querySelectorAll('.content article .post-aplayer');
if (pContainers && pContainers.length > 0) {
pContainers.forEach(function (container) {
var attrs = ['urls', 'names', 'artists', 'covers'];
attrs = attrs.map(function (attr) {
var arr = container.getAttribute('data-' + attr).replace(/( |%20)/ig, '').split(',');
if (arr.length > 0){
return arr.map(function (val) {
return String(val).trim();
});
} else {
return attr;
}
});
var audio = [];
for (var i = 0; i < attrs[0].length; i++) {
var a = {
name: attrs[1][i],
url: attrs[0][i],
};
(typeof attrs[2] !== 'string') && (a.artist = attrs[2][i]);
(typeof attrs[3] !== 'string') && (a.cover = attrs[3][i]);
audio.push(a);
}
new APlayer({
container: container,
theme: '#8f82bc',
volume: 0.1,
listFolded: true,
audio: audio
});
});
}
// aplayer toc anchors fix
// see https://github.com/MoePlayer/APlayer/issues/242#issuecomment-602471423
document.addEventListener('DOMContentLoaded', function () {
var issueTocEle = document.querySelector('.sidebar-toc');
if (issueTocEle) {
var newTocEle = issueTocEle.cloneNode(true);
issueTocEle.parentNode.replaceChild(newTocEle, issueTocEle);
}
});
</script>
{{ end }}
|