Mateusz Gruszczyński a17423aaa1 new css and functions
2025-02-27 00:29:52 +01:00

69 lines
2.6 KiB
HTML

{% extends "base.html" %}
{% block title %}Strona główna - RouterOS Update{% endblock %}
{% block content %}
<div class="d-flex flex-column align-items-center justify-content-center" style="min-height: 80vh;">
<div class="text-center">
<img id="logo-img" src="https://mikrotik.com/logo/assets/logo-colors-dark-ToiqSI6u.svg" alt="Mikrotik Logo" class="img-fluid" style="max-width: 200px;">
<h1 class="mt-3">Witamy w RouterOS Update</h1>
<p class="lead">Zarządzaj aktualizacjami swoich urządzeń RouterOS w prosty sposób.</p>
<div class="mt-4">
<a href="{{ url_for('login') }}" class="btn btn-primary btn-lg me-3">Login</a>
<a href="{{ url_for('register') }}" class="btn btn-success btn-lg">Rejestracja</a>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const darkModeToggle = document.getElementById('darkModeToggle');
function updatePrismTheme() {
const prismLink = document.getElementById('prism-style');
if (prismLink) {
if (localStorage.getItem("darkMode") === "enabled") {
prismLink.setAttribute('href', 'https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-okaidia.min.css');
} else {
prismLink.setAttribute('href', 'https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-coy.min.css');
}
}
}
function updateTheme() {
if (localStorage.getItem("darkMode") === "enabled") {
document.body.classList.add("dark-mode");
document.body.classList.remove("light-mode");
darkModeToggle.checked = true;
} else {
document.body.classList.add("light-mode");
document.body.classList.remove("dark-mode");
darkModeToggle.checked = false;
}
updatePrismTheme();
updateLogoImage();
}
// Nowa funkcja: dynamicznie aktualizuje logo, jeśli element istnieje
function updateLogoImage() {
const logo = document.getElementById("logo-img");
if (logo) {
if (localStorage.getItem("darkMode") === "enabled") {
logo.src = "https://mikrotik.com/logo/assets/logo-colors-white-E8duxH7y.svg";
} else {
logo.src = "https://mikrotik.com/logo/assets/logo-colors-dark-ToiqSI6u.svg";
}
}
}
darkModeToggle.addEventListener('change', function() {
if (this.checked) {
localStorage.setItem("darkMode", "enabled");
} else {
localStorage.setItem("darkMode", "disabled");
}
updateTheme();
});
updateTheme();
});
</script>
{% endblock %}