From 5052207e0f5fd03e49fc51f1a5dbeb92dd79de59 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Tue, 31 Oct 2023 18:33:30 -0400 Subject: Added countdown to tomorrow's puzzles --- app/views/wittle/puzzles/about.html.haml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'app/views') diff --git a/app/views/wittle/puzzles/about.html.haml b/app/views/wittle/puzzles/about.html.haml index dcc3132..8bdb11e 100644 --- a/app/views/wittle/puzzles/about.html.haml +++ b/app/views/wittle/puzzles/about.html.haml @@ -19,5 +19,35 @@ %p.puzzle-status Solved! - elsif @expert_started %p.puzzle-status Started +#new-puzzles + - if @normal_puzzle.created_at.localtime.to_date != DateTime.now.localtime.to_date + New puzzles are being generated... + - else + Time until new puzzles: 00:00:00 + :javascript + function pad(val) { + var valString = val + "" + if (valString.length < 2) + { + return "0" + valString + } else { + return valString + } + } + function setTime() { + --totalSeconds + if (totalSeconds == 0) + { + $("#new-puzzles").text("Refresh the page for today's puzzles!") + clearInterval(timerInterval) + } else { + $("#seconds").text(pad(totalSeconds%60)) + $("#minutes").text(pad(parseInt(totalSeconds/60)%60)) + $("#hours").text(pad(parseInt(parseInt(totalSeconds/60)/60))) + } + } + var totalSeconds = #{(1.day.from_now.beginning_of_day - DateTime.now).to_i + 1} + setTime() + var timerInterval = setInterval(setTime, 1000); %p.summary Wittle was created by Hatkirby, with major help from Sigma144 (who wrote the puzzle generation code) and jbzdarkid (who wrote the puzzle solving web interface). If you encounter any bugs, or have feedback regarding puzzle difficulty level, feel free to contact me! I am hatkirby on Discord, and you can also find me in the Witness Speedrunning server. %p.summary There is an archive of past puzzles for those interested. -- cgit 1.4.1