diff --git a/crafter/index.html b/crafter/index.html index 2c6d8c0..645d2b6 100644 --- a/crafter/index.html +++ b/crafter/index.html @@ -46,7 +46,7 @@

Type:

- +
@@ -56,7 +56,7 @@

Lv:

- +
@@ -71,17 +71,17 @@

Attack Speed

-
+
-
+
-
+
@@ -132,7 +132,7 @@

Ing 1:

- +
@@ -144,7 +144,7 @@

Ing 2:

- +
@@ -158,7 +158,7 @@

Ing 3:

- +
@@ -170,7 +170,7 @@

Ing 4:

- +
@@ -184,7 +184,7 @@

Ing 5:

- +
@@ -196,7 +196,7 @@

Ing 6:

- +
@@ -204,23 +204,23 @@ -
-
- -
-
+
+
-
+
+ +
+
-
+
diff --git a/js/crafter.js b/js/crafter.js index e48c598..7fb26be 100644 --- a/js/crafter.js +++ b/js/crafter.js @@ -44,12 +44,26 @@ function init_crafter() { try { document.getElementById("recipe-choice").addEventListener("change", (event) => { updateMaterials(); + calculateCraft(); }); document.getElementById("level-choice").addEventListener("change", (event) => { updateMaterials(); + calculateCraft(); }); document.getElementById("recipe-choice").setAttribute("oninput", "updateCraftedImage()"); + for (let i = 1; i < 4; ++i) { + document.getElementById("mat-1-"+i).setAttribute("onclick", document.getElementById("mat-1-"+i).getAttribute("onclick") + "; calculateCraft();"); + document.getElementById("mat-2-"+i).setAttribute("onclick", document.getElementById("mat-2-"+i).getAttribute("onclick") + "; calculateCraft();"); + } + for (let i = 1; i < 7; ++i) { + document.getElementById("ing-choice-" + i ).setAttribute("oninput", "calculateCraft();"); + } + for (const str of ["slow", "normal", "fast"]) { + document.getElementById(str + "-atk-button").setAttribute("onclick", document.getElementById(str + "-atk-button").getAttribute("onclick") + "; calculateCraft();"); + } + + populateFields(); decodeCraft(ing_url_tag); } catch (error) { @@ -230,11 +244,20 @@ function populateFields() { } - - -/* Copy the link +/* + Copies the CR Hash (CR-blahblahblah) */ -function copyRecipe(){ +function copyRecipeHash() { + if (player_craft) { + copyTextToClipboard("CR-"+location.hash); + document.getElementById("copy-hash-button").textContent = "Copied!"; + } +} + +/* + Copies the link (hppeng-wynn.github.io/crafter/#blahblah) +*/ +function copyRecipe() { if (player_craft) { copyTextToClipboard(ing_url_base+location.hash); document.getElementById("copy-button").textContent = "Copied!"; @@ -243,7 +266,7 @@ function copyRecipe(){ /* Copy the link AND a display of all ingredients */ -function shareRecipe(){ +function shareRecipe() { if (player_craft) { let copyString = ing_url_base+location.hash + "\n"; let name = player_craft.recipe.get("name").split("-");