Thanks for confirming that this little script works great. It may be useful to other people.
To do things in a more conventional way, creating a new type of question should be considered. In fact, it would simply be a modified Description question, which could be called "Timed description", to which the following features would be added:
- A timer is added while the content (photo, text, etc.) is displayed.
- The duration of the display is a setting of the question, i.e. it is set by the teacher.
- The display can be automatic, as soon as the question is loaded, or triggered by the student.
- The counter continues to run even if the student reloads the page or leaves and returns to the page.
- When the time is up, the content of the question is hidden and remains hidden even if the student reloads the page or leaves and returns to the page.
- Going to the next page is automatic or triggered by clicking on the Next page button.
- The content of the question must be displayed in the quiz review.
- There may be other things to consider.
There are obviously many variations of this sort of timed question. The actual questions, that is, other than Description, could also be timed.
The display of pages could also be timed. It would then be more of a new quiz settings, that is, a display time could be set by the teacher for any given page of the quiz. That would involve modifications to the quiz module itself.