Skip to content
Snippets Groups Projects

Issue #3157376: Display timer not available

5 unresolved threads
Closed Attila Santo-Rieder requested to merge issue/quiz-3157376:3157376-jquery-countdown into 6.x
5 unresolved threads

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
6 countdowns.forEach(countdown => {
7 var dt = new Date();
8 dt.setSeconds(countdown.since);
9 $('.' + countdown.id, context).once().countdown(dt)
10 .on('update.countdown', function (event) {
11 var format = countdown.format;
12 $(this).html(event.strftime(format));
13 })
14 .on('finish.countdown', function (event) {
15 Drupal.behaviors.quizCountdown.quizFinished();
16 });
17 });
18 }
19 },
20 quizFinished: function () {
21 $('#edit-navigation-submit-hidden').click();
  • If the Leave empty button is existing, trigger that instead of the simple submit, as the simple submit can be blocked by unselected answers.

          let skip_button = $('#edit-navigation-skip');
          if (skip_button.length > 0) {
            skip_button.click();
          }
          else {
            $('#edit-navigation-submit-hidden').click();
          }

    Actually here it would be nice if the quiz would have some sort of end now button which is used only for the timer, so it won't go through for the user on all the 50+ questions if it's a long questioneer when the time expires.

    Edited by Márton Dankó
  • Please register or sign in to reply
  • 11 11 function quiz_install() {
    12 12 user_role_grant_permissions(AccountInterface::AUTHENTICATED_ROLE, ['view own quiz_result', 'view any quiz', 'access quiz']);
    13 13 }
    14
    15 /**
    16 * If the JavaScript Libraries don't exist, show a warning on the status page.
    17 */
    18 function quiz_requirements($phase) {
    19 $requirements = [];
    20 if ($phase === 'runtime') {
    21 if (!\file_exists(DRUPAL_ROOT . '/libraries/jquery-countdown/dist/jquery.countdown.min.js')) {
  • 10 js/jumper.js: {}
    11 countdown:
    12 remote: https://github.com/hilios/jQuery.countdown
    13 version: 2.2.0
    14 js:
    15 /libraries/jquery-countdown/dist/jquery.countdown.min.js: { minified: true }
    • I would allow here the DRUPAL_ROOT . '/libraries/jquery-countdown/jquery.countdown.min.js' version also, so if somebody wants to use the release version then he can, but in that case, this needs to be added in a hook.

    • Please register or sign in to reply
  • 53 53
    54 54 * [Charts](http://drupal.org/project/charts) - used by Quiz stats to render
    55 55 some useful data
    56 * [jQuery Countdown](http://drupal.org/project/jquery_countdown) - provides
    57 jQuery timer for timed quizzes
    56 * [jQuery Countdown](http://hilios.github.io/jQuery.countdown) - provides
    57 jQuery timer for timed quizzes. Install manually or by composer.
    • Please provide an example code. Like for the composer put this under repositories:

              {
                  "type": "package",
                  "package": {
                      "name": "hilios/jquery-countdown",
                      "version": "2.2.0",
                      "type": "drupal-library",
                      "dist": {
                          "url": "https://github.com/hilios/jQuery.countdown/archive/refs/tags/2.2.0.zip",
                          "type": "zip"
                      }
                  }
              },

      and then composer require hilios/jquery-countdown

      Edited by Márton Dankó
    • Please register or sign in to reply
  • 1 (function ($, Drupal, drupalSettings) {
    2 Drupal.behaviors.quizCountdown = {
    3 attach: function (context) {
    4 var countdowns = drupalSettings.jquery_countdown_quiz;
    5 if (countdowns.length > 0 ) {
    6 countdowns.forEach(countdown => {
  • added 1 commit

    • efb44582 - Issue #3157376 by heshanlk, djdevin: Display timer not available, fixing missing seconds

    Compare with previous version

  • Please register or sign in to reply
    Loading