20 lines
1.1 KiB
JavaScript
20 lines
1.1 KiB
JavaScript
(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;
|
|
}
|
|
})();
|
|
|
|
document.querySelector('.error-actions button').addEventListener('click', () => history.back());
|
|
|
|
fetch('/api/public-settings').then(r => r.ok ? r.json() : null).then(s => {
|
|
if (s && (s.system_name || '').trim()) document.title = `Ошибка — ${s.system_name}`;
|
|
}).catch(() => {}); |