mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-20636 Finish making ddwtos work, mostly. Also various other JS fixes.
This JavaScript really needs to be rewritten to use YUI3.
This commit is contained in:
parent
706d06e29b
commit
0fafed0f09
5 changed files with 30 additions and 11 deletions
|
@ -11,14 +11,15 @@ M.core_question_engine.questionformalreadysubmitted = false;
|
|||
* @param id the id of the button in the HTML.
|
||||
* @param slot the number of the question_attempt within the usage.
|
||||
*/
|
||||
M.core_question_engine.init_submit_button(Y, button, slot) {
|
||||
M.core_question_engine.init_submit_button = function(Y, button, slot) {
|
||||
var buttonel = document.getElementById(button);
|
||||
Y.on('click', function(e) {
|
||||
var scrollpos = document.getElementById('scrollpos');
|
||||
if (scrollpos) {
|
||||
scrollpos.value = YAHOO.util.Dom.getDocumentScrollTop();
|
||||
}
|
||||
button.form.action = button.form.action + '#q' + slot;
|
||||
}, button);
|
||||
buttonel.form.action = buttonel.form.action + '#q' + slot;
|
||||
}, buttonel);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -68,14 +69,14 @@ M.core_question_engine.init_form = function(Y, form) {
|
|||
* @param e the form submit event.
|
||||
* @param form the form element.
|
||||
*/
|
||||
M.core_question_engine.prevent_repeat_submission(e, Y) {
|
||||
M.core_question_engine.prevent_repeat_submission = function(e, Y) {
|
||||
if (M.core_question_engine.questionformalreadysubmitted) {
|
||||
e.halt();
|
||||
return;
|
||||
}
|
||||
|
||||
setTimeout(function() {
|
||||
Y.all('input[type=submit]').disabled = true;
|
||||
Y.all('input[type=submit]').set('disabled', true);
|
||||
}, 0);
|
||||
M.core_question_engine.questionformalreadysubmitted = true;
|
||||
}
|
||||
|
@ -84,7 +85,7 @@ M.core_question_engine.prevent_repeat_submission(e, Y) {
|
|||
* Beat IE into submission.
|
||||
* @param targetpos the target scroll position.
|
||||
*/
|
||||
M.core_question_engine.force_ie_to_scroll(targetpos) {
|
||||
M.core_question_engine.force_ie_to_scroll = function(targetpos) {
|
||||
var hackcount = 25;
|
||||
function do_scroll() {
|
||||
window.scrollTo(0, targetpos);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue