refactor(UIFeatures): remove back to top button functionality for cleaner code
This commit is contained in:
parent
4a5a6fd53e
commit
7aa14208a3
1 changed files with 1 additions and 20 deletions
21
dist/js/app.js
vendored
21
dist/js/app.js
vendored
|
|
@ -735,8 +735,7 @@ class DataService {
|
||||||
|
|
||||||
// Fetch from network
|
// Fetch from network
|
||||||
try {
|
try {
|
||||||
const response = await Utils.fetchWithFallback(urls);
|
const data = await Utils.fetchWithFallback(urls);
|
||||||
const data = await response.json();
|
|
||||||
|
|
||||||
// Cache in memory and IndexedDB
|
// Cache in memory and IndexedDB
|
||||||
this.#cache.set(cacheKey, data);
|
this.#cache.set(cacheKey, data);
|
||||||
|
|
@ -2137,23 +2136,6 @@ const UIFeatures = (() => {
|
||||||
window.addEventListener('scroll', throttledUpdate, { passive: true });
|
window.addEventListener('scroll', throttledUpdate, { passive: true });
|
||||||
};
|
};
|
||||||
|
|
||||||
// Back to top button
|
|
||||||
const setupBackToTop = () => {
|
|
||||||
const btn = document.getElementById('backToTop');
|
|
||||||
if (!btn) return;
|
|
||||||
|
|
||||||
const updateVisibility = () => {
|
|
||||||
btn.classList.toggle('visible', window.pageYOffset > CONFIG.PERFORMANCE.SCROLL_THRESHOLD);
|
|
||||||
};
|
|
||||||
|
|
||||||
const throttledUpdate = Utils.throttle(updateVisibility, 150);
|
|
||||||
window.addEventListener('scroll', throttledUpdate, { passive: true });
|
|
||||||
|
|
||||||
btn.addEventListener('click', () => {
|
|
||||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Navigation highlight
|
// Navigation highlight
|
||||||
const setupNavHighlight = () => {
|
const setupNavHighlight = () => {
|
||||||
if (!('IntersectionObserver' in window)) return;
|
if (!('IntersectionObserver' in window)) return;
|
||||||
|
|
@ -2220,7 +2202,6 @@ const UIFeatures = (() => {
|
||||||
return Object.freeze({
|
return Object.freeze({
|
||||||
setupScrollAnimations,
|
setupScrollAnimations,
|
||||||
setupHeaderElevation,
|
setupHeaderElevation,
|
||||||
setupBackToTop,
|
|
||||||
setupNavHighlight,
|
setupNavHighlight,
|
||||||
setupURLComparison,
|
setupURLComparison,
|
||||||
setupOfflineDetection
|
setupOfflineDetection
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue