-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathorder.js
43 lines (38 loc) · 1.45 KB
/
order.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
var span;
var orderList = [];
function displayOrder(listIngredientOriginal) {
listIngredient = [...listIngredientOriginal];
for (var ingredient of orderList) {
ingredient.parentNode.removeChild(ingredient);
}
orderList = [];
listIngredient.shift();
listIngredient.pop();
var order = document.getElementById("order");
for (var ingredient of listIngredient) {
var imageDiv = document.createElement("div");
var imageIngredient = document.createElement("img");
imageDiv.appendChild(imageIngredient);
imageIngredient.src = "./ressources/ingredients/" + ingredient + ((ingredientChart.bredTop.price > 1 && ingredient == 'bredBottom') ? "Gold" : "") + ".png";
imageDiv.classList.add("orderElement");
imageIngredient.classList.add("orderElementImage");
imageDiv.style.marginLeft = "2%";
order.appendChild(imageDiv);
orderList.push(imageDiv);
}
var spanDiv = document.createElement("div");
span = document.createElement("span");
spanDiv.appendChild(span);
spanDiv.classList.add("orderLastElement");
spanDiv.classList.add("orderElement");
span.classList.add("orderElementSpan");
span.textContent =
Math.floor(burger.getBurgerPrice(listIngredientOriginal)).toString(10) +
"$";
span.style.fontFamily = "Sauce";
order.appendChild(span);
orderList.push(span);
}
function changeSpanColor() {
span.style.color = '#FF961B';
}