feat: embed threshold and index val of navbar into html/inline js (#241)

* feat: refactor image retrieval logic and improve variable initialization

- Add a new file `layouts/partials/function/getImageSlice.html`
- Initialize variables `$context`, `$Path`, and `$params`
- Set `$Path` based on the result of the `partial/function/currentMenuItem.html` partial
- Retrieve the page `$gallery` based on `$Path`
- Return all resources of type `image` from `$gallery`

* refactor: adapt getImageSlice function to `single.json`

* feat: refactor navigation UI components to use static go template

* feat: update navigation functionality and threshold rendering
This commit is contained in:
Spedon
2024-01-20 18:03:26 +08:00
committed by GitHub
parent ff1a76eef8
commit ae1a08eb82
4 changed files with 56 additions and 20 deletions

View File

@@ -36,11 +36,6 @@ const indexDispNums = Array.from(
*/
export function initNav(): void {
const s = state.get()
// init threshold text
updateThresholdText(expand(s.threshold))
// init index text
updateIndexText(expand(s.index + 1), expand(s.length))
// add watcher for updating nav text
state.addWatcher((o) => {
updateIndexText(expand(o.index + 1), expand(o.length))