From a957027656c336069a826c4d70f14a993dfdb836 Mon Sep 17 00:00:00 2001 From: gdamms Date: Wed, 25 May 2022 18:35:10 +0200 Subject: [PATCH] fix: un id en moins MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Laureηt --- src/main/webapp/index2.html | 6 ++++-- src/main/webapp/pixels.js | 24 +++++++++++------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/main/webapp/index2.html b/src/main/webapp/index2.html index 7881c9f..209c9d7 100644 --- a/src/main/webapp/index2.html +++ b/src/main/webapp/index2.html @@ -90,7 +90,7 @@ Wallet
-
+
@@ -115,6 +115,7 @@ My pixels

+
(
) @@ -139,7 +140,7 @@ -
+
@@ -159,6 +160,7 @@

+
diff --git a/src/main/webapp/pixels.js b/src/main/webapp/pixels.js index 2c55567..8081d2a 100644 --- a/src/main/webapp/pixels.js +++ b/src/main/webapp/pixels.js @@ -18,10 +18,11 @@ const updateUserJSON = async () => { userJSON = await reponse.json(); } - function updateSolde() { - var div = document.getElementById("solde"); - div.innerHTML = userJSON.solde + '$'; + var elems = document.getElementsByClassName("solde"); + elems.forEach(el => { + el.innerHTML = userJSON.solde + '₿'; + }); } updateSolde(); @@ -70,13 +71,13 @@ function setPixels() { ////////////////////// function hexToRgb(hex) { - var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); - console.log(result); - return result ? { - r: parseInt(result[1], 16), - g: parseInt(result[2], 16), - b: parseInt(result[3], 16) - } : null; + var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); + console.log(result); + return result ? { + r: parseInt(result[1], 16), + g: parseInt(result[2], 16), + b: parseInt(result[3], 16) + } : null; } // Initialize pixel index @@ -125,8 +126,6 @@ function previousUserPixel() { } function updatePixelPreview() { - var colorDiv = document.getElementById("color"); - var index = parseInt(document.getElementById("pixel-index").innerHTML); var pixel = pixelsJSON[index]; @@ -150,7 +149,6 @@ function updatePixelPreview() { // Update description var description = document.getElementById("description"); description.value = pixel.description; - } // Update preview's color