From 31c85f4ef19df76fd3e108326549f43b24cc4f5c Mon Sep 17 00:00:00 2001 From: Eugene <59817721+SKZGx@users.noreply.github.com> Date: Wed, 17 Apr 2024 19:41:19 +0300 Subject: [PATCH] new file: ItemCategories.json renamed: icon/complicons/completed.svg -> complicons/completed.svg renamed: icon/complicons/semiverified.svg -> complicons/semiverified.svg renamed: icon/complicons/verify.svg -> complicons/verify.svg modified: css/item.css modified: css/translation.css deleted: icon/Adventure.svg deleted: icon/Cursed.svg deleted: icon/Decoration.svg deleted: icon/Economy.svg deleted: icon/Equipment.svg deleted: icon/Food.svg deleted: icon/GameMechanics.svg deleted: icon/Library.svg deleted: icon/Magic.svg deleted: icon/Management.svg deleted: icon/Minigame.svg deleted: icon/Mobs.svg deleted: icon/Optimization.svg deleted: icon/Social.svg deleted: icon/Storage.svg deleted: icon/Technology.svg deleted: icon/Transportation.svg deleted: icon/Utility.svg deleted: icon/WorldGeneration.svg new file: icon/output.txt modified: js/item.js --- ItemCategories.json | 97 +++++++++++++++++++ {icon/complicons => complicons}/completed.svg | 0 .../semiverified.svg | 0 {icon/complicons => complicons}/verify.svg | 0 css/item.css | 36 ++++++- css/translation.css | 2 +- icon/Adventure.svg | 1 - icon/Cursed.svg | 1 - icon/Decoration.svg | 1 - icon/Economy.svg | 1 - icon/Equipment.svg | 1 - icon/Food.svg | 1 - icon/GameMechanics.svg | 1 - icon/Library.svg | 1 - icon/Magic.svg | 1 - icon/Management.svg | 1 - icon/Minigame.svg | 1 - icon/Mobs.svg | 5 - icon/Optimization.svg | 1 - icon/Social.svg | 1 - icon/Storage.svg | 1 - icon/Technology.svg | 1 - icon/Transportation.svg | 1 - icon/Utility.svg | 1 - icon/WorldGeneration.svg | 1 - icon/output.txt | 38 ++++++++ js/item.js | 28 +++++- 27 files changed, 194 insertions(+), 30 deletions(-) create mode 100644 ItemCategories.json rename {icon/complicons => complicons}/completed.svg (100%) rename {icon/complicons => complicons}/semiverified.svg (100%) rename {icon/complicons => complicons}/verify.svg (100%) delete mode 100644 icon/Adventure.svg delete mode 100644 icon/Cursed.svg delete mode 100644 icon/Decoration.svg delete mode 100644 icon/Economy.svg delete mode 100644 icon/Equipment.svg delete mode 100644 icon/Food.svg delete mode 100644 icon/GameMechanics.svg delete mode 100644 icon/Library.svg delete mode 100644 icon/Magic.svg delete mode 100644 icon/Management.svg delete mode 100644 icon/Minigame.svg delete mode 100644 icon/Mobs.svg delete mode 100644 icon/Optimization.svg delete mode 100644 icon/Social.svg delete mode 100644 icon/Storage.svg delete mode 100644 icon/Technology.svg delete mode 100644 icon/Transportation.svg delete mode 100644 icon/Utility.svg delete mode 100644 icon/WorldGeneration.svg create mode 100644 icon/output.txt diff --git a/ItemCategories.json b/ItemCategories.json new file mode 100644 index 0000000..db83f83 --- /dev/null +++ b/ItemCategories.json @@ -0,0 +1,97 @@ +[ + { + "title" : "Пригоди", + "color" : "#7e292a", + "icon" : "" + }, + { + "title" : "Дивні", + "color" : "#7e292a", + "icon" : "" + }, + { + "title" : "Декорації", + "color" : "#7e292a", + "icon" : "" + }, + { + "title" : "Економіка", + "color" : "#7e292a", + "icon" : "" + }, + { + "title" : "Спорядження", + "color" : "#7e292a", + "icon" : "" + }, + { + "title" : "Їжа", + "color" : "#7e292a", + "icon" : "" + }, + { + "title" : "Ігрові механіки", + "color" : "#7e292a", + "icon" : " " + }, + { + "title" : "Бібліотеки", + "color" : "#7e292a", + "icon" : "" + }, + { + "title" : "Магія", + "color" : "#7e292a", + "icon" : "" + }, + { + "title" : "Управління", + "color" : "#7e292a", + "icon" : "" + }, + { + "title" : "Міні-гри", + "color" : "#7e292a", + "icon" : "" + }, + { + "title" : "Моби", + "color" : "#7e292a", + "icon" : "" + }, + { + "title" : "Оптимізація", + "color" : "#7e292a", + "icon" : "" + }, + { + "title" : "Соціальні", + "color" : "#7e292a", + "icon" : "" + }, + { + "title" : "Зберігання", + "color" : "#7e292a", + "icon" : "" + }, + { + "title" : "Технології", + "color" : "#7e292a", + "icon" : " " + }, + { + "title" : "Транспортування", + "color" : "#7e292a", + "icon" : " " + }, + { + "title" : "Корисні функції", + "color" : "#7e292a", + "icon" : "" + }, + { + "title" : "Генерація створення", + "color" : "#7e292a", + "icon" : "" + } +] diff --git a/icon/complicons/completed.svg b/complicons/completed.svg similarity index 100% rename from icon/complicons/completed.svg rename to complicons/completed.svg diff --git a/icon/complicons/semiverified.svg b/complicons/semiverified.svg similarity index 100% rename from icon/complicons/semiverified.svg rename to complicons/semiverified.svg diff --git a/icon/complicons/verify.svg b/complicons/verify.svg similarity index 100% rename from icon/complicons/verify.svg rename to complicons/verify.svg diff --git a/css/item.css b/css/item.css index 95f8e35..f8a8e1a 100644 --- a/css/item.css +++ b/css/item.css @@ -167,7 +167,7 @@ } .buttonContainer { - margin-top: 10px; + margin-top: 15px; display: flex; flex-direction: row; flex-wrap: wrap; @@ -185,4 +185,36 @@ font-family: Inter, -apple-system, BlinkMacSystemFont, Segoe UI, Oxygen, Ubuntu, Roboto, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; font-weight: 500; text-align: center; -} \ No newline at end of file +} + +.categories { + display: flex; + flex-direction: row; + flex-wrap: wrap; + row-gap: 4px; +} + +.category { + display: flex; + flex-direction: row; + align-items: center; + padding: 0 5px; + border-radius: 0.2rem; +} + +.category-icon { + display: flex; + align-items: center; + justify-content: center; + margin-right: 4px; +} + +.category-icon, .category-icon svg{ + width: 1em; + height: 1em; +} + +.space{ + margin-right: 2px; + margin-left: 2px; +} diff --git a/css/translation.css b/css/translation.css index e9f04bb..3d2f301 100644 --- a/css/translation.css +++ b/css/translation.css @@ -37,7 +37,7 @@ input{ } .Processing{ - width: 230px; + width: 240px; cursor: default; } diff --git a/icon/Adventure.svg b/icon/Adventure.svg deleted file mode 100644 index a5fe85e..0000000 --- a/icon/Adventure.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/icon/Cursed.svg b/icon/Cursed.svg deleted file mode 100644 index 6aeb66d..0000000 --- a/icon/Cursed.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/icon/Decoration.svg b/icon/Decoration.svg deleted file mode 100644 index 8edb36d..0000000 --- a/icon/Decoration.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/icon/Economy.svg b/icon/Economy.svg deleted file mode 100644 index 7b49e7f..0000000 --- a/icon/Economy.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/icon/Equipment.svg b/icon/Equipment.svg deleted file mode 100644 index 618f176..0000000 --- a/icon/Equipment.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/icon/Food.svg b/icon/Food.svg deleted file mode 100644 index 81af9f5..0000000 --- a/icon/Food.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/icon/GameMechanics.svg b/icon/GameMechanics.svg deleted file mode 100644 index afb48ee..0000000 --- a/icon/GameMechanics.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/icon/Library.svg b/icon/Library.svg deleted file mode 100644 index 48dc163..0000000 --- a/icon/Library.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/icon/Magic.svg b/icon/Magic.svg deleted file mode 100644 index 2ec430e..0000000 --- a/icon/Magic.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/icon/Management.svg b/icon/Management.svg deleted file mode 100644 index 32b0185..0000000 --- a/icon/Management.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/icon/Minigame.svg b/icon/Minigame.svg deleted file mode 100644 index 28818ae..0000000 --- a/icon/Minigame.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/icon/Mobs.svg b/icon/Mobs.svg deleted file mode 100644 index 5c44b24..0000000 --- a/icon/Mobs.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/icon/Optimization.svg b/icon/Optimization.svg deleted file mode 100644 index 2711ce2..0000000 --- a/icon/Optimization.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/icon/Social.svg b/icon/Social.svg deleted file mode 100644 index 9eab0bf..0000000 --- a/icon/Social.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/icon/Storage.svg b/icon/Storage.svg deleted file mode 100644 index fd8b09f..0000000 --- a/icon/Storage.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/icon/Technology.svg b/icon/Technology.svg deleted file mode 100644 index f3f4600..0000000 --- a/icon/Technology.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/icon/Transportation.svg b/icon/Transportation.svg deleted file mode 100644 index cc7a420..0000000 --- a/icon/Transportation.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/icon/Utility.svg b/icon/Utility.svg deleted file mode 100644 index eca79a8..0000000 --- a/icon/Utility.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/icon/WorldGeneration.svg b/icon/WorldGeneration.svg deleted file mode 100644 index 889e2ec..0000000 --- a/icon/WorldGeneration.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/icon/output.txt b/icon/output.txt new file mode 100644 index 0000000..7d1aee6 --- /dev/null +++ b/icon/output.txt @@ -0,0 +1,38 @@ +D:\Users\EUGENE\Desktop\Github\gitSUMWeb\icon\Adventure.svg + +D:\Users\EUGENE\Desktop\Github\gitSUMWeb\icon\Cursed.svg + +D:\Users\EUGENE\Desktop\Github\gitSUMWeb\icon\Decoration.svg + +D:\Users\EUGENE\Desktop\Github\gitSUMWeb\icon\Economy.svg + +D:\Users\EUGENE\Desktop\Github\gitSUMWeb\icon\Equipment.svg + +D:\Users\EUGENE\Desktop\Github\gitSUMWeb\icon\Food.svg + +D:\Users\EUGENE\Desktop\Github\gitSUMWeb\icon\GameMechanics.svg + +D:\Users\EUGENE\Desktop\Github\gitSUMWeb\icon\Library.svg + +D:\Users\EUGENE\Desktop\Github\gitSUMWeb\icon\Magic.svg + +D:\Users\EUGENE\Desktop\Github\gitSUMWeb\icon\Management.svg + +D:\Users\EUGENE\Desktop\Github\gitSUMWeb\icon\Minigame.svg + +D:\Users\EUGENE\Desktop\Github\gitSUMWeb\icon\Mobs.svg + +D:\Users\EUGENE\Desktop\Github\gitSUMWeb\icon\Optimization.svg + +D:\Users\EUGENE\Desktop\Github\gitSUMWeb\icon\Social.svg + +D:\Users\EUGENE\Desktop\Github\gitSUMWeb\icon\Storage.svg + +D:\Users\EUGENE\Desktop\Github\gitSUMWeb\icon\Technology.svg + +D:\Users\EUGENE\Desktop\Github\gitSUMWeb\icon\Transportation.svg + +D:\Users\EUGENE\Desktop\Github\gitSUMWeb\icon\Utility.svg + +D:\Users\EUGENE\Desktop\Github\gitSUMWeb\icon\WorldGeneration.svg + \ No newline at end of file diff --git a/js/item.js b/js/item.js index 2ea1061..fe3b2b0 100644 --- a/js/item.js +++ b/js/item.js @@ -185,6 +185,18 @@ function generateTranslationDiv(translationLink, isMod, isVerified) { $('#TranslationContainer').html(translationDiv); + // Function to fetch category icons from ItemCategories.json +async function fetchCategoryIcons() { + try { + const iconsResponse = await fetch('ItemCategories.json'); + const iconsData = await iconsResponse.json(); + return iconsData; + } catch (error) { + console.error("Error fetching category icons:", error); + return []; + } +} + // Function to update the item page with the fetched data async function updateItemPage() { @@ -197,6 +209,8 @@ async function updateItemPage() { if (selectedItem) { document.title = "СУМ" + " - переклад " + selectedItem.title; + const categoryIcons = await fetchCategoryIcons(); + // Update meta description const metaDescription = document.createElement('meta'); metaDescription.setAttribute('name', 'description'); @@ -261,11 +275,17 @@ async function updateItemPage() { const engineText = selectedItem.engine ? `

Рушій: ${selectedItem.engine}

` : ''; - // Determine the categories text const categoriesText = selectedItem.categories ? ` -

Категорії: - ${selectedItem.categories.map(category => `${category}`).join(', ')} -

` +
Категорії:  + ${selectedItem.categories.map(category => { + const categoryIcon = categoryIcons.find(icon => icon.title === category); + return ` + + ${categoryIcon ? `
${categoryIcon.icon}
` : ''} + ${category} +
`; + }).join('')} +
` : '';