From 66bb23b159cc2c8d0fd85606f73759917d84d2cf Mon Sep 17 00:00:00 2001 From: Lawrence Hook Date: Fri, 31 May 2024 09:31:58 -0400 Subject: [PATCH] Disable the power button if the schedule is active --- src/options/header.css | 28 ++++++++++++++++++++++++++++ src/options/main.html | 1 + src/options/main.js | 2 +- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/options/header.css b/src/options/header.css index e5bdefc..967e3bc 100644 --- a/src/options/header.css +++ b/src/options/header.css @@ -61,6 +61,34 @@ html[dark_mode='false'] #header-light { display: none } #power-icon { display: flex; justify-content: center; + position: relative; +} +#power-pop-up { + position: absolute; + font-size: 0.85rem; + width: 200px; + top: 115%; + right: -75%; + border-radius: var(--border-radius); + user-select: none; + + padding: 10px; + background-color: var(--body-color); + color: var(--body-background-color); + opacity: 0; + visibility: hidden; + transition: opacity 0.3s ease, visibility 0.3s ease; +} +html[schedule='true'] #power-icon, +html[schedule='true'] #power-icon svg { + cursor: default; +} +html[schedule='true'] #power-icon:active { + pointer-events: none; +} +html[schedule='true'] #power-icon:hover #power-pop-up { + opacity: 1; + visibility: visible; } #power-icon svg { cursor: pointer; diff --git a/src/options/main.html b/src/options/main.html index bb0d5b0..e89eb13 100644 --- a/src/options/main.html +++ b/src/options/main.html @@ -141,6 +141,7 @@ +
Button is disabled because the schedule is active.
diff --git a/src/options/main.js b/src/options/main.js index 6d28f5f..a2b9846 100644 --- a/src/options/main.js +++ b/src/options/main.js @@ -203,7 +203,7 @@ function updateTimeInfo() { if (!nextTimedChange) { const remainingTime = nextChange - Date.now(); const { days, hours, minutes, seconds } = parseTimeRemaining(remainingTime); - let title = `Turning ${nextTimedValue ? 'on' : 'off'} in `; + let title = `Turning ${scheduleIsActive ? 'off' : 'on'} in `; if (days) title = title.concat(days, ' days and '); if (hours) title = title.concat(hours, ' hours and '); if (minutes) title = title.concat(minutes, ' minutes and ');