| @@ -1,27 +1,27 @@ | ||
| 1 | -/** | |
| 2 | - * Custom functions for frontend quiz. | |
| 3 | - */ | |
| 4 | - | |
| 5 | -const { Hook } = LP; | |
| 6 | - | |
| 7 | -const $ = window.jQuery || jQuery; | |
| 8 | - | |
| 9 | -Hook.addFilter( 'question-blocks', function( blocks ) { | |
| 10 | - return blocks; ///[ 'answer-options', 'title', 'content', 'hint', 'explanation']; | |
| 11 | -} ); | |
| 12 | - | |
| 13 | -Hook.addAction( 'before-start-quiz', function() { | |
| 14 | -} ); | |
| 15 | - | |
| 16 | -Hook.addAction( 'quiz-started', function( results, id ) { | |
| 17 | - $( `.course-item-${ id }` ).removeClass( 'status-completed failed passed' ).addClass( 'has-status status-started' ); | |
| 18 | - | |
| 19 | - window.onbeforeunload = function() { | |
| 20 | - return 'Warning!'; | |
| 21 | - }; | |
| 22 | -} ); | |
| 23 | - | |
| 24 | -Hook.addAction( 'quiz-submitted', function( response, id ) { | |
| 25 | - $( `.course-item-${ id }` ).removeClass( 'status-started passed failed' ).addClass( `has-status status-completed ${ response.results.graduation }` ); | |
| 26 | - window.onbeforeunload = null; | |
| 27 | -} ); | |
| 1 | +/** | |
| 2 | + * Custom functions for frontend quiz. | |
| 3 | + */ | |
| 4 | + | |
| 5 | +const { Hook } = LP; | |
| 6 | + | |
| 7 | +const $ = window.jQuery || jQuery; | |
| 8 | + | |
| 9 | +Hook.addFilter( 'question-blocks', function( blocks ) { | |
| 10 | + return blocks; ///[ 'answer-options', 'title', 'content', 'hint', 'explanation']; | |
| 11 | +} ); | |
| 12 | + | |
| 13 | +Hook.addAction( 'before-start-quiz', function() { | |
| 14 | +} ); | |
| 15 | + | |
| 16 | +Hook.addAction( 'quiz-started', function( results, id ) { | |
| 17 | + $( `.course-item-${ id }` ).removeClass( 'status-completed failed passed' ).addClass( 'has-status status-started' ); | |
| 18 | + | |
| 19 | + window.onbeforeunload = function() { | |
| 20 | + return 'Warning!'; | |
| 21 | + }; | |
| 22 | +} ); | |
| 23 | + | |
| 24 | +Hook.addAction( 'quiz-submitted', function( response, id ) { | |
| 25 | + $( `.course-item-${ id }` ).removeClass( 'status-started passed failed' ).addClass( `has-status status-completed ${ response.results.graduation }` ); | |
| 26 | + window.onbeforeunload = null; | |
| 27 | +} ); | |