refactor: move frontend JS to external files and enable strict CSP
This commit is contained in:
+3
-18
@@ -4,7 +4,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Ошибка — WhatIDo</title>
|
||||
<link rel="stylesheet" href="admin.css">
|
||||
<link rel="stylesheet" href="/admin.css">
|
||||
<style>
|
||||
.error-page{display:flex;align-items:center;justify-content:center;min-height:100dvh;padding:24px;text-align:center}
|
||||
.error-card{background:var(--card);border:1px solid var(--border);border-radius:var(--radius);padding:48px 40px;max-width:400px;width:100%}
|
||||
@@ -29,7 +29,7 @@
|
||||
<p class="error-message" id="errorMessage">Запрашиваемая страница не существует или была перемещена.</p>
|
||||
<div class="error-actions">
|
||||
<a href="/" class="ghost">На главную</a>
|
||||
<button onclick="history.back()">Назад</button>
|
||||
<button type="button" id="backBtn">Назад</button>
|
||||
</div>
|
||||
<div class="error-details" id="errorDetails" style="display:none">
|
||||
<strong>Детали:</strong>
|
||||
@@ -37,21 +37,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
(function(){
|
||||
const params = new URLSearchParams(location.search);
|
||||
const code = params.get('code') || '404';
|
||||
const title = params.get('title') || '';
|
||||
const message = params.get('message') || '';
|
||||
const details = params.get('details') || '';
|
||||
document.getElementById('errorCode').textContent = code;
|
||||
document.getElementById('errorTitle').textContent = title || (code === '404' ? 'Страница не найдена' : 'Ошибка');
|
||||
document.getElementById('errorMessage').textContent = message || (code === '404' ? 'Запрашиваемая страница не существует или была перемещена.' : 'Произошла ошибка на сервере.');
|
||||
if (details) {
|
||||
document.getElementById('errorDetails').style.display = 'block';
|
||||
document.getElementById('errorStack').textContent = details;
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
<script src="/js/error.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user