From 8af573d7d639f96a9444b384a6936bae01d448a7 Mon Sep 17 00:00:00 2001 From: toshimaru Date: Tue, 21 Sep 2021 09:16:10 +0900 Subject: [PATCH 1/3] Add navigation toggle animation FIXME: should be replaced with Vanilla JS and CSS --- src/assets/js/app.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/assets/js/app.js b/src/assets/js/app.js index 90c5f5243f..634b10f6ec 100644 --- a/src/assets/js/app.js +++ b/src/assets/js/app.js @@ -6,11 +6,15 @@ $(() => { // highlight.js hljs.highlightAll(); - $("#navigation").load(`${config.rootPath}navigation.html`, function() { - $(".sidebar-sticky .icon").on("click", function (e) { - $(this).siblings("ul").toggle(); + $("#navigation").load(`${config.rootPath}navigation.html`, () => { + // Toggle child lists + $(".sidebar-sticky .icon").on("click", function () { + // FIXME: use vanilla JS and CSS instead of jQuery + $(this).siblings("ul").toggle(500); this.classList.toggle("icon-opened"); }); + + // Activate current page $(`.sidebar-content a[href='${window.location.pathname}']`) .attr("class", "active-link") .parents('ul') From 00a0aa686f418f7b477e0b2121754faaa005129c Mon Sep 17 00:00:00 2001 From: toshimaru Date: Tue, 21 Sep 2021 09:42:56 +0900 Subject: [PATCH 2/3] Create navigation.js --- src/_layouts/default.html | 1 + src/assets/js/app.js | 15 --------------- src/assets/js/navigation.js | 16 ++++++++++++++++ 3 files changed, 17 insertions(+), 15 deletions(-) create mode 100644 src/assets/js/navigation.js diff --git a/src/_layouts/default.html b/src/_layouts/default.html index 8585a64ada..274b46798c 100644 --- a/src/_layouts/default.html +++ b/src/_layouts/default.html @@ -78,6 +78,7 @@ + diff --git a/src/assets/js/app.js b/src/assets/js/app.js index 634b10f6ec..d766b1b35b 100644 --- a/src/assets/js/app.js +++ b/src/assets/js/app.js @@ -5,19 +5,4 @@ $(() => { // highlight.js hljs.highlightAll(); - - $("#navigation").load(`${config.rootPath}navigation.html`, () => { - // Toggle child lists - $(".sidebar-sticky .icon").on("click", function () { - // FIXME: use vanilla JS and CSS instead of jQuery - $(this).siblings("ul").toggle(500); - this.classList.toggle("icon-opened"); - }); - - // Activate current page - $(`.sidebar-content a[href='${window.location.pathname}']`) - .attr("class", "active-link") - .parents('ul') - .show(); - }) }); diff --git a/src/assets/js/navigation.js b/src/assets/js/navigation.js new file mode 100644 index 0000000000..9e005037b5 --- /dev/null +++ b/src/assets/js/navigation.js @@ -0,0 +1,16 @@ +$(() => { + $("#navigation").load(`${config.rootPath}navigation.html`, () => { + // Toggle child lists + $(".sidebar-sticky .icon").on("click", function () { + this.classList.toggle("icon-opened"); + // FIXME: use vanilla JS and CSS instead of jQuery + $(this).siblings("ul").toggle(500); + }); + + // Activate current page + $(`.sidebar-content a[href='${window.location.pathname}']`) + .attr("class", "active-link") + .parents('ul') + .show(); + }) +}); From 82b383b5ee99129a39100241a06ce2d022790688 Mon Sep 17 00:00:00 2001 From: toshimaru Date: Thu, 10 Mar 2022 17:00:19 +0900 Subject: [PATCH 3/3] Add input just before navigation --- src/_layouts/default.html | 1 + 1 file changed, 1 insertion(+) diff --git a/src/_layouts/default.html b/src/_layouts/default.html index 274b46798c..11e67d8530 100644 --- a/src/_layouts/default.html +++ b/src/_layouts/default.html @@ -55,6 +55,7 @@