Skip to content

Commit c71d99a

Browse files
author
SkyExploreWasTaken
authored
Merge branch 'JustStudio7:main' into main
2 parents ed871f3 + 8dc7e96 commit c71d99a

File tree

11 files changed

+146
-40
lines changed

11 files changed

+146
-40
lines changed

.github/workflows/publish.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ jobs:
2020
steps:
2121
- name: Checkout
2222
uses: actions/checkout@v4
23+
- name: test
24+
run: bash ${{ github.workspace }}/test.sh
2325
- name: npm
2426
id: install-npm
2527
run: npm i

_just/dangerously-insert-files/[email protected]

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,8 @@ const errors = [
178178
const knownErrors = [
179179
"InvalidCharacterError: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.",
180180
"InvalidCharacterError: Failed to execute 'atob' on 'Window': The string to be decoded contains characters outside of the Latin1 range.",
181-
"TypeError: txt.replaceAll is not a function. (In 'txt.replaceAll(key, value)', 'txt.replaceAll' is undefined)"
181+
"TypeError: txt.replaceAll is not a function. (In 'txt.replaceAll(key, value)', 'txt.replaceAll' is undefined)",
182+
"TypeError: txt.replaceAll is not a function"
182183
]
183184

184185
function checkNum0(num) {
@@ -193,31 +194,23 @@ function checkNum0(num) {
193194
}
194195

195196
function checkNum1(num) {
196-
let data005 = checkNum0(num / 2);
197-
let data006 = checkNum0(num / 3);
198-
let data007 = checkNum0(num / 4);
199-
let data008 = checkNum0(num / 5);
200-
let data009 = checkNum0(num / 6);
201-
let data010 = checkNum0(num / 7);
202-
let data011 = checkNum0(num / 8);
203-
let data012 = checkNum0(num / 9);
204197
return [
205-
data005,
206-
data006,
207-
data007,
208-
data008,
209-
data009,
210-
data010,
211-
data011,
212-
data012
198+
checkNum0(num / 2),
199+
checkNum0(num / 3),
200+
checkNum0(num / 4),
201+
checkNum0(num / 5),
202+
checkNum0(num / 6),
203+
checkNum0(num / 7),
204+
checkNum0(num / 8),
205+
checkNum0(num / 9)
213206
];
214207
}
215208

216209
function encode0(str) {
217-
let data013 = checkNum1(str.length);
210+
let checks = checkNum1(str.length);
218211
let result = [];
219212
for (let i = 2; i <= 9; i++) {
220-
if (data013[i - 2]) {
213+
if (checks[i - 2]) {
221214
let partLength = Math.floor(str.length / i);
222215
let parts = [];
223216
for (let j = 0; j < i; j++) {
@@ -595,6 +588,13 @@ function crypt(input, key) {
595588
}
596589
return output;
597590
}
591+
function throwNewError(catchedError, id_) {
592+
if (knownErrors.some((knownError) => {return knownError == catchedError})) {
593+
throw new Error(`${errors[0]} (${encode(id_, null, true)})`);
594+
} else {
595+
throw new Error(`${errors[1]} (${encode(catchedError, null, true)})`);
596+
}
597+
}
598598

599599
export const encode = (text, key, compress) => {
600600
let encd;
@@ -645,15 +645,15 @@ export const decode = (text, key) => {
645645
try {
646646
decd = decode2(encd);
647647
} catch (decodeError) {
648-
if (knownErrors.some((knownError) => {return knownError == decodeError})) {
649-
throw new Error(errors[0]);
650-
} else {
651-
throw new Error(`${errors[1]} (${encode(decodeError, true)})`);
652-
}
648+
throwNewError(decodeError, 'decode2(encd)');
653649
}
654650
if (dataID == 0 || dataID == 1 || dataID == 2 || dataID == 3) {
655-
let cLang = dataID == 0 ? 'EN' : dataID == 2 ? 'FR' : dataID == 3 ? 'UA' : 'RU';
656-
decd = decompress(decd, cLang);
651+
try {
652+
let cLang = dataID == 0 ? 'EN' : dataID == 2 ? 'FR' : dataID == 3 ? 'UA' : 'RU';
653+
decd = decompress(decd, cLang);
654+
} catch (decompressError) {
655+
throwNewError(decompressError, 'decompress(decd, cLang)');
656+
}
657657
}
658658
}
659659
if (decd.length == 0) {

_just/js/langcheck.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1+
/*
2+
3+
MIT License
4+
5+
Copyright (c) 2025 JustStudio. <https://juststudio.is-a.dev/>
6+
7+
Permission is hereby granted, free of charge, to any person obtaining a copy
8+
of this software and associated documentation files (the "Software"), to deal
9+
in the Software without restriction, including without limitation the rights
10+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
copies of the Software, and to permit persons to whom the Software is
12+
furnished to do so, subject to the following conditions:
13+
14+
The above copyright notice and this permission notice shall be included in all
15+
copies or substantial portions of the Software.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
SOFTWARE.
24+
25+
*/
26+
127
if (window.location.pathname == "/en") {
228
window.location.href = "/"
329
} else if (window.location.pathname == "/Encoder/en") {

_just/style/fix.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ SOFTWARE.
2424
2525
*/
2626

27-
button *:last-child:not(.home-text7):not(svg):not(svg *):not(a[href="/"] *) {
27+
button *:last-child:not(.home-text7):not(svg):not(svg *):not(a[href="/"] *):not(a[href="/ru"] *):not(a[href="/fr"] *):not(a[href="/ua"] *) {
2828
display: none;
2929
}
3030

locales/ua.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@
2121
"text-9": "Репозиторій у GitHub",
2222
"text-0": "<span>Репозиторій у GitHub ↗\n</span>",
2323

24-
"text_qeZ9a1": "<span>Язык программирования:\n</span>",
24+
"text_qeZ9a1": "<span>Мова програмування:\n</span>",
2525

2626
"docs-00": "",
2727
"docs-01": "Назад",
28-
"docs-02": "Как использовать",
29-
"docs-03": "Импортируйте функции <v>encode</v> и <v>decode</v>:",
30-
"docs-04": "Пример использования:",
31-
"docs-05": "Документация по ",
32-
"docs-06": "Что такое Encoder.js?",
33-
"docs-07": "Encoder.js это кодировщик текста для шифрования данных. Encoder.js кодирует текст в строчку, которая может содержать только URL-safe символы<small> (A-Za-z0-9 и -_().~)</small>. Encoder.js предназначен для браузеров (client-side, JavaScript) и server-side (JavaScript или TypeScript), но Encoder.js несовместим с Node.js, React.js, Next.js и тому подобными.",
34-
"docs-08": "Функция для кодирования текста. Обязательные входные данные: <v>text</v> - текст подлежащий кодированию, тип: <v>string</v>. Необязательные входные данные: <v>key</v> - ключ шифрования, тип: <v>string</v>; <v>compress</v> - выполнять ли сжатие текста (если возможно), тип: <v>boolean</v>. Тип выходных данных: <v>string</v>.\nВажно: Кодирование без ключа или кодирование с ключом похожим на текст или содержащим части текста - не лучшая идея.",
35-
"docs-09": "Функция для декодирования текста. Обязательные входные данные: <v>text</v> - текст подлежащий декодированию, тип: <v>string</v>. Необязательные входные данные: <v>key</v> - ключ шифрования, тип: <v>string</v>. Тип выходных данных: <v>string</v>.\nДанная функция может выдать ошибку если <v>text</v> в входных данных закодирован неправильно, либо был закодирован в другой версии Encoder.js, которая несовместима с используемой версией Encoder.js."
28+
"docs-02": "Як використовувати",
29+
"docs-03": "Імпортуйте функції <v>encode</v> и <v>decode</v>:",
30+
"docs-04": "Приклад використання:",
31+
"docs-05": "Документація по ",
32+
"docs-06": "Що таке Encoder.js?",
33+
"docs-07": "Encoder.js це кодувальник тексту для шифрування даних. Encoder.js кодує текст у рядок, який може містити тільки URL-safe символи<small> (A-Za-z0-9 та -_().~)</small>. Encoder.js призначений для браузерів (client-side, JavaScript) та server-side (JavaScript або TypeScript), але Encoder.js несумісний з Node.js, React.js, Next.js і тому подібними.",
34+
"docs-08": "Функція кодування тексту. Обов'язкові вхідні дані: <v>text</v> - текст, що підлягає кодуванню, тип: <v>string</v>. Необов'язкові вхідні дані: <v>key</v> - ключ шифрування, тип: <v>string</v>; <v>compress</v> - виконувати стиснення тексту (якщо можливо), тип: <v>boolean</v>. Тип вихідних даних: <v>string</v>.\nВажливо: Кодування без ключа або кодування з ключем схожим на текст або містить частини тексту - не найкраща ідея.",
35+
"docs-09": "Функція декодування тексту. Обов'язкові вхідні дані: <v>text</v> - текст, що підлягає декодуванню, тип: <v>string</v>. Необов'язкові вхідні дані: <v>key</v> - ключ шифрування, тип: <v>string</v>. Тип вихідних даних: <v>string</v>.\nЦя функція може видати помилку якщо <v>text</v> у вхідних даних закодовано неправильно, або було закодовано в іншій версії Encoder.js, яка несумісна з версією, що використовується Encoder.js."
3636

3737
}

pages/_document.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ class CustomDocument extends Document {
135135
errstr = "Произошла ошибка: Текст, подлежащий декодированию, закодирован неправильно."
136136
} else if (window.location.pathname == "/fr") {
137137
errstr = "Erreur: Le texte que vous souhaitez décoder n'est pas encodé correctement.";
138+
} else if (window.location.pathname == "/ua") {
139+
errstr = "Помилка: Текст, що підлягає декодуванню, неправильно закодований.";
138140
}
139141
return errstr;
140142
}

pages/docs/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ const Home = (props) => {
186186
easing="ease-in-out"
187187
iteration="1"
188188
>
189-
<a href="/" target="_self">
189+
<a href={`/${locale?.['short']}`.toLowerCase().replace('en','')} target="_self">
190190
<button
191191
type="button"
192192
data-thq-animate-on-reveal="true"

pages/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import { useTranslations } from 'next-intl'
3232

3333
import { useGlobalContext } from '@/global-context'
3434

35-
import { langcode } from '@/stuff/langcode';
35+
import { langcode, debug } from '@/stuff/langcode';
3636

3737
const Home = (props) => {
3838
const { locale, locales } = useGlobalContext()
@@ -90,9 +90,9 @@ const Home = (props) => {
9090
>
9191
<div>
9292
{locales.map((all_languages, index) => (
93-
<Link href={`https://encoder.js.is-a.dev/${langcode(index).replace('en','')}`}>
93+
<Link href={debug(`/${langcode(index).replace('en','')}`)}>
9494
<Fragment key={index}>
95-
<Link href={`https://encoder.js.is-a.dev/${langcode(index).replace('en','')}`}>
95+
<Link href={debug(`/${langcode(index).replace('en','')}`)}>
9696
<div className="home-language-switcher-item">
9797
<span className="home-language-link">
9898
{all_languages?.name}

pages/style.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,4 +764,15 @@ v {
764764
}
765765
.home-name:not(:first-of-type) {
766766
margin-top: 1rem;
767+
}
768+
.home-main02 {
769+
max-width: 400px !important;
770+
}
771+
@media(max-width: 470px) {
772+
.home-main02 {
773+
max-width: 70% !important;
774+
}
775+
}
776+
.home-name:first-of-type {
777+
text-align: center;
767778
}

stuff/langcode.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,33 @@
1+
2+
/*
3+
4+
MIT License
5+
6+
Copyright (c) 2025 JustStudio. <https://juststudio.is-a.dev/>
7+
8+
Permission is hereby granted, free of charge, to any person obtaining a copy
9+
of this software and associated documentation files (the "Software"), to deal
10+
in the Software without restriction, including without limitation the rights
11+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
copies of the Software, and to permit persons to whom the Software is
13+
furnished to do so, subject to the following conditions:
14+
15+
The above copyright notice and this permission notice shall be included in all
16+
copies or substantial portions of the Software.
17+
18+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24+
SOFTWARE.
25+
26+
*/
27+
128
export const langcode = (id) => {
229
return id == 1 ? 'ru' : id == 2 ? 'fr' : id == 3 ? 'ua' : 'en';
30+
}
31+
export const debug = (path) => {
32+
return path.replace(/\/(.*?)\/(.*?)/, '/$2');
333
}

0 commit comments

Comments
 (0)