I tried that. I created a new theme component and then by using edit CSS/HTML option, I inserted that code in common>header section. I can see the timer on the website but the problem is that the timer doesn’t play. It has play and stop button, locally it works fine but on the website it only shows the timer but no functioning.
Yes, your code is being blocked by CSP. (see security settings)
You could whitelist unsafe-inline in the settings, but that doesn’t sound like a good idea.
In your case, to make your code work with CSP enabled, i believe you need to handle the click differently.
On a side note, here is a theme component using your code: https://github.com/Arkshine/discourse-timer-component.
Feel free to fork it and install it on your Discourse.
It should work the same with extra reactivity stuff, settings, and locale.
It may be overwhelming, but it is an excellent opportunity to dig into theme component development! Do not hesitate to ask if you don’t understand something.
I highly recommend using the Discourse Theme CLI if you want to work with it locally. It’s handy!
It’s a continuous timer, first starts with 1:30 sec then shift to 8:00 min then shift to 1:30 and so on, never ends.
When the timer is playing, users need to have the ability to bypass directly to 8:00 min by clicking on enter room button or shift to 1:30 timer by clicking on the read task timer. therefore disabling the pause and stop button when the timer is not playing makes sense but when the timer is playing and disabling the read task and enter room button will unable users to bypass the timer.
Adding a voice note at start 1:30 sec timer, start of 8:00 min timer, at remaining 2:00 min of 8:00 min timer and finally end of 8:00 min timer, which is basically the start of 1:30 sec. So in total three voice notes,
Adding a pop up alert for at each voice note, which appears and disappears, shouldn’t occupy the full screen, instead the area where timer is located.
I definitively did not understand everything in your code; it would seem
It doesn’t make sense to be able to click on those pause/stop buttons if a timer has not started. Same as showing “pause” or “resume”, so it’s like in the waiting you have an active timer. Actually, I would hide the button instead. But I guess it’s fine to use “pause” label as default.
It alternates between both, alright. I thought it was a loop with one of those timers.
I’m not sure to understand the context, it looks pretty weird to me, I can change it.
For me it’s amazing seeing this timer come to life. You’re amazing and inspiring.
This is a timer for a exam given by doctors, I am a doctor as well trying to help other doctors.
The exam consists of 16 rooms, containing 16 different patients that we need to diagnose and manage. Before entering any room a task is kept outside that you can read in 1 min 30 sec and then you enter the room, you have 8 minutes to perform the task and manage the patients, the cycle continues for 16 other rooms. that takes in total 3 hours to complete.
I unfortunately failed this exam, because of misinformation and misguidance related to this, which has inspired me to create this forum to help guide other doctors.
I found a bug, if I click on the read task button the timer goes from 1:30 min to 8:00 min and then keeps looping on 1:30 min. If I click on enter room button, the timer goes from 8:00 to 1:30 and then keeps looping on the 8:00 min timer.