Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding an expand button #62

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ ul {
list-style: none;
align-self: center;
width: 90%;
display: block;
}

.popup-buttons {
Expand Down
29 changes: 24 additions & 5 deletions js/tab-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ function displayGroupList() {

groupElement.setAttribute("prop", prop);

const list = document.createElement("ul");
let list = document.createElement("ul");
list.id="collapsible";
aayushmau5 marked this conversation as resolved.
Show resolved Hide resolved

list.ondrop = (e) => listonDrop(e, prop, list);

Expand Down Expand Up @@ -152,6 +153,14 @@ function displayGroupList() {
deleteBtn.setAttribute("prop", prop);
groupButtons.appendChild(deleteBtn);

let expandBtn = document.createElement("button");
expandBtn.className = "expand";
expandBtn.innerHTML = "Expand";
expandBtn.setAttribute("prop", prop);
groupButtons.appendChild(expandBtn);



daemon1024 marked this conversation as resolved.
Show resolved Hide resolved
groupElement.appendChild(header);
header.appendChild(groupButtons);
groupElement.appendChild(list);
Expand All @@ -167,15 +176,25 @@ document.getElementById("group-list").addEventListener("click", (e) => {
if (e?.target.matches("button.restore")) {
const prop = e.target.getAttribute("prop");
return restore(prop);
}

if (e?.target.matches("button.delete")) {
const prop = e.target.getAttribute("prop");
} if (e.target && e.target.matches("button.delete")) {
let prop = e.target.getAttribute("prop");
daemon1024 marked this conversation as resolved.
Show resolved Hide resolved
return (
confirm("Are you sure you want to delete this group?") &&
browser.storage.local.remove(prop).then(window.location.reload())
);
}

if (e.target && e.target.matches("button.expand")) {
console.log("working");
daemon1024 marked this conversation as resolved.
Show resolved Hide resolved
var content = document.getElementById("collapsible");
daemon1024 marked this conversation as resolved.
Show resolved Hide resolved
if (content.style.display === "block") {
content.style.display = "none";
} else {
content.style.display = "block";
}
}



if (e?.target.matches("button.delete-tab")) {
const prop = e.target.getAttribute("prop");
Expand Down