From c9cbc606e4cc9e579281fa0155044b5d018cfac3 Mon Sep 17 00:00:00 2001 From: Byson94 Date: Sat, 16 Aug 2025 12:46:23 +0530 Subject: [PATCH] feat: added home-button to docs --- docs/book.toml | 5 +++-- docs/js/home_button.js | 31 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 docs/js/home_button.js diff --git a/docs/book.toml b/docs/book.toml index d2d69ba..875f3d9 100644 --- a/docs/book.toml +++ b/docs/book.toml @@ -7,5 +7,6 @@ title = "Ewii documentation" [output.html] default-theme = "navy" -git-repository-url = "https://github.com/byson94/ewwii/tree/master/docs" -site-url = "/" \ No newline at end of file +git-repository-url = "https://github.com/Ewwii-sh/ewwii" +site-url = "/" +additional-js = ["js/home_button.js"] \ No newline at end of file diff --git a/docs/js/home_button.js b/docs/js/home_button.js new file mode 100644 index 0000000..8a3b76c --- /dev/null +++ b/docs/js/home_button.js @@ -0,0 +1,31 @@ +document.addEventListener("DOMContentLoaded", function () { + const homeBtn = document.createElement("a"); + homeBtn.href = "https://ewwii-sh.github.io/"; + homeBtn.innerText = "🏠︎"; + homeBtn.className = "home-button"; + + homeBtn.style.padding = "6px"; + homeBtn.style.backgroundColor = "transparent"; + homeBtn.style.color = "grey"; + homeBtn.style.borderRadius = "4px"; + homeBtn.style.textDecoration = "none"; + homeBtn.style.display = "inline-flex"; + homeBtn.style.alignItems = "center"; + homeBtn.style.justifyContent = "center"; + homeBtn.style.transition = "all 0.2s ease"; + + // Hover effect + homeBtn.addEventListener("mouseover", () => { + homeBtn.style.color = "#bbbbbb"; + homeBtn.style.transform = "scale(1.01)"; + }); + + homeBtn.addEventListener("mouseout", () => { + homeBtn.style.backgroundColor = "transparent"; + homeBtn.style.color = "grey"; + homeBtn.style.transform = "scale(1)"; + }); + + const header = document.querySelector(".right-buttons"); + if (header) header.appendChild(homeBtn); +});