chore: fixes
This commit is contained in:
parent
902d54a078
commit
259fb2c7ed
2 changed files with 6 additions and 26 deletions
|
|
@ -527,6 +527,6 @@ With the recent trend of internet censorship I have been thinking about alternat
|
||||||
<script src="javascript/carousel.js"></script>
|
<script src="javascript/carousel.js"></script>
|
||||||
<script src="javascript/view-counter.js"></script>
|
<script src="javascript/view-counter.js"></script>
|
||||||
<script src="javascript/nav-music.js"></script>
|
<script src="javascript/nav-music.js"></script>
|
||||||
<script src="javascript/legacy-check.js"
|
<script src="javascript/legacy-check.js"</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -1,39 +1,19 @@
|
||||||
// legacy-redirect.js
|
// dsi-3ds-redirect.js
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
const legacyURL = "http://www.veltron.net/legacy.html";
|
const legacyURL = "http://www.veltron.net/legacy.html";
|
||||||
|
|
||||||
|
// Detect Nintendo DSi / 3DS browsers
|
||||||
const ua = navigator.userAgent || "";
|
const ua = navigator.userAgent || "";
|
||||||
|
|
||||||
// --- Target DSi / 3DS specifically ---
|
|
||||||
const isDSiOr3DS =
|
const isDSiOr3DS =
|
||||||
ua.includes("Nintendo DSi") ||
|
ua.includes("Nintendo DSi") ||
|
||||||
ua.includes("Nintendo 3DS");
|
ua.includes("Nintendo 3DS");
|
||||||
|
|
||||||
// --- Optional broader legacy browser checks ---
|
const isAlreadyLegacy = window.location.href === legacyURL;
|
||||||
const isOldIE =
|
|
||||||
ua.includes("MSIE") || ua.includes("Trident/");
|
|
||||||
|
|
||||||
const isOperaMini =
|
// Redirect if on DSi/3DS and not already on the legacy page
|
||||||
ua.includes("Opera Mini");
|
if (isDSiOr3DS && !isAlreadyLegacy) {
|
||||||
|
|
||||||
// Very old / limited mobile browsers fallback (optional)
|
|
||||||
const isVeryOldMobile =
|
|
||||||
/Android 2|Android 3|Symbian|webOS|BlackBerry/i.test(ua);
|
|
||||||
|
|
||||||
// Combine rules
|
|
||||||
const isLegacyBrowser =
|
|
||||||
isDSiOr3DS || isOldIE || isOperaMini || isVeryOldMobile;
|
|
||||||
|
|
||||||
// Prevent redirect loop
|
|
||||||
const alreadyOnLegacy =
|
|
||||||
window.location.href.startsWith(legacyURL);
|
|
||||||
|
|
||||||
// Optional override (useful for testing)
|
|
||||||
const bypass =
|
|
||||||
new URLSearchParams(window.location.search).has("noredirect");
|
|
||||||
|
|
||||||
if (isLegacyBrowser && !alreadyOnLegacy && !bypass) {
|
|
||||||
window.location.href = legacyURL;
|
window.location.href = legacyURL;
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue