MDL-38538 quiz autosave: fix JavaScript errors.
authorTim Hunt <T.J.Hunt@open.ac.uk>
Thu, 4 Apr 2013 10:38:58 +0000 (11:38 +0100)
committerTim Hunt <T.J.Hunt@open.ac.uk>
Thu, 4 Apr 2013 11:32:54 +0000 (12:32 +0100)
1. Make cancelling the delay more robust.
2. Ignore changes in flag state. They are already saved using AJAX.
3. Typo that caused an error when there was no TinyMCE on the page.

mod/quiz/yui/build/moodle-mod_quiz-autosave/moodle-mod_quiz-autosave-coverage.js
mod/quiz/yui/build/moodle-mod_quiz-autosave/moodle-mod_quiz-autosave-debug.js
mod/quiz/yui/build/moodle-mod_quiz-autosave/moodle-mod_quiz-autosave-min.js
mod/quiz/yui/build/moodle-mod_quiz-autosave/moodle-mod_quiz-autosave.js
mod/quiz/yui/src/autosave/js/autosave.js

index 983a753..b0ac14d 100644 (file)
Binary files a/mod/quiz/yui/build/moodle-mod_quiz-autosave/moodle-mod_quiz-autosave-coverage.js and b/mod/quiz/yui/build/moodle-mod_quiz-autosave/moodle-mod_quiz-autosave-coverage.js differ
index 7d54780..76a2f50 100644 (file)
Binary files a/mod/quiz/yui/build/moodle-mod_quiz-autosave/moodle-mod_quiz-autosave-debug.js and b/mod/quiz/yui/build/moodle-mod_quiz-autosave/moodle-mod_quiz-autosave-debug.js differ
index 005bc0a..5960b48 100644 (file)
Binary files a/mod/quiz/yui/build/moodle-mod_quiz-autosave/moodle-mod_quiz-autosave-min.js and b/mod/quiz/yui/build/moodle-mod_quiz-autosave/moodle-mod_quiz-autosave-min.js differ
index 44eb073..b8b072d 100644 (file)
Binary files a/mod/quiz/yui/build/moodle-mod_quiz-autosave/moodle-mod_quiz-autosave.js and b/mod/quiz/yui/build/moodle-mod_quiz-autosave/moodle-mod_quiz-autosave.js differ
index 14c039c..4f5dafb 100644 (file)
@@ -121,7 +121,7 @@ M.mod_quiz.autosave = {
     init_tinymce: function(repeatcount) {
         if (typeof tinymce === 'undefined') {
             if (repeatcount > 0) {
-                Y.later(this.TINYMCE_DETECTION_DELAY, this, self.init_tinymce,repeatcount - 1);
+                Y.later(this.TINYMCE_DETECTION_DELAY, this, this.init_tinymce, [repeatcount - 1]);
             }
             return;
         }
@@ -145,7 +145,7 @@ M.mod_quiz.autosave = {
     },
 
     value_changed: function(e) {
-        if (e.target.get('name') === 'thispage') {
+        if (e.target.get('name') === 'thispage' || e.target.get('name').match(/_:flagged$/)) {
             return; // Not interesting.
         }
         Y.log('Detected a value change in element ' + e.target.get('name') + '.');
@@ -174,7 +174,7 @@ M.mod_quiz.autosave = {
     },
 
     cancel_delay: function() {
-        if (this.delay_timer) {
+        if (this.delay_timer && this.delay_timer !== true) {
             this.delay_timer.cancel();
         }
         this.delay_timer = null;