You've already forked speedtest-go
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
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
})();
|
||||
Reference in New Issue
Block a user