|
|
76f6f4ea32
|
refactor: extract JavaScript utilities to separate modules (Phase 2)
- Created reusable utility modules:
* static/js/utils/stringUtils.js - string operations (esc, norm, escAttr, truncate, getInitials)
* static/js/utils/timing.js - timing utilities (debounce, throttle, delay, poll, once)
* static/js/utils/scroll.js - scroll helpers (smoothScrollTo, scrollToTop, isElementInViewport, etc.)
- Updated static/js/utils/index.js:
* Exports all utilities from a single entry point
* Provides centralized access to all utility functions
- Modified base.html:
* Removed inline esc() and norm() function definitions
* Added ES6 module imports for utilities
* Exported utilities to window for backward compatibility
* All existing code continues to work without changes
Benefits:
- Eliminates code duplication (esc/norm found in 9 templates)
- Centralizes utility functions for easier maintenance
- Enables future improvements (testing, optimization)
- Maintains backward compatibility with existing templates
Tests: All 12 static file tests passing ✅
|
2025-10-28 08:37:02 +03:00 |
|