Skip to content

Commit 8c7e4e7

Browse files
committed
Merge branch 'lroussel-dev-detailsUX' into main
2 parents edc7794 + 538f13d commit 8c7e4e7

8 files changed

Lines changed: 77 additions & 20 deletions

File tree

index.html

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,28 @@
2929

3030
<h1>Minecraft Enchantment Ordering Tool</h1>
3131

32-
<p>
33-
When enchanting items in Minecraft, the order in which you combine armor, weapons and tools with books in your
34-
anvil makes a huge difference. Each time you work on an anvil, you increase the <a href="https://minecraft.wiki/w/Anvil_mechanics">work penalty</a> for future workings. Once that
35-
penalty gets too high, you simply can't add any more enchantments and the anvil says "Too Expensive!". This tool
36-
helps you plan the optimal order of combining and applying books, to give you the cheapest possible cost.
37-
</p>
38-
<p>
39-
This tool assume your gear and books start with zero "work penalty". That means you have not previously combined
40-
the books (e.g. to turn two level 1 books into a single level 2 book) or worked the items or books in an anvil
41-
in any way. To create gear with the maximum possible enchantment, you cannot combine lower-level books and must
42-
start with high-level books from villager trading.
43-
</p>
44-
<p>
45-
Allowing incompatible enchantments may be useful for combining protection-type enchantments (1.14 to 1.14.3pre-1)
46-
and mending/infinity (1.9 to 1.11.1).
47-
</p>
48-
32+
<details id="details-enchants" open>
33+
<summary>About Enchantment in Minecraft</summary>
34+
<p>
35+
When enchanting items in Minecraft, the order in which you combine armor, weapons and tools with books in your
36+
anvil makes a huge difference. Each time you work on an anvil, you increase the <a href="https://minecraft.wiki/w/Anvil_mechanics" target="_blank">work penalty</a> for future workings. Once that
37+
penalty gets too high, you simply can't add any more enchantments and the anvil says "Too Expensive!". This tool
38+
helps you plan the optimal order of combining and applying books, to give you the cheapest possible cost.
39+
</p>
40+
</details>
41+
<details id="details-tool" open>
42+
<summary>About this tool</summary>
43+
<p>
44+
This tool assume your gear and books start with zero "work penalty". That means you have not previously combined
45+
the books (e.g. to turn two level 1 books into a single level 2 book) or worked the items or books in an anvil
46+
in any way. To create gear with the maximum possible enchantment, you cannot combine lower-level books and must
47+
start with high-level books from villager trading.
48+
</p>
49+
<p>
50+
Allowing incompatible enchantments may be useful for combining protection-type enchantments (1.14 to 1.14.3pre-1)
51+
and mending/infinity (1.9 to 1.11.1).
52+
</p>
53+
</details>
4954
<hr>
5055

5156
<div id="left">

languages/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"h1_title" :"Minecraft Enchantment Ordering Tool",
3+
"summary_1": "About Enchantements in Minecraft",
4+
"summary_2": "About this tool",
35
"paragraph_1" :"When enchanting items in Minecraft, the order in which you combine armor, weapons and tools with books in your anvil makes a huge difference. Each time you work on an anvil, you increase the <a href='https://minecraft.wiki/w/Anvil_mechanics'>work penalty</a> for future workings. Once that penalty gets too high, you simply can't add any more enchantments and the anvil says \"Too Expensive!\". This tool helps you plan the optimal order of combining and applying books, to give you the cheapest possible cost.",
46
"paragraph_2" : "This tool assume your gear and books start with zero \"work penalty\". That means you have not previously combined the books (e.g. to turn two level 1 books into a single level 2 book) or worked the items or books in an anvil in any way. To create gear with the maximum possible enchantment, you cannot combine lower-level books and must start with high-level books from villager trading.",
57
"paragraph_3": "Allowing incompatible enchantments may be useful for combining protection-type enchantments (1.14 to 1.14.3pre-1) and mending/infinity (1.9 to 1.11.1).",

