dark mode
This commit is contained in:
@ -7,13 +7,13 @@
|
||||
<a href="{{ url_for('router_details', router_id=backup1.router_id) }}" class="btn btn-secondary mt-3">Powrót</a>
|
||||
</div>
|
||||
|
||||
<!-- Dodajemy diff2html -->
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/diff2html/bundles/css/diff2html.min.css" />
|
||||
<script src="https://cdn.jsdelivr.net/npm/diff2html/bundles/js/diff2html.min.js"></script>
|
||||
<!-- Ładujemy nowszą wersję diff2html -->
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/diff2html@3.4.4/bundles/css/diff2html.min.css" />
|
||||
<script src="https://cdn.jsdelivr.net/npm/diff2html@3.4.4/bundles/js/diff2html.min.js"></script>
|
||||
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
// Upewnij się, że diff_text jest poprawnie escapowany
|
||||
// Escapowany diff_text z serwera
|
||||
var diffText = `{{ diff_text|e }}`;
|
||||
var targetElement = document.getElementById("diffContainer");
|
||||
var configuration = {
|
||||
@ -23,7 +23,19 @@
|
||||
};
|
||||
var diffHtml = Diff2Html.html(diffText, configuration);
|
||||
targetElement.innerHTML = diffHtml;
|
||||
|
||||
// Jeśli tryb ciemny jest aktywny, dołącz dodatkowe style dla diff2html
|
||||
if(document.documentElement.classList.contains('dark-mode')) {
|
||||
var darkStyle = document.createElement('style');
|
||||
darkStyle.textContent = `
|
||||
.d2h-wrapper { background-color: #1e1e1e; color: #fff; }
|
||||
.d2h-file-header { background-color: #2e2e2e; color: #fff; }
|
||||
.d2h-diff-table { background-color: #1e1e1e; color: #fff; }
|
||||
.d2h-code-line { background-color: #1e1e1e; color: #fff; }
|
||||
.d2h-code-line-ctn { color: #fff; }
|
||||
`;
|
||||
document.head.appendChild(darkStyle);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
GET | 200 | 45 ms
|
Reference in New Issue
Block a user