Skip to content

Commit 72abf97

Browse files
committed
change new-array to random-array
...to allow for more array generations
1 parent 8b54466 commit 72abf97

File tree

7 files changed

+12
-12
lines changed

7 files changed

+12
-12
lines changed

bubble.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const bubbleSort = async function () {
3232
}
3333
barsEl.children[sz - i - 1].style.backgroundColor = "green";
3434
}
35-
document.getElementById("new-array").classList.remove("disabled");
35+
document.getElementById("random-array").classList.remove("disabled");
3636
document.getElementById("size").classList.remove("disabled");
3737
document.getElementById("bubble").classList.toggle("active-btn");
3838
};

index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ <h1 class="h1" style="color: #183024;">Rotate Your Phone </h1>
6464
<label for="speed" style="color: #395144;">Speed</label>
6565
</div>
6666
<div>
67-
<button class="btn btn-sm btn-clr" id="new-array" type="button">
68-
New Array
67+
<button class="btn btn-sm btn-clr" id="random-array" type="button">
68+
Random Array
6969
</button>
7070
</div>
7171
<div>

insertion.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const insertionSort = async function () {
3636
barsEl.children[j + 1].style.backgroundColor = "green";
3737
barsEl.children[i].style.removeProperty("border-color");
3838
}
39-
document.getElementById("new-array").classList.remove("disabled");
39+
document.getElementById("random-array").classList.remove("disabled");
4040
document.getElementById("size").classList.remove("disabled");
4141
document.getElementById("insertion").classList.toggle("active-btn");
4242
};

merge.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ const mergeSort = async function () {
8282
const sz = Number(barsEl.childElementCount);
8383

8484
await mergeS(0, Number(sz - 1)).then(() => doGreen(sz));
85-
document.getElementById("new-array").classList.remove("disabled");
85+
document.getElementById("random-array").classList.remove("disabled");
8686
document.getElementById("size").classList.remove("disabled");
8787
document.getElementById("merge").classList.toggle("active-btn");
8888
};

quick.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ const quickSort = async function () {
9090
const sz = Number(barsEl.childElementCount);
9191

9292
await quickS(0, Number(sz - 1)).then(() => doGreen(sz));
93-
document.getElementById("new-array").classList.remove("disabled");
93+
document.getElementById("random-array").classList.remove("disabled");
9494
document.getElementById("size").classList.remove("disabled");
9595
document.getElementById("quick").classList.toggle("active-btn");
9696
};

selection.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const selectionSort = async function () {
6666
);
6767
barsEl.children[mxInd].style.borderColor = barDefaultBorderColor;
6868
}
69-
document.getElementById("new-array").classList.remove("disabled");
69+
document.getElementById("random-array").classList.remove("disabled");
7070
document.getElementById("size").classList.remove("disabled");
7171
document.getElementById("selection").classList.toggle("active-btn");
7272
};

sorting.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const barsEl = document.getElementById("bars");
44
const sizeSlider = document.getElementById("size");
55
// const barsRect = barsEl.getBoundingClientRect();
6-
const btnNewArray = document.getElementById("new-array");
6+
const btnRandomArray = document.getElementById("random-array");
77
const btnReload = document.getElementById("reload");
88
// const barsWidth = barsRect.width;
99
// const barsHeight = barsRect.height;
@@ -13,7 +13,7 @@ const barsHeight = barsEl.offsetHeight;
1313
barsEl.innerHTML = "";
1414
let bars = [];
1515

16-
const newArray = function () {
16+
const randomArray = function () {
1717
tempEnable();
1818
barsEl.innerHTML = "";
1919
bars = [];
@@ -65,7 +65,7 @@ const swap = function (bar1, bar2) {
6565
};
6666

6767
const tempDisable = function () {
68-
document.getElementById("new-array").classList.add("disabled");
68+
document.getElementById("random-array").classList.add("disabled");
6969
document.getElementById("size").classList.add("disabled");
7070
document.getElementById("bubble").classList.add("disabled");
7171
document.getElementById("merge").classList.add("disabled");
@@ -75,7 +75,7 @@ const tempDisable = function () {
7575
};
7676

7777
const tempEnable = function () {
78-
document.getElementById("new-array").classList.remove("disabled");
78+
document.getElementById("random-array").classList.remove("disabled");
7979
document.getElementById("size").classList.remove("disabled");
8080
document.getElementById("bubble").classList.remove("disabled");
8181
document.getElementById("merge").classList.remove("disabled");
@@ -84,5 +84,5 @@ const tempEnable = function () {
8484
document.getElementById("selection").classList.remove("disabled");
8585
};
8686

87-
btnNewArray.addEventListener("click", newArray);
87+
btnRandomArray.addEventListener("click", randomArray);
8888
btnReload.addEventListener("click", () => location.reload());

0 commit comments

Comments
 (0)