Skip to content

Commit

Permalink
Update startup.js
Browse files Browse the repository at this point in the history
  • Loading branch information
SharkPool-SP authored Dec 19, 2024
1 parent ef3ffdc commit aed92eb
Showing 1 changed file with 31 additions and 10 deletions.
41 changes: 31 additions & 10 deletions scripts/startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,11 @@ function setupBtnFncs() {
e.stopPropagation();
});

const mediaBar = document.querySelector(`div[class="media-ctrl"]`);
const mediaBtns = mediaBar.children;
mediaBtns[0].addEventListener("click", (e) => {
e.target.parentNode.remove();
e.stopPropagation();
});
mediaBtns[3].addEventListener("click", (e) => {
mediaBar.insertAdjacentElement("afterend", mediaBar.cloneNode(true));
e.stopPropagation();
});
const sampleMediaBar = document.querySelector(`div[class="media-ctrl"]`);
const mediaBar = sampleMediaBar.cloneNode(true);
sampleMediaBar.style.display = "none";
sampleMediaBar.insertAdjacentElement("afterend", mediaBar);
mediaBarSetup(mediaBar);

// Opt Ping Input
const optPing = document.querySelector(`input[id="pingID"]`);
Expand All @@ -72,7 +67,33 @@ function showMediaRules() {

}

function showMediaEditor() {

}

/* Internal Utils */
function mediaBarSetup(bar) {
const mediaBtns = bar.children;
mediaBtns[0].addEventListener("click", (e) => {
// TODO reset media
if (mediaBtns[0].parentNode.previousElementSibling.tagName !== "I") e.target.parentNode.remove();
e.stopPropagation();
});
mediaBtns[2].addEventListener("change", (e) => {
console.log(e);
e.stopPropagation();
});
mediaBtns[3].addEventListener("click", (e) => {
const newBar = bar.cloneNode(true);
mediaBarSetup(newBar);
bar.insertAdjacentElement("afterend", newBar);
e.stopPropagation();
});
}

function mediaHandler() {

}

document.addEventListener("DOMContentLoaded", () => {
setupBtnFncs();
Expand Down

0 comments on commit aed92eb

Please sign in to comment.