Files
Maddie Zhan cd20f44d20 Sync PHP backend feature parity: IP detection, database backends, API endpoints, and frontend
- IP detection: Cloudflare IPv6, ULA IPv6, proxy header chain, offline GeoIP DB
- Database: add SQLite (pure Go, no CGo) and MSSQL backends
- API: add JSON result sharing endpoint and ID obfuscation
- Frontend: add modern CSS design, design switcher, favicon
- Compatibility: ?cors parameter support, human-friendly distance rounding
- Update Go to 1.21, add modernc.org/sqlite and maxminddb deps
2026-04-30 13:53:52 +08:00

46 lines
1.3 KiB
JavaScript

/**
* Feature switch for enabling the new LibreSpeed design
*
* This script checks for:
* 1. URL parameter: ?design=new or ?design=old
* 2. Default behavior: Shows the classic design
*
* Note: This script is only loaded on the root index.html
*/
(function () {
'use strict';
// Don't run this script if we're already on a specific design page
const currentPath = window.location.pathname;
if (currentPath.includes('index-classic.html') || currentPath.includes('index-modern.html')) {
return;
}
// Check URL parameters first
const urlParams = new URLSearchParams(window.location.search);
const designParam = urlParams.get('design');
if (designParam === 'new') {
redirectToNewDesign();
return;
}
if (designParam === 'old' || designParam === 'classic') {
redirectToOldDesign();
return;
}
// Default to classic design
redirectToOldDesign();
function redirectToNewDesign() {
const currentParams = window.location.search;
window.location.href = 'index-modern.html' + currentParams;
}
function redirectToOldDesign() {
const currentParams = window.location.search;
window.location.href = 'index-classic.html' + currentParams;
}
})();