turing-machine/Implementation/Client/wwwroot/index.html

74 lines
2.8 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>Turing Machine</title>
<base href="/" />
<link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />
<link href="css/app.css" rel="stylesheet" />
<link rel="icon" type="image/png" href="favicon.png" />
<link href="TuringMachine.Client.styles.css" rel="stylesheet" />
</head>
<body>
<div id="app">
<div style="display:flex;align-items:center;justify-content:center;height:100vh;font-family:sans-serif;color:#888;">
Loading...
</div>
</div>
<div id="blazor-error-ui">
An unhandled error has occurred.
<a href="" class="reload">Reload</a>
<a class="dismiss">🗙</a>
</div>
<script src="_framework/blazor.webassembly.js"></script>
<script>
// Initialize theme immediately on page load to prevent flash
(function () {
const savedTheme = localStorage.getItem('theme');
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
const theme = savedTheme || (prefersDark ? 'dark' : 'light');
document.documentElement.setAttribute('data-theme', theme);
})();
// Set page title based on saved language preference
(function () {
const lang = localStorage.getItem('lang') || 'en-US';
document.title = lang.startsWith('ko') ? '튜링 머신' : 'Turing Machine';
})();
// Set document title
window.setDocumentTitle = function (title) {
document.title = title;
};
// Get current theme
window.getTheme = function () {
return document.documentElement.getAttribute('data-theme') || 'light';
};
// Set theme
window.setTheme = function (theme) {
document.documentElement.setAttribute('data-theme', theme);
localStorage.setItem('theme', theme);
};
// Scroll to element within its parent container only (prevents full page scroll)
window.scrollToElement = function (elementId) {
const element = document.getElementById(elementId);
if (!element) return;
const container = element.closest('.transition-table');
if (!container) return;
const containerRect = container.getBoundingClientRect();
const elementRect = element.getBoundingClientRect();
const offsetTop = elementRect.top - containerRect.top + container.scrollTop;
const centerOffset = offsetTop - container.clientHeight / 2 + element.clientHeight / 2;
container.scrollTo({ top: centerOffset, behavior: 'smooth' });
};
</script>
</body>
</html>