Compare commits

..

3 Commits

Author SHA1 Message Date
94dff2421c Changelog updated 2022-03-24 13:54:50 +05:00
51f8824659 shuffle template fixed 2022-03-24 13:54:07 +05:00
e82c02c768 fix the translation mistakes 2022-03-24 12:28:03 +05:00
4 changed files with 91 additions and 33 deletions

View File

@ -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]. 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 ## v2.10.0
### Changed ### Changed

View File

@ -21,7 +21,7 @@ Object.defineProperty(window, 'l10n', {
ru: 'Сервер не смог обработать запрос из-за ошибки в нём', ru: 'Сервер не смог обработать запрос из-за ошибки в нём',
uk: 'Сервер не міг обробити запит через помилку в ньому' uk: 'Сервер не міг обробити запит через помилку в ньому'
}, },
'Unauthorized': {ru: 'Не фвторизован', uk: 'Несанкціонований доступ'}, 'Unauthorized': {ru: 'Запрос не авторизован', uk: 'Несанкціонований доступ'},
'The requested page needs a username and a password': { 'The requested page needs a username and a password': {
ru: 'Для доступа к странице требуется логин и пароль', ru: 'Для доступа к странице требуется логин и пароль',
uk: 'Щоб отримати доступ до сторінки, потрібний логін та пароль' uk: 'Щоб отримати доступ до сторінки, потрібний логін та пароль'
@ -31,7 +31,7 @@ Object.defineProperty(window, 'l10n', {
ru: 'Доступ к странице запрещён', ru: 'Доступ к странице запрещён',
uk: 'Доступ до сторінки заборонено' uk: 'Доступ до сторінки заборонено'
}, },
'Not Found': {ru: 'Не найдено', uk: 'Не знайдено'}, 'Not Found': {ru: 'Ресурс не найден', uk: 'Ресурс не знайдено'},
'The server can not find the requested page': { 'The server can not find the requested page': {
ru: 'Сервер не смог найти запрашиваемую страницу', ru: 'Сервер не смог найти запрашиваемую страницу',
uk: 'Сервер не міг знайти запитану сторінку' uk: 'Сервер не міг знайти запитану сторінку'
@ -48,15 +48,15 @@ Object.defineProperty(window, 'l10n', {
}, },
'Request Timeout': {ru: 'Истекло время ожидания', uk: 'Час запиту закінчився'}, 'Request Timeout': {ru: 'Истекло время ожидания', uk: 'Час запиту закінчився'},
'The request took longer than the server was prepared to wait': { 'The request took longer than the server was prepared to wait': {
ru: 'Время ожидания сервером передачи от клиента истекло', ru: 'Отправка запроса заняла слишком много времени',
uk: 'Трансфер термінів очікуваного сервера від клієнта закінчився' uk: 'Надсилання запиту зайняв занадто багато часу'
}, },
'Conflict': {ru: 'Конфликт', uk: 'Конфлікт'}, 'Conflict': {ru: 'Конфликт', uk: 'Конфлікт'},
'The request could not be completed because of a conflict': { 'The request could not be completed because of a conflict': {
ru: 'Запрос не может быть обработан из-за конфликта', ru: 'Запрос не может быть обработан из-за конфликта',
uk: 'Запит не може бути оброблений через конфлікт' uk: 'Запит не може бути оброблений через конфлікт'
}, },
'Gone': {ru: 'Удалён', uk: 'Зник'}, 'Gone': {ru: 'Удалено', uk: 'Вилучений'},
'The requested page is no longer available': { 'The requested page is no longer available': {
ru: 'Запрошенная страница была удалена', ru: 'Запрошенная страница была удалена',
uk: 'Запитана сторінка була видалена' uk: 'Запитана сторінка була видалена'
@ -71,7 +71,7 @@ Object.defineProperty(window, 'l10n', {
ru: 'Ни одно из условных полей заголовка запроса не было выполнено', ru: 'Ни одно из условных полей заголовка запроса не было выполнено',
uk: 'Жодна з умовних полів заголовка запиту не була виконана' 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': { 'The server will not accept the request, because the request entity is too large': {
ru: 'Сервер не может обработать запрос, так как он слишком большой', ru: 'Сервер не может обработать запрос, так как он слишком большой',
uk: 'Сервер не може обробити запит, оскільки він занадто великий' uk: 'Сервер не може обробити запит, оскільки він занадто великий'
@ -215,7 +215,7 @@ Object.defineProperty(window, 'l10n', {
if (localized !== undefined) { if (localized !== undefined) {
$el.innerText = localized; $el.innerText = localized;
} else { } else {
console.debug(`Unsupported l10n token detected: "${token}"`, $el); console.debug(`Unsupported l10n token detected: "${token}" (locale "${activeLocale}")`, $el);
} }
}); });
}; };

View File

@ -1,4 +1,8 @@
<!DOCTYPE html> <!DOCTYPE html>
<!--
Error {{ code }}: {{ message }}
Description: {{ description }}
-->
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"/> <meta charset="utf-8"/>
@ -259,4 +263,8 @@
})(document.createElement('script'), document.body); })(document.createElement('script'), document.body);
} }
</script> </script>
<!--
Error {{ code }}: {{ message }}
Description: {{ description }}
-->
</html> </html>

View File

@ -72,7 +72,10 @@
<body> <body>
<div class="flex-center full-height"> <div class="flex-center full-height">
<div> <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 }} {{ if show_details }}
<div class="hidden" id="details"> <div class="hidden" id="details">
<table> <table>
@ -137,23 +140,74 @@
<script> <script>
'use strict'; 'use strict';
const $errorText = document.getElementById('error_text'), /**
characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-=+<>,./?[{()}]!@#$%^&*~`\|'.split(''); * @param {HTMLElement} $el
let text = $errorText.innerText, progress = 0; */
const Shuffle = function ($el) {
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-=+<>,./?[{()}]!@#$%^&*~`\|'.split(''),
$source = $el.querySelector('.source'), $target = $el.querySelector('.target');
const scrambleInterval = window.setInterval(function () { let cursor = 0, scrambleInterval = undefined, cursorDelayInterval = undefined, cursorInterval = undefined;
let newText = text;
for (let i = 0; i < text.length; i++) { /**
if (i >= progress) { * @param {Number} len
newText = newText.substr(0, i) + * @return {string}
characters[Math.round(Math.random() * (characters.length - 1))] + */
newText.substr(i + 1); const getRandomizedString = function (len) {
let s = '';
for (let i = 0; i < len; i++) {
s += chars[Math.floor(Math.random() * chars.length)];
} }
}
$errorText.innerText = newText; return s;
}, 450 / 60); };
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 }} // {{ if show_details }}
window.setTimeout(function () { window.setTimeout(function () {
@ -161,22 +215,11 @@
}, 550); }, 550);
// {{ end }} // {{ 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') { 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, 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.src = 'https://cdn.jsdelivr.net/gh/tarampampam/error-pages@2/l10n/l10n.min.js'; // '../l10n/l10n.js';
s.async = s.defer = true; s.async = s.defer = true;
s.addEventListener('load', () => {p.removeChild(s); text = $errorText.innerText}); s.addEventListener('load', () => p.removeChild(s));
p.appendChild(s); p.appendChild(s);
})(document.createElement('script'), document.body); })(document.createElement('script'), document.body);
} }