Skip to content

Commit

Permalink
Add "Gather all" button
Browse files Browse the repository at this point in the history
  • Loading branch information
agatemosu committed Jan 1, 2025
1 parent 099d3db commit 0c9f38b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
<input type="checkbox" class="dynamic-style" id="square-img" />
<span>Square images</span>
</label>

<button type="button" class="button" id="gather-all">Gather all</button>
</div>
</div>

Expand Down
13 changes: 12 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,15 @@ function dynamicStyle(e) {
document.body.classList.toggle(checkbox.id, checkbox.checked);
}

function gatherAll() {
const imagesBar = document.querySelector("#images-bar");
const images = document.querySelectorAll(".tier-content .tier-element");

for (const image of images) {
imagesBar.appendChild(image);
}
}

// #endregion

// #region Setup
Expand All @@ -114,11 +123,13 @@ function setUpSortable() {
function setUpEvents() {
const newTierButton = document.querySelector("#new-tier");
const selectImagesButton = document.querySelector("#select-images");
const checkboxes = document.querySelectorAll(".dynamic-style");
const gatherAllButton = document.querySelector("#gather-all");

newTierButton.addEventListener("click", addNewTier);
selectImagesButton.addEventListener("click", selectImages);
gatherAllButton.addEventListener("click", gatherAll);

const checkboxes = document.querySelectorAll(".dynamic-style");
for (const checkbox of checkboxes) {
checkbox.addEventListener("change", dynamicStyle);
}
Expand Down

0 comments on commit 0c9f38b

Please sign in to comment.