scheduler implementation part/3; do not allow start = end; allow start < end
This commit is contained in:
parent
c2f993db27
commit
52ae781960
|
@ -713,7 +713,10 @@
|
|||
"scheduleButtonActive": {
|
||||
"message": "Scheduled"
|
||||
},
|
||||
"scheduleMSG": {
|
||||
"scheduleOneEntry": {
|
||||
"message": "Either clear both start and end values to disable the schedule or set both to enable it"
|
||||
},
|
||||
"scheduleEqualEntries": {
|
||||
"message": "Start and end times cannot be equal"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ schedule.execute = (name, request) => {
|
|||
chrome.alarms.create(name, {when});
|
||||
getStylesSafe({id: request.id}).then(([style]) => {
|
||||
if (style) {
|
||||
const enabled = start <= 0 && end > 0;
|
||||
const enabled = (start <= 0 && end > 0) || (start > end && start * end > 0) ;
|
||||
console.log(`style with id = ${style.id}; enabled = `, enabled);
|
||||
|
||||
saveStyleSafe({
|
||||
|
|
|
@ -36,10 +36,14 @@ document.addEventListener('click', e => {
|
|||
});
|
||||
break;
|
||||
case 1: // when only start or end value is set; display an alert
|
||||
window.alert(t('scheduleMSG'));
|
||||
window.alert(t('scheduleOneEntry'));
|
||||
[start, end].filter(o => !o.value).forEach(o => o.focus());
|
||||
return;
|
||||
default:
|
||||
if (start.value === end.value) {
|
||||
window.alert(t('scheduleEqualEntries'));
|
||||
return start.focus();
|
||||
}
|
||||
chrome.runtime.sendMessage({
|
||||
method: 'schedule',
|
||||
enabled: true,
|
||||
|
|
Loading…
Reference in New Issue
Block a user