From 6de36e83195e80ac4394a18cd8fb06336c484707 Mon Sep 17 00:00:00 2001 From: Saish Date: Fri, 22 May 2026 07:06:38 +0530 Subject: [PATCH 1/2] feat:add smooth scrolling to the website --- .../scripts}/benchmark_cache.py | 0 static/script.js | 39 +++++++++++++++++++ templates/404.html | 13 +++++++ templates/405.html | 13 +++++++ templates/500.html | 13 +++++++ templates/index.html | 1 + templates/project.html | 1 + 7 files changed, 80 insertions(+) rename {scripts => routes/scripts}/benchmark_cache.py (100%) diff --git a/scripts/benchmark_cache.py b/routes/scripts/benchmark_cache.py similarity index 100% rename from scripts/benchmark_cache.py rename to routes/scripts/benchmark_cache.py diff --git a/static/script.js b/static/script.js index 9d96ab93..22acf9b0 100644 --- a/static/script.js +++ b/static/script.js @@ -22,6 +22,45 @@ var fetchBtn = document.getElementById('btn-fetch-github'); var githubInput = document.getElementById('github-username'); var errorMsg = document.getElementById('github-modal-error'); +// ============================================================ +// Lenis Smooth Scrolling Initialization (runs on all pages) +// ============================================================ +(function initLenis() { + // Check if Lenis is available + if (typeof Lenis === 'undefined') return; + + const lenis = new Lenis({ + duration: 1.2, + easing: (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t)), + smoothWheel: true, + smoothTouch: false + }); + + function raf(time) { + lenis.raf(time); + requestAnimationFrame(raf); + } + + requestAnimationFrame(raf); + + // Integrate with anchor links + document.querySelectorAll('a[href^="#"]').forEach(anchor => { + anchor.addEventListener('click', function (e) { + const href = this.getAttribute('href'); + if (href === '#') return; + + e.preventDefault(); + const target = document.querySelector(href); + if (target) { + lenis.scrollTo(target, { + offset: 0, + duration: 1.2 + }); + } + }); + }); +})(); + // ============================================================ // Mobile navigation toggle (runs on all pages) diff --git a/templates/404.html b/templates/404.html index a04cc1db..7bd67ee1 100644 --- a/templates/404.html +++ b/templates/404.html @@ -22,5 +22,18 @@

Page Not Found

Back to Home + + diff --git a/templates/405.html b/templates/405.html index 350f963a..d73e08e5 100644 --- a/templates/405.html +++ b/templates/405.html @@ -21,5 +21,18 @@

Method Not Allowed

Back to Home + + \ No newline at end of file diff --git a/templates/500.html b/templates/500.html index 6e202d67..85c47ffd 100644 --- a/templates/500.html +++ b/templates/500.html @@ -21,5 +21,18 @@

Internal Server Error

Back to Home + + diff --git a/templates/index.html b/templates/index.html index d865868d..e8729826 100644 --- a/templates/index.html +++ b/templates/index.html @@ -716,6 +716,7 @@ + diff --git a/templates/project.html b/templates/project.html index 85fa9234..c4209c30 100644 --- a/templates/project.html +++ b/templates/project.html @@ -340,6 +340,7 @@