languages/es-ES.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"h1_title" :"Herramienta para ordenar encantamientos de Minecraft",
3+
"summary_1": "Acerca de los Encantamientos en Minecraft",
4+
"summary_2": "Acerca de esta herramienta",
35
"paragraph_1" :"Cuando encantas items en Minecraft, el orden en el que combinas armaduras, armas, y herramientas con libros en un yunque puede marcar la diferencia. Cada vez que usas un yunque, aumentas la <a href='https://minecraft.wiki/w/Anvil_mechanics'>penalización de trabajo</a> para futuros usos. Una vez que la penalización es demasiado alta, el yunque no permitirá añadir más encantamientos y mostrará el mensaje \"¡Demasiado caro!\". Esta herramienta te ayudará a elegir el orden óptimo para aplicar y combinar libros. Así podrás conseguir el costo más barato posible.",
46
"paragraph_2" : "Esta herramienta asume que tu equipo y libros empiezan con cero de \"penalización de trabajo\". Esto significa que anteriormente no has combinado dos libros (p.ej. convertir dos libros de nivel 1 en un libro de nivel 2), manipulando items o libros de cualquier manera en un yunque. Para crear equipamiento con el máximo nivel posible, no puedes combinar libros de nivel bajo, debes empezar con libros de nivel alto obtenidos a través de comerciar con aldeanos.",
57
"paragraph_3": "Permitir encantamientos incompatibles puede ser útil para combinar encantamientos de tipo protección (1.14 a 1.14.3pre-1) y reparación/infinidad (1.9 a 1.11.1).",

languages/fr-FR.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"h1_title" :"Outil d'Organisation des Enchantements Minecraft",
3-
"paragraph_1" :"Lorsque vous enchantez des objets dans Minecraft, l'ordre dans lequel vous combinez votre armure, vos armes et outils avec des livres dans votre enclume fait la différence. À chaque fois que vous utilisez une enclume, vous augmentez les <a href='https://fr.minecraft.wiki/w/R%C3%A9paration_d%27objet#P%C3%A9nalit%C3%A9_de_r%C3%A9parations_ant%C3%A9rieures'>pénalités de réparation</a> pour les prochaines utilisations. Une fois la pénalité trop haute, vous ne pouvez plus ajouter d'enchantements supplémentaires et l'enclume indique \"Trop cher !\". Cet outil vous aide à planifier l'ordre optimal de combinaison et d'application des livres, pour vous donner le coût le moins cher possible.",
3+
"summary_1": "À propros des Enchantements dans Minecraft",
4+
"summary_2": "À propos de cet outil",
5+
"paragraph_1" :"Lorsque vous enchantez des objets dans Minecraft, l'ordre dans lequel vous combinez votre armure, vos armes et outils avec des livres dans votre enclume fait la différence. À chaque fois que vous utilisez une enclume, vous augmentez les <a href='https://fr.minecraft.wiki/w/R%C3%A9paration_d%27objet#P%C3%A9nalit%C3%A9_de_r%C3%A9parations_ant%C3%A9rieures' target='_blank'>pénalités de réparation</a> pour les prochaines utilisations. Une fois la pénalité trop haute, vous ne pouvez plus ajouter d'enchantements supplémentaires et l'enclume indique \"Trop cher !\". Cet outil vous aide à planifier l'ordre optimal de combinaison et d'application des livres, pour vous donner le coût le moins cher possible.",
46
"paragraph_2" : "Cet outil assume que votre équipement et vos livres commencent sans aucune \"pénalité de réparation\". Cela signifie que vous n'avez au préalable pas combiné les livres (ex. pour transformer deux livres niveau 1 en un unique livre niveau 2) ou réparé des objets ou livres dans une enclume de quelques manières que ce soit. Pour créer un équipement avec le maximum possible d'enchantements, vous ne pouvez pas combiner des livres de plus bas niveau mais devez commencer avec des livres de haut niveau provenant du commerce avec les villageois.",
57
"paragraph_3": "Autoriser les enchantements incompatibles peut être utile pour combiner des enchantements de type protection (1.14 à 1.14.3pre-1) et racommodage/infinité (1.9 à 1.11.1).",
68

