Jelajahi Sumber

refactor `budilnik`

Stephan Fuchs 10 bulan lalu
induk
melakukan
148638e9d9

+ 4 - 10
sugarcube/src/autogenerated/unsorted/budilnik.tw

@@ -1,13 +1,7 @@
-:: budilnik
-<<set $here = 'budilnik'>>
-<<set $menu_off = 1>>
-<<if $location_var[$here][0] == 'start'>>
+:: budilnik[menu]
 	<<image "shared/home/bedroom/bed2.jpg">>
 	<p><<checkbox "$budilnikOn" 0 1 autocheck>> Turned on.</p>
-	<p>Timer (Weekday): <<textbox "$timer" $timer>>:<<textbox "$timerM" $timerM>></p>
-	<p>Timer (Weekend): <<textbox "$timerEnd" $timerEnd>>:<<textbox "$timerEndM" $timerEndM>></p>
+	<p>Timer (Weekday): <<numberbox "$timer" $timer>>:<<numberbox "$timerM" $timerM>></p>
+	<p>Timer (Weekend): <<numberbox "$timerEnd" $timerEnd>>:<<numberbox "$timerEndM" $timerEndM>></p>
 	<p><<checkbox "$alarm_holiday" 0 1 autocheck>> <b>Use weekend alarm for holidays</b></p>
-	<<actCLA 'Finish'>>
-		<<gt $location>>
-	<</actCLA>>
-<</if>>
+	<<ret 'Finish'>>

+ 1 - 1
sugarcube/src/js/alarmClock.js

@@ -8,7 +8,7 @@ setup.alarmClockNextAlarm ??= function(){
 	];
 	let nextAlarm = time.now;
 
-	if(nextAlarm.getUTCDay() == 0 || nextAlarm.getUTCDay() == 6)
+	if(nextAlarm.getUTCDay() == 0 || nextAlarm.getUTCDay() == 6 || (State.variables.alarm_holiday && time.dateIsSchoolHoliday(nextAlarm)))
 		nextAlarm.setUTCHours(timerEnd,timeEndM,0,0);
 	else
 		nextAlarm.setUTCHours(timer,timerM,0,0);