mirror of
https://github.com/Wonderfall/hugo-WonderMod.git
synced 2024-11-22 10:31:39 +01:00
Change .Site.BaseURL
to absURL
, refine js code
This commit is contained in:
parent
67767c62c2
commit
daef16b004
@ -6,27 +6,29 @@
|
|||||||
<span>·</span>
|
<span>·</span>
|
||||||
<span>Theme️ <a href="https://github.com/nanxiaobei/hugo-paper" rel="noopener" target="_blank">Paper</a></span>
|
<span>Theme️ <a href="https://github.com/nanxiaobei/hugo-paper" rel="noopener" target="_blank">Paper</a></span>
|
||||||
</footer>
|
</footer>
|
||||||
<script src="{{.Site.BaseURL}}js/instantclick.min.js" data-no-instant></script>
|
<script src="{{ "js/instantclick.min.js" | absURL }}" data-no-instant></script>
|
||||||
<script data-no-instant>InstantClick.init();</script>
|
<script data-no-instant>InstantClick.init();</script>
|
||||||
<script src="{{.Site.BaseURL}}js/highlight.min.js" data-no-instant></script>
|
<script src="{{ "js/highlight.min.js" | absURL }}" data-no-instant></script>
|
||||||
<script data-no-instant>
|
<script data-no-instant>
|
||||||
hljs.initHighlightingOnLoad();
|
let body;
|
||||||
setMenuListener();
|
function menuToggleListener() {
|
||||||
|
body.classList.toggle('no-scroll');
|
||||||
|
}
|
||||||
|
function setMenuToggleListener() {
|
||||||
|
const menuToggle = document.querySelector('.menu-toggle');
|
||||||
|
body = document.querySelector('body');
|
||||||
|
menuToggle.addEventListener('click', menuToggleListener);
|
||||||
|
}
|
||||||
|
|
||||||
InstantClick.on('change', function() {
|
hljs.initHighlightingOnLoad();
|
||||||
|
setMenuToggleListener();
|
||||||
|
|
||||||
|
InstantClick.on('change', function () {
|
||||||
document.querySelectorAll('pre code').forEach((block) => {
|
document.querySelectorAll('pre code').forEach((block) => {
|
||||||
hljs.highlightBlock(block);
|
hljs.highlightBlock(block);
|
||||||
});
|
});
|
||||||
setMenuListener();
|
setMenuToggleListener();
|
||||||
});
|
});
|
||||||
|
|
||||||
function setMenuListener() {
|
|
||||||
var menuToggle = document.querySelector('.menu-toggle');
|
|
||||||
var body = document.querySelector('body');
|
|
||||||
menuToggle.addEventListener('click', function() {
|
|
||||||
body.classList.toggle('no-scroll');
|
|
||||||
}, false);
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user