Issue #3157376: Display timer not available
5 unresolved threads
Merge request reports
Activity
- js/countdown.timer.js 0 → 100644
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ó
- Resolved by Attila Santo-Rieder
- Resolved by Attila Santo-Rieder
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 } 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ó
- js/countdown.timer.js 0 → 100644
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 => { changed this line in version 2 of the diff
added 1 commit
Please register or sign in to reply