inital-release

This commit is contained in:
mike
2025-12-16 14:57:51 +01:00
parent f545b1f278
commit 977aff0697
4 changed files with 1052 additions and 10 deletions

View File

@@ -1,6 +1,6 @@
// Device Detection and Redirect
(function() {
// Check if we're already on the correct page
// Check current page
const currentPage = window.location.pathname.split('/').pop() || 'index.html'
// Check if we've already redirected (prevent infinite loops)
@@ -9,16 +9,28 @@
return
}
// Detect mobile device
const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)
|| window.innerWidth < 768
// Detect device type
const width = window.innerWidth
const isMobileDevice = /Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)
const isTabletDevice = /iPad|Android/i.test(navigator.userAgent) && !isMobileDevice
// Only redirect if needed
if (isMobile && currentPage !== 'mobile.html') {
let targetPage = null
// Determine target page based on device and screen size
if (width < 600 || (isMobileDevice && width < 768)) {
// Mobile: < 600px or mobile device < 768px
targetPage = 'mobile.html'
} else if (width >= 600 && width < 1024) {
// Tablet: 600-1024px
targetPage = 'tablet.html'
} else {
// Desktop: >= 1024px
targetPage = 'index.html'
}
// Redirect if needed
if (currentPage !== targetPage) {
sessionStorage.setItem('hasRedirected', 'true')
window.location.href = 'mobile.html'
} else if (!isMobile && currentPage === 'mobile.html') {
sessionStorage.setItem('hasRedirected', 'true')
window.location.href = 'index.html'
window.location.href = targetPage
}
})()