mirror of
https://github.com/alex-shpak/hugo-book.git
synced 2024-11-22 03:19:25 +00:00
#90, Move inline scripts to file in assets to allow overwrite
This commit is contained in:
parent
83f6c3d475
commit
c0bd5b5bb8
@ -167,6 +167,7 @@ disableKinds = ['taxonomy', 'taxonomyTerm']
|
||||
|
||||
# (Optional, default true) Enables search function with flexsearch,
|
||||
# Index is built on fly, therefore it might slowdown your website.
|
||||
# Configuration for indexing can be adjusted in i18n folder per language.
|
||||
BookSearch = true
|
||||
|
||||
# (Optional, default true) Enables comments template on pages
|
||||
|
7
assets/menu-reset.js
Normal file
7
assets/menu-reset.js
Normal file
@ -0,0 +1,7 @@
|
||||
(function() {
|
||||
var menu = document.querySelector("aside.book-menu nav");
|
||||
addEventListener("beforeunload", function(event) {
|
||||
localStorage.setItem("menu.scrollTop", menu.scrollTop);
|
||||
});
|
||||
menu.scrollTop = localStorage.getItem("menu.scrollTop");
|
||||
})();
|
@ -70,6 +70,7 @@ enableGitInfo = true
|
||||
|
||||
# (Optional, default true) Enables search function with flexsearch,
|
||||
# Index is built on fly, therefore it might slowdown your website.
|
||||
# Configuration for indexing can be adjusted in i18n folder per language.
|
||||
BookSearch = true
|
||||
|
||||
# (Optional, default true) Enables comments template on pages
|
||||
|
@ -68,6 +68,7 @@ params:
|
||||
|
||||
# (Optional, default true) Enables search function with flexsearch,
|
||||
# Index is built on fly, therefore it might slowdown your website.
|
||||
# Configuration for indexing can be adjusted in i18n folder per language.
|
||||
BookSearch: true
|
||||
|
||||
# (Optional, default true) Enables comments template on pages
|
||||
|
@ -13,12 +13,7 @@
|
||||
</nav>
|
||||
|
||||
<!-- Restore menu position as soon as possible to avoid flickering -->
|
||||
<script>
|
||||
(function() {
|
||||
var menu = document.querySelector("aside.book-menu nav");
|
||||
addEventListener("beforeunload", function(event) {
|
||||
localStorage.setItem("menu.scrollTop", menu.scrollTop);
|
||||
});
|
||||
menu.scrollTop = localStorage.getItem("menu.scrollTop");
|
||||
})();
|
||||
</script>
|
||||
{{ $script := resources.Get "menu-reset.js" | resources.Minify }}
|
||||
{{ with $script.Content }}
|
||||
<script>{{ . | safeJS }}</script>
|
||||
{{ end }}
|
||||
|
Loading…
Reference in New Issue
Block a user