languages/it-IT.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"h1_title" :"Strumento per ordinare gli incantesimi di Minecraft",
3+
"summary_1": "A proposito degli Incantesimi in Minecraft",
4+
"summary_2": "A proposito di questo strumento",
35
"paragraph_1" :"Quando si incantano oggetti in Minecraft, l'ordine in cui si combinano armature, armi e strumenti con i libri nell'incudine fa una grande differenza. Ogni volta che si lavora su un'incudine, si aumenta la <a href='https://minecraft.wiki/w/Anvil_mechanics'>penalità del lavoro</a> per le lavorazioni future. Quando la penalità diventa troppo alta, semplicemente non si possono aggiungere altri incantamenti e l'incudine dice \"Troppo costoso!\". Questo strumento vi aiuta a pianificare l'ordine ottimale di combinazione e applicazione dei libri, per ottenere il costo più basso possibile.",
46
"paragraph_2" : "Questo strumento presuppone che la vostra attrezzatura e i vostri libri inizino con una \"penalità del lavoro\" pari a zero. Ciò significa che non avete precedentemente combinato i libri (ad es. per trasformare due libri di livello 1 in un unico libro di livello 2) o lavorato gli oggetti o i libri in un'incudine in qualsiasi modo. Per creare un equipaggiamento con il livello massimo di incanto, non si possono combinare libri di livello inferiore e si deve iniziare con libri di livello elevato provenienti dal commercio con i villani.",
57
"paragraph_3": "Consentire incantesimi incompatibili può essere utile per combinare incantesimi di tipo protettivo (1.14 fino a 1.14.3pre-1) e Ripristino/Infinità (1.9 fino a 1.11.1).",

languages/pl-PL.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,4 @@
119119
"breach": "Przedarcie",
120120
"wind_burst": "Wicher"
121121
}
122-
}
122+
}

script.js

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,14 +719,36 @@ async function changePageLanguage(language){
719719
}
720720

721721
languageId = language;
722-
languageJson = await loadJsonLanguage(language).then(languageData => { return languageData});
722+
if (language == 'en'){
723+
languageJson = await loadJsonLanguage(language).then(languageData => { return languageData});
724+
}else{
725+
var languageJsonEn = await loadJsonLanguage('en').then(languageData => { return languageData});
726+
languageJson = await loadJsonLanguage(language).then(languageData => { return languageData});
727+
languageJson = mergeKeys(languageJson, languageJsonEn);
728+
}
723729
if (languageJson){
724730
changeLanguageByJson(languageJson);
725731
localStorage.setItem("savedlanguage", language);
726732
// ^ Save language choice to localstorage
727733
}
728734
}
729735

736+
function mergeKeys(a, b){
737+
var o = {};
738+
for (var i in b){
739+
if (typeof b[i] === 'object'){
740+
o[i] = mergeKeys(a.hasOwnProperty(i) ? a[i] : {}, b[i]);
741+
}else{
742+
if (a.hasOwnProperty(i)){
743+
o[i] = a[i]
744+
}else{
745+
o[i] = b[i];
746+
}
747+
}
748+
}
749+
return o;
750+
}
751+
730752
function loadJsonLanguage(language) {
731753
return fetch('languages/'+language+'.json?'+languages_cache_key)
732754
.then(response => {
@@ -758,6 +780,11 @@ function changeLanguageByJson(languageJson){
758780
const h1Element = document.getElementsByTagName('h1')[0];
759781
h1Element.textContent = languageJson.h1_title;
760782

783+
/* summaries */
784+
const summaries = document.getElementsByTagName('summary');
785+
summaries[0].innerHTML = languageJson.summary_1;
786+
summaries[1].innerHTML = languageJson.summary_2;
787+
761788
/* paragraphs */
762789
const paragraphs = document.getElementsByTagName('p');
763790
paragraphs[1].innerHTML = languageJson.paragraph_1;

style.css

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,23 @@ a:hover {
144144
color: var(--link-hover);
145145
}
146146

147+
a[target="_blank"]::after {
148+
content: " ↗";
149+
}
150+
151+
summary {
152+
font-size: 1.25rem;
153+
font-weight: bold;
154+
text-decoration: underline dotted;
155+
margin: 0.5rem 0;
156+
color: var(--link-hover);
157+
158+
&:hover {
159+
text-decoration: underline;
160+
cursor: pointer;
161+
}
162+
}
163+
147164
#enchants {
148165
width: 400px;
149166
}

0 commit comments

Comments
 (0)