- Created template_helpers.py for centralized template rendering - Added ux_features.css for enhanced UX styling - Implemented JavaScript modules for: - Keyboard shortcuts (Ctrl+K, Ctrl+R navigation) - User preferences persistence - Undo/redo functionality (Ctrl+Z/Ctrl+Y) - Mobile responsive features - Touch gesture support - Accessibility features (ARIA, focus management) - Screen reader support - Color contrast compliance (WCAG) - Multi-screen support - Updated page_controller.py and error_controller.py to use template helpers - Created comprehensive template integration tests - All templates verified: index.html, login.html, setup.html, queue.html, error.html - Maintained responsive layout and theme switching - Updated instructions.md (removed completed task) - Updated infrastructure.md with template integration details
81 lines
1.8 KiB
JavaScript
81 lines
1.8 KiB
JavaScript
/**
|
|
* Mobile Responsive Module
|
|
* Handles mobile-specific functionality and responsive behavior
|
|
*/
|
|
|
|
(function() {
|
|
'use strict';
|
|
|
|
let isMobile = false;
|
|
|
|
/**
|
|
* Initialize mobile responsive features
|
|
*/
|
|
function initMobileResponsive() {
|
|
detectMobile();
|
|
setupResponsiveHandlers();
|
|
console.log('[Mobile Responsive] Initialized');
|
|
}
|
|
|
|
/**
|
|
* Detect if device is mobile
|
|
*/
|
|
function detectMobile() {
|
|
isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
|
|
if (isMobile) {
|
|
document.body.classList.add('mobile-device');
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Setup responsive event handlers
|
|
*/
|
|
function setupResponsiveHandlers() {
|
|
window.addEventListener('resize', handleResize);
|
|
handleResize(); // Initial call
|
|
}
|
|
|
|
/**
|
|
* Handle window resize
|
|
*/
|
|
function handleResize() {
|
|
const width = window.innerWidth;
|
|
|
|
if (width < 768) {
|
|
applyMobileLayout();
|
|
} else {
|
|
applyDesktopLayout();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Apply mobile-specific layout
|
|
*/
|
|
function applyMobileLayout() {
|
|
document.body.classList.add('mobile-layout');
|
|
document.body.classList.remove('desktop-layout');
|
|
}
|
|
|
|
/**
|
|
* Apply desktop-specific layout
|
|
*/
|
|
function applyDesktopLayout() {
|
|
document.body.classList.add('desktop-layout');
|
|
document.body.classList.remove('mobile-layout');
|
|
}
|
|
|
|
// Export functions
|
|
window.MobileResponsive = {
|
|
isMobile: () => isMobile
|
|
};
|
|
|
|
// Initialize on DOM ready
|
|
if (document.readyState === 'loading') {
|
|
document.addEventListener('DOMContentLoaded', initMobileResponsive);
|
|
} else {
|
|
initMobileResponsive();
|
|
}
|
|
|
|
})();
|