opt animation
This commit is contained in:
52
popup.css
52
popup.css
@@ -107,7 +107,7 @@ button#bulk-archive {
|
|||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
button#bulk-archive span {
|
button#bulk-archive#locked {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 75px;
|
left: 75px;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
@@ -118,7 +118,7 @@ button#add-checkboxes {
|
|||||||
background-color: #2ecc71;
|
background-color: #2ecc71;
|
||||||
}
|
}
|
||||||
button#remove-checkboxes {
|
button#remove-checkboxes {
|
||||||
background-color: #e74c3c;
|
background-color: #e86354;
|
||||||
}
|
}
|
||||||
button#toggle-checkboxes {
|
button#toggle-checkboxes {
|
||||||
background-color: #f39c12;
|
background-color: #f39c12;
|
||||||
@@ -345,23 +345,23 @@ button#bulk-archive {
|
|||||||
text-shadow: 0 0 4px rgba(255, 255, 255, 0.5); /* 增强悬停时的光晕效果 */
|
text-shadow: 0 0 4px rgba(255, 255, 255, 0.5); /* 增强悬停时的光晕效果 */
|
||||||
}
|
}
|
||||||
|
|
||||||
button#bulk-delete {
|
button#bulk-delete,
|
||||||
|
button#bulk-archive {
|
||||||
background-color: #e74c3c;
|
background-color: #e74c3c;
|
||||||
color: white;
|
color: white;
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
transition: background-color 0.3s ease;
|
transition: background-color 0.3s ease;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
button#bulk-archive {
|
button#bulk-archive {
|
||||||
background-color: #9b59b6;
|
background-color: #9b59b6;
|
||||||
color: white;
|
|
||||||
position: relative;
|
|
||||||
overflow: hidden;
|
|
||||||
transition: background-color 0.3s ease;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* New styles for progress bar */
|
/* Progress bar styles */
|
||||||
button#bulk-delete::before,
|
button#bulk-delete::before,
|
||||||
button#bulk-archive::before {
|
button#bulk-archive::before {
|
||||||
content: "";
|
content: "";
|
||||||
@@ -370,27 +370,15 @@ button#bulk-archive::before {
|
|||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
background-color: #2ecc71; /* Bright green color for progress */
|
background-color: rgba(46, 204, 113, 0.5);
|
||||||
transform: translateX(-100%);
|
transform: translateX(-100%);
|
||||||
transition: transform 0.3s ease-out;
|
transition: transform 0.3s ease-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
button#bulk-delete::after,
|
|
||||||
button#bulk-archive::after {
|
|
||||||
content: attr(data-progress) "%";
|
|
||||||
position: absolute;
|
|
||||||
top: 50%;
|
|
||||||
left: 50%;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
color: rgb(149, 20, 20);
|
|
||||||
font-weight: bold;
|
|
||||||
z-index: 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
button#bulk-delete.progress,
|
button#bulk-delete.progress,
|
||||||
button#bulk-archive.progress {
|
button#bulk-archive.progress {
|
||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
background-color: #34495e; /* Darker background when in progress */
|
background-color: #34495e;
|
||||||
}
|
}
|
||||||
|
|
||||||
button#bulk-delete.progress::before,
|
button#bulk-delete.progress::before,
|
||||||
@@ -398,12 +386,19 @@ button#bulk-archive.progress::before {
|
|||||||
transform: translateX(var(--progress, -100%));
|
transform: translateX(var(--progress, -100%));
|
||||||
}
|
}
|
||||||
|
|
||||||
button#bulk-delete.progress::before,
|
/* Progress text styles */
|
||||||
button#bulk-archive.progress::before {
|
.progress-text {
|
||||||
animation: pulse 2s infinite;
|
position: absolute;
|
||||||
|
left: 10px;
|
||||||
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add a pulsing animation to the progress bar */
|
.button-text {
|
||||||
|
z-index: 1;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Pulsing animation for the progress bar */
|
||||||
@keyframes pulse {
|
@keyframes pulse {
|
||||||
0% {
|
0% {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
@@ -415,3 +410,8 @@ button#bulk-archive.progress::before {
|
|||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
button#bulk-delete.progress::before,
|
||||||
|
button#bulk-archive.progress::before {
|
||||||
|
animation: pulse 2s infinite;
|
||||||
|
}
|
||||||
|
|||||||
@@ -28,10 +28,8 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<button id="toggle-checkboxes">Toggle Checkboxes</button>
|
<button id="toggle-checkboxes">Toggle Checkboxes</button>
|
||||||
<button id="bulk-archive" class="locked">
|
<button id="bulk-archive" data-progress="0"><span id="locked">🔒</span>Bulk Archive</button>
|
||||||
<span>🔒</span> Bulk Archive
|
<button id="bulk-delete" data-progress="0">Bulk Delete</button>
|
||||||
</button>
|
|
||||||
<button id="bulk-delete">Bulk Delete</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
|
|||||||
30
popup.js
30
popup.js
@@ -37,17 +37,33 @@ function addButtonListener(buttonId, scriptName) {
|
|||||||
function updateProgressBar(buttonId, progress) {
|
function updateProgressBar(buttonId, progress) {
|
||||||
console.log(`Updating progress bar for ${buttonId}:`, progress);
|
console.log(`Updating progress bar for ${buttonId}:`, progress);
|
||||||
const button = document.getElementById(buttonId);
|
const button = document.getElementById(buttonId);
|
||||||
|
button.classList.add("progress");
|
||||||
button.style.setProperty("--progress", `${progress}%`);
|
button.style.setProperty("--progress", `${progress}%`);
|
||||||
button.setAttribute("data-progress", progress);
|
button.setAttribute("data-progress", progress);
|
||||||
|
|
||||||
if (progress === 100 || progress === 0) {
|
const buttonText =
|
||||||
|
buttonId === "bulk-delete" ? "Bulk Delete" : "Bulk Archive";
|
||||||
|
const actionText = buttonId === "bulk-delete" ? "Deleting" : "Archiving";
|
||||||
|
|
||||||
|
if (progress === 100) {
|
||||||
|
button.disabled = true;
|
||||||
|
button.innerHTML = `
|
||||||
|
<span class="progress-text">100%</span>
|
||||||
|
<span class="button-text">${actionText} Complete</span>
|
||||||
|
`;
|
||||||
|
|
||||||
|
// 显示 100% 一段时间后恢复原始状态
|
||||||
|
setTimeout(() => {
|
||||||
button.disabled = false;
|
button.disabled = false;
|
||||||
button.classList.remove("progress");
|
button.classList.remove("progress");
|
||||||
button.textContent =
|
button.innerHTML = `<span class="button-text">${buttonText}</span>`;
|
||||||
buttonId === "bulk-delete" ? "Bulk Delete" : "Bulk Archive";
|
}, 500); // 1000 毫秒 = 1 秒,您可以根据需要调整这个时间
|
||||||
} else {
|
} else {
|
||||||
button.textContent =
|
button.disabled = true;
|
||||||
buttonId === "bulk-delete" ? "Deleting..." : "Archiving...";
|
button.innerHTML = `
|
||||||
|
<span class="progress-text">${progress}%</span>
|
||||||
|
<span class="button-text">${actionText}...</span>
|
||||||
|
`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,7 +76,7 @@ chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
|
|||||||
const button = document.getElementById(request.buttonId);
|
const button = document.getElementById(request.buttonId);
|
||||||
button.disabled = false;
|
button.disabled = false;
|
||||||
button.classList.remove("progress");
|
button.classList.remove("progress");
|
||||||
updateProgressBar(request.buttonId, 0);
|
updateProgressBar(request.buttonId, 100);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -105,10 +121,8 @@ async function checkMembershipStatus() {
|
|||||||
function updateBulkArchiveButton(isPaid) {
|
function updateBulkArchiveButton(isPaid) {
|
||||||
const bulkArchiveButton = document.getElementById("bulk-archive");
|
const bulkArchiveButton = document.getElementById("bulk-archive");
|
||||||
if (isPaid) {
|
if (isPaid) {
|
||||||
bulkArchiveButton.classList.remove("locked");
|
|
||||||
bulkArchiveButton.querySelector("span").textContent = "";
|
bulkArchiveButton.querySelector("span").textContent = "";
|
||||||
} else {
|
} else {
|
||||||
bulkArchiveButton.classList.add("locked");
|
|
||||||
bulkArchiveButton.querySelector("span").textContent = "🔒";
|
bulkArchiveButton.querySelector("span").textContent = "🔒";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user