r21685 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r21684‎ | r21685 | r21686 >
Date:16:24, 28 April 2007
Author:lrbabe
Status:old
Tags:
Comment:
* Add a reset button next to the submit button when the quiz is marked.
* Disable the shuffle button as soon as the user begin to answer.
Modified paths:
  • /trunk/extensions/Quiz/quiz.js (modified) (history)

Diff [purge]

Index: trunk/extensions/Quiz/quiz.js
@@ -78,22 +78,35 @@
7979 };
8080 }
8181 // Displays the shuffle buttons.
82 - else if(input[j].className == "scriptshow") {
 82+ else if(input[j].className == "shuffle") {
8383 input[j].style.display = "inline";
84 - input[j].onclick = function() { shuffle(this.parentNode.parentNode.parentNode.parentNode.parentNode.getElementsByTagName('div')[0]); };
85 - }
86 - // Correct the bug of ie6 on textfields
87 - else if((input[j].className == "numbers" || input[j].className == "words")
88 - && typeof document.body.style.maxHeight == "undefined" ) {
89 - input[j].parentNode.onclick = function() {
90 - this.parentNode.firstChild.style.display = "inline";
91 - this.parentNode.firstChild.style.position = "absolute";
92 - this.parentNode.firstChild.style.marginTop = "1.7em";
 84+ input[j].onclick = function() { shuffle(this.form.getElementsByTagName('div')[0]); };
 85+ }
 86+ // Display the reset button
 87+ else if(input[j].className == "reset") {
 88+ input[j].style.display = "inline";
 89+ input[j].onclick = function() {
 90+ this.form.quizId.value = "";
 91+ this.form.submit();
9392 };
94 - input[j].parentNode.onmouseout = function() {
95 - this.parentNode.firstChild.style.display = "none";
96 - };
9793 }
 94+ // Correct the bug of ie6 on textfields
 95+ else if(input[j].className == "numbers" || input[j].className == "words") {
 96+ if(typeof document.body.style.maxHeight == "undefined" ) {
 97+ input[j].parentNode.onclick = function() {
 98+ this.parentNode.firstChild.style.display = "inline";
 99+ this.parentNode.firstChild.style.position = "absolute";
 100+ this.parentNode.firstChild.style.marginTop = "1.7em";
 101+ };
 102+ input[j].parentNode.onmouseout = function() {
 103+ this.parentNode.firstChild.style.display = "none";
 104+ };
 105+ }
 106+ input[j].onkeydown = function() { this.form.shuffleButton.disabled = true; };
 107+ }
 108+ if(input[j].className == "check") {
 109+ input[j].onclick = function() { this.form.shuffleButton.disabled = true; };
 110+ }
98111 }
99112 }
100113 }