refactor: move frontend JS to external files and enable strict CSP
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
(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());
|
||||
Reference in New Issue
Block a user