added move to top button for task presets
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
|||||||
AGENTS.md
|
AGENTS.md
|
||||||
**/*.crx
|
**/*.crx
|
||||||
**/*.pem
|
**/*.pem
|
||||||
|
**/*.zip
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"name": "WWCompanion",
|
"name": "WWCompanion",
|
||||||
"version": "0.2.2",
|
"version": "0.2.3",
|
||||||
"description": "AI companion for WaterlooWorks job postings.",
|
"description": "AI companion for WaterlooWorks job postings.",
|
||||||
"permissions": ["storage", "activeTab"],
|
"permissions": ["storage", "activeTab"],
|
||||||
"host_permissions": ["https://waterlooworks.uwaterloo.ca/*"],
|
"host_permissions": ["https://waterlooworks.uwaterloo.ca/*"],
|
||||||
|
|||||||
@@ -209,13 +209,6 @@ button:active {
|
|||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon-btn {
|
.task-actions .delete {
|
||||||
width: 34px;
|
|
||||||
padding: 6px 0;
|
|
||||||
font-weight: 700;
|
|
||||||
line-height: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon-btn.delete {
|
|
||||||
color: #c0392b;
|
color: #c0392b;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,22 +70,28 @@ function buildTaskCard(task) {
|
|||||||
|
|
||||||
const actions = document.createElement("div");
|
const actions = document.createElement("div");
|
||||||
actions.className = "task-actions";
|
actions.className = "task-actions";
|
||||||
|
const moveTopBtn = document.createElement("button");
|
||||||
|
moveTopBtn.type = "button";
|
||||||
|
moveTopBtn.className = "ghost move-top";
|
||||||
|
moveTopBtn.textContent = "Top";
|
||||||
|
moveTopBtn.setAttribute("aria-label", "Move task to top");
|
||||||
|
moveTopBtn.setAttribute("title", "Move to top");
|
||||||
const moveUpBtn = document.createElement("button");
|
const moveUpBtn = document.createElement("button");
|
||||||
moveUpBtn.type = "button";
|
moveUpBtn.type = "button";
|
||||||
moveUpBtn.className = "ghost icon-btn move-up";
|
moveUpBtn.className = "ghost move-up";
|
||||||
moveUpBtn.textContent = "↑";
|
moveUpBtn.textContent = "Up";
|
||||||
moveUpBtn.setAttribute("aria-label", "Move task up");
|
moveUpBtn.setAttribute("aria-label", "Move task up");
|
||||||
moveUpBtn.setAttribute("title", "Move up");
|
moveUpBtn.setAttribute("title", "Move up");
|
||||||
const moveDownBtn = document.createElement("button");
|
const moveDownBtn = document.createElement("button");
|
||||||
moveDownBtn.type = "button";
|
moveDownBtn.type = "button";
|
||||||
moveDownBtn.className = "ghost icon-btn move-down";
|
moveDownBtn.className = "ghost move-down";
|
||||||
moveDownBtn.textContent = "↓";
|
moveDownBtn.textContent = "Down";
|
||||||
moveDownBtn.setAttribute("aria-label", "Move task down");
|
moveDownBtn.setAttribute("aria-label", "Move task down");
|
||||||
moveDownBtn.setAttribute("title", "Move down");
|
moveDownBtn.setAttribute("title", "Move down");
|
||||||
const addBelowBtn = document.createElement("button");
|
const addBelowBtn = document.createElement("button");
|
||||||
addBelowBtn.type = "button";
|
addBelowBtn.type = "button";
|
||||||
addBelowBtn.className = "ghost icon-btn add-below";
|
addBelowBtn.className = "ghost add-below";
|
||||||
addBelowBtn.textContent = "+";
|
addBelowBtn.textContent = "Add";
|
||||||
addBelowBtn.setAttribute("aria-label", "Add task below");
|
addBelowBtn.setAttribute("aria-label", "Add task below");
|
||||||
addBelowBtn.setAttribute("title", "Add below");
|
addBelowBtn.setAttribute("title", "Add below");
|
||||||
const duplicateBtn = document.createElement("button");
|
const duplicateBtn = document.createElement("button");
|
||||||
@@ -96,11 +102,18 @@ function buildTaskCard(task) {
|
|||||||
duplicateBtn.setAttribute("title", "Duplicate");
|
duplicateBtn.setAttribute("title", "Duplicate");
|
||||||
const deleteBtn = document.createElement("button");
|
const deleteBtn = document.createElement("button");
|
||||||
deleteBtn.type = "button";
|
deleteBtn.type = "button";
|
||||||
deleteBtn.className = "ghost icon-btn delete";
|
deleteBtn.className = "ghost delete";
|
||||||
deleteBtn.textContent = "🗑";
|
deleteBtn.textContent = "Delete";
|
||||||
deleteBtn.setAttribute("aria-label", "Delete task");
|
deleteBtn.setAttribute("aria-label", "Delete task");
|
||||||
deleteBtn.setAttribute("title", "Delete");
|
deleteBtn.setAttribute("title", "Delete");
|
||||||
|
|
||||||
|
moveTopBtn.addEventListener("click", () => {
|
||||||
|
const first = tasksContainer.firstElementChild;
|
||||||
|
if (!first || first === card) return;
|
||||||
|
tasksContainer.insertBefore(card, first);
|
||||||
|
updateTaskControls();
|
||||||
|
});
|
||||||
|
|
||||||
moveUpBtn.addEventListener("click", () => {
|
moveUpBtn.addEventListener("click", () => {
|
||||||
const previous = card.previousElementSibling;
|
const previous = card.previousElementSibling;
|
||||||
if (!previous) return;
|
if (!previous) return;
|
||||||
@@ -137,6 +150,7 @@ function buildTaskCard(task) {
|
|||||||
updateTaskControls();
|
updateTaskControls();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
actions.appendChild(moveTopBtn);
|
||||||
actions.appendChild(moveUpBtn);
|
actions.appendChild(moveUpBtn);
|
||||||
actions.appendChild(moveDownBtn);
|
actions.appendChild(moveDownBtn);
|
||||||
actions.appendChild(addBelowBtn);
|
actions.appendChild(addBelowBtn);
|
||||||
@@ -153,8 +167,10 @@ function buildTaskCard(task) {
|
|||||||
function updateTaskControls() {
|
function updateTaskControls() {
|
||||||
const cards = [...tasksContainer.querySelectorAll(".task-card")];
|
const cards = [...tasksContainer.querySelectorAll(".task-card")];
|
||||||
cards.forEach((card, index) => {
|
cards.forEach((card, index) => {
|
||||||
|
const moveTopBtn = card.querySelector(".move-top");
|
||||||
const moveUpBtn = card.querySelector(".move-up");
|
const moveUpBtn = card.querySelector(".move-up");
|
||||||
const moveDownBtn = card.querySelector(".move-down");
|
const moveDownBtn = card.querySelector(".move-down");
|
||||||
|
if (moveTopBtn) moveTopBtn.disabled = index === 0;
|
||||||
if (moveUpBtn) moveUpBtn.disabled = index === 0;
|
if (moveUpBtn) moveUpBtn.disabled = index === 0;
|
||||||
if (moveDownBtn) moveDownBtn.disabled = index === cards.length - 1;
|
if (moveDownBtn) moveDownBtn.disabled = index === cards.length - 1;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user