diff options
author | Samy Pessé <samypesse@gmail.com> | 2014-08-10 17:14:31 -0700 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2014-08-11 07:36:53 -0700 |
commit | 8171241666d68976970543b9a5ca4920c133c07e (patch) | |
tree | 631089ba113ff0c16bad08d162f5e14fe969054f /theme/javascript/core | |
parent | 1125e89b498b827c2ce49b5ada68dd8994ad23f0 (diff) | |
download | gitbook-8171241666d68976970543b9a5ca4920c133c07e.zip gitbook-8171241666d68976970543b9a5ca4920c133c07e.tar.gz gitbook-8171241666d68976970543b9a5ca4920c133c07e.tar.bz2 |
Remove quizzes handling from core
Diffstat (limited to 'theme/javascript/core')
-rwxr-xr-x | theme/javascript/core/navigation.js | 6 | ||||
-rw-r--r-- | theme/javascript/core/quiz.js | 55 |
2 files changed, 1 insertions, 60 deletions
diff --git a/theme/javascript/core/navigation.js b/theme/javascript/core/navigation.js index 04bb031..3749419 100755 --- a/theme/javascript/core/navigation.js +++ b/theme/javascript/core/navigation.js @@ -4,10 +4,9 @@ define([ "core/events", "core/state", "core/progress", - "core/quiz", "core/loading", "core/search" -], function($, URL, events, state, progress, quiz, loading, search) { +], function($, URL, events, state, progress, loading, search) { var prev, next; var usePushState = (typeof history.pushState !== "undefined"); @@ -75,9 +74,6 @@ define([ var preparePage = function() { var $pageWrapper = $(".book-body .page-wrapper"); - // Bind quiz - quiz.init(); - // Show progress progress.show(); diff --git a/theme/javascript/core/quiz.js b/theme/javascript/core/quiz.js deleted file mode 100644 index ef31b40..0000000 --- a/theme/javascript/core/quiz.js +++ /dev/null @@ -1,55 +0,0 @@ -define([ - "jQuery", - "core/events", - "core/state" -], function($, events, state){ - // Bind an exercise - var prepareQuiz = function($quiz) { - - $quiz.find(".quiz-answers input").click(function(e) { - e.preventDefault(); - }); - - // Submit: test code - $quiz.find(".action-submit").click(function(e) { - e.preventDefault(); - events.trigger("exercise.submit", {type: "quiz"}); - $quiz.find("tr.alert-danger,li.alert-danger").removeClass("alert-danger"); - $quiz.find(".alert-success,.alert-danger").addClass("hidden"); - - $quiz.find(".question").each(function(q) { - var result = true; - - var $questions = $(this).find(".question-content").find("input[type=radio], input[type=checkbox]"); - var $answers = $(this).find(".question-answers").find("input[type=radio], input[type=checkbox]"); - - $questions.each(function(i) { - var correct = $(this).is(":checked") === $answers.slice(i).first().is(":checked"); - result = result && correct; - if (!correct) { - $(this).closest("tr, li").addClass("alert-danger"); - } - }); - $(this).find(result ? "div.alert-success" : "div.alert-danger").toggleClass("hidden"); - }); - - }); - - $quiz.find(".action-solution").click(function(e) { - e.preventDefault(); - $quiz.find(".question-content, .question-answers").toggleClass("hidden"); - }); - }; - - // Prepare all exercise - var init = function() { - state.$book.find("section.quiz").each(function() { - prepareQuiz($(this)); - }); - }; - - return { - init: init, - prepare: prepareQuiz - }; -});
\ No newline at end of file |