mirror of
https://github.com/tarampampam/error-pages.git
synced 2024-08-30 18:22:40 +00:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
94dff2421c | |||
51f8824659 | |||
e82c02c768 |
@ -4,6 +4,13 @@ All notable changes to this package will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog][keepachangelog] and this project adheres to [Semantic Versioning][semver].
|
||||
|
||||
## v2.10.1
|
||||
|
||||
### Fixed
|
||||
|
||||
- Template `shuffle`
|
||||
- Localization mistakes
|
||||
|
||||
## v2.10.0
|
||||
|
||||
### Changed
|
||||
|
14
l10n/l10n.js
14
l10n/l10n.js
@ -21,7 +21,7 @@ Object.defineProperty(window, 'l10n', {
|
||||
ru: 'Сервер не смог обработать запрос из-за ошибки в нём',
|
||||
uk: 'Сервер не міг обробити запит через помилку в ньому'
|
||||
},
|
||||
'Unauthorized': {ru: 'Не фвторизован', uk: 'Несанкціонований доступ'},
|
||||
'Unauthorized': {ru: 'Запрос не авторизован', uk: 'Несанкціонований доступ'},
|
||||
'The requested page needs a username and a password': {
|
||||
ru: 'Для доступа к странице требуется логин и пароль',
|
||||
uk: 'Щоб отримати доступ до сторінки, потрібний логін та пароль'
|
||||
@ -31,7 +31,7 @@ Object.defineProperty(window, 'l10n', {
|
||||
ru: 'Доступ к странице запрещён',
|
||||
uk: 'Доступ до сторінки заборонено'
|
||||
},
|
||||
'Not Found': {ru: 'Не найдено', uk: 'Не знайдено'},
|
||||
'Not Found': {ru: 'Ресурс не найден', uk: 'Ресурс не знайдено'},
|
||||
'The server can not find the requested page': {
|
||||
ru: 'Сервер не смог найти запрашиваемую страницу',
|
||||
uk: 'Сервер не міг знайти запитану сторінку'
|
||||
@ -48,15 +48,15 @@ Object.defineProperty(window, 'l10n', {
|
||||
},
|
||||
'Request Timeout': {ru: 'Истекло время ожидания', uk: 'Час запиту закінчився'},
|
||||
'The request took longer than the server was prepared to wait': {
|
||||
ru: 'Время ожидания сервером передачи от клиента истекло',
|
||||
uk: 'Трансфер термінів очікуваного сервера від клієнта закінчився'
|
||||
ru: 'Отправка запроса заняла слишком много времени',
|
||||
uk: 'Надсилання запиту зайняв занадто багато часу'
|
||||
},
|
||||
'Conflict': {ru: 'Конфликт', uk: 'Конфлікт'},
|
||||
'The request could not be completed because of a conflict': {
|
||||
ru: 'Запрос не может быть обработан из-за конфликта',
|
||||
uk: 'Запит не може бути оброблений через конфлікт'
|
||||
},
|
||||
'Gone': {ru: 'Удалён', uk: 'Зник'},
|
||||
'Gone': {ru: 'Удалено', uk: 'Вилучений'},
|
||||
'The requested page is no longer available': {
|
||||
ru: 'Запрошенная страница была удалена',
|
||||
uk: 'Запитана сторінка була видалена'
|
||||
@ -71,7 +71,7 @@ Object.defineProperty(window, 'l10n', {
|
||||
ru: 'Ни одно из условных полей заголовка запроса не было выполнено',
|
||||
uk: 'Жодна з умовних полів заголовка запиту не була виконана'
|
||||
},
|
||||
'Payload Too Large': {ru: 'Тело запроса слишком велико', uk: 'Тіло запиту перевищує допустимий розмір'},
|
||||
'Payload Too Large': {ru: 'Слишком большой запрос', uk: 'Занадто великий запит'},
|
||||
'The server will not accept the request, because the request entity is too large': {
|
||||
ru: 'Сервер не может обработать запрос, так как он слишком большой',
|
||||
uk: 'Сервер не може обробити запит, оскільки він занадто великий'
|
||||
@ -215,7 +215,7 @@ Object.defineProperty(window, 'l10n', {
|
||||
if (localized !== undefined) {
|
||||
$el.innerText = localized;
|
||||
} else {
|
||||
console.debug(`Unsupported l10n token detected: "${token}"`, $el);
|
||||
console.debug(`Unsupported l10n token detected: "${token}" (locale "${activeLocale}")`, $el);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -1,4 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
Error {{ code }}: {{ message }}
|
||||
Description: {{ description }}
|
||||
-->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
@ -259,4 +263,8 @@
|
||||
})(document.createElement('script'), document.body);
|
||||
}
|
||||
</script>
|
||||
<!--
|
||||
Error {{ code }}: {{ message }}
|
||||
Description: {{ description }}
|
||||
-->
|
||||
</html>
|
||||
|
@ -72,7 +72,10 @@
|
||||
<body>
|
||||
<div class="flex-center full-height">
|
||||
<div>
|
||||
<span id="error_text">{{ code }}: <span data-l10n>{{ message }}</span></span>
|
||||
<div id="error_text">
|
||||
<span class="source">{{ code }}: <span data-l10n>{{ message }}</span></span>
|
||||
<span class="target"></span>
|
||||
</div>
|
||||
{{ if show_details }}
|
||||
<div class="hidden" id="details">
|
||||
<table>
|
||||
@ -137,23 +140,74 @@
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
const $errorText = document.getElementById('error_text'),
|
||||
characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-=+<>,./?[{()}]!@#$%^&*~`\|'.split('');
|
||||
let text = $errorText.innerText, progress = 0;
|
||||
/**
|
||||
* @param {HTMLElement} $el
|
||||
*/
|
||||
const Shuffle = function ($el) {
|
||||
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-=+<>,./?[{()}]!@#$%^&*~`\|'.split(''),
|
||||
$source = $el.querySelector('.source'), $target = $el.querySelector('.target');
|
||||
|
||||
const scrambleInterval = window.setInterval(function () {
|
||||
let newText = text;
|
||||
let cursor = 0, scrambleInterval = undefined, cursorDelayInterval = undefined, cursorInterval = undefined;
|
||||
|
||||
for (let i = 0; i < text.length; i++) {
|
||||
if (i >= progress) {
|
||||
newText = newText.substr(0, i) +
|
||||
characters[Math.round(Math.random() * (characters.length - 1))] +
|
||||
newText.substr(i + 1);
|
||||
/**
|
||||
* @param {Number} len
|
||||
* @return {string}
|
||||
*/
|
||||
const getRandomizedString = function (len) {
|
||||
let s = '';
|
||||
|
||||
for (let i = 0; i < len; i++) {
|
||||
s += chars[Math.floor(Math.random() * chars.length)];
|
||||
}
|
||||
}
|
||||
|
||||
$errorText.innerText = newText;
|
||||
}, 450 / 60);
|
||||
return s;
|
||||
};
|
||||
|
||||
this.start = function () {
|
||||
$source.style.display = 'none';
|
||||
$target.style.display = 'block';
|
||||
|
||||
scrambleInterval = window.setInterval(() => {
|
||||
if (cursor <= $source.innerText.length) {
|
||||
$target.innerText = $source.innerText.substring(0, cursor) + getRandomizedString($source.innerText.length - cursor);
|
||||
}
|
||||
}, 450 / 30);
|
||||
|
||||
cursorDelayInterval = window.setTimeout(() => {
|
||||
cursorInterval = window.setInterval(() => {
|
||||
if (cursor > $source.innerText.length - 1) {
|
||||
this.stop();
|
||||
}
|
||||
|
||||
cursor++;
|
||||
}, 70);
|
||||
}, 350);
|
||||
};
|
||||
|
||||
this.stop = function () {
|
||||
$source.style.display = 'block';
|
||||
$target.style.display = 'none';
|
||||
$target.innerText = '';
|
||||
cursor = 0;
|
||||
|
||||
if (scrambleInterval !== undefined) {
|
||||
window.clearInterval(scrambleInterval);
|
||||
scrambleInterval = undefined;
|
||||
}
|
||||
|
||||
if (cursorInterval !== undefined) {
|
||||
window.clearInterval(cursorInterval);
|
||||
cursorInterval = undefined;
|
||||
}
|
||||
|
||||
if (cursorDelayInterval !== undefined) {
|
||||
window.clearInterval(cursorDelayInterval);
|
||||
cursorDelayInterval = undefined;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
(new Shuffle(document.getElementById('error_text'))).start();
|
||||
|
||||
// {{ if show_details }}
|
||||
window.setTimeout(function () {
|
||||
@ -161,22 +215,11 @@
|
||||
}, 550);
|
||||
// {{ end }}
|
||||
|
||||
window.setTimeout(function () {
|
||||
let revealInterval = window.setInterval(function () {
|
||||
if (progress < text.length) {
|
||||
progress++;
|
||||
} else {
|
||||
window.clearInterval(revealInterval);
|
||||
window.clearInterval(scrambleInterval);
|
||||
}
|
||||
}, 70);
|
||||
}, 350);
|
||||
|
||||
if (navigator.language.substring(0, 2).toLowerCase() !== 'en') {
|
||||
((s, p) => { // localize the page (details here - https://github.com/tarampampam/error-pages/tree/master/l10n)
|
||||
s.src = 'https://cdn.jsdelivr.net/gh/tarampampam/error-pages@2/l10n/l10n.min.js'; // '../l10n/l10n.js';
|
||||
s.async = s.defer = true;
|
||||
s.addEventListener('load', () => {p.removeChild(s); text = $errorText.innerText});
|
||||
s.addEventListener('load', () => p.removeChild(s));
|
||||
p.appendChild(s);
|
||||
})(document.createElement('script'), document.body);
|
||||
}
|
||||
|
Reference in New Issue
Block a user