diff --git a/README.md b/README.md
new file mode 100644
index 0000000..75e49ea
--- /dev/null
+++ b/README.md
@@ -0,0 +1,16 @@
+H5P Question Set
+==========
+
+Test your users with by putting together multiple tasks into a question set(quiz).
+
+## License
+
+(The MIT License)
+
+Copyright (c) 2012-2014 Amendor AS
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/css/questionset.css b/css/questionset.css
index 0fe886e..e63b276 100644
--- a/css/questionset.css
+++ b/css/questionset.css
@@ -1,111 +1,246 @@
+/* IcoMoon font licensed under the GNU General Public License: http://www.gnu.org/licenses/gpl.html */
+@font-face {
+ font-family: 'icomoon-questionset';
+ src:url('../fonts/icomoon.eot');
+ src:url('../fonts/icomoon.eot?#iefix') format('embedded-opentype'),
+ url('../fonts/icomoon.woff') format('woff'),
+ url('../fonts/icomoon.ttf') format('truetype'),
+ url('../fonts/icomoon.svg#icomoon') format('svg');
+ font-weight: normal;
+ font-style: normal;
+}
+
+.questionset-results h2 {
+ font-size: 1.2em;
+ font-weight: bold;
+ padding-bottom: 0.5em;
+}
+
+.questionset, .intro-page, .questionset-results {
+ overflow: hidden;
+}
+.questionset.hidden {
+ display: none;
+}
+.questionset .h5p-multichoice > .h5p-show-solution, .questionset .dragndrop > .h5p-show-solution, .h5p-blanks .h5p-button {
+ display: none;
+}
+.questionset, .intro-page, .questionset-results {
+ position: relative;
+}
+.h5p-multichoice > .h5p-question {
+ text-align: left;
+ margin: 0.5em 0.5em 0.7em;
+ background: rgba(255, 255, 255, 0.9);
+ filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#e6FFFFFF,endColorstr=#e6FFFFFF);
+ zoom: 1;
+}
.dots-container {
text-align: center;
+ line-height: 2em;
}
.progress-dot {
display: inline-block;
- width: 10px;
- height: 10px;
+ width: 0.6em;
+ height: 0.6em;
border-radius: 50%;
- border: 1px solid #494949;
- margin: 0 3px;
+ margin: 0 0.25em;
cursor: pointer;
+ background: #fff;
+ background: #cecece;
+}
+.progress-dot:hover {
+ box-shadow: 0 0 0.5em #c7c7c7;
}
.progress-dot.answered {
- background: #494949;
+ background: #bccade;
}
.progress-dot.current {
- box-shadow: 1px 1px 4px #494949;
- margin: -1px 4px 1px 2px;
-}
-.intro-page {
- /*background-color: rgba(255,255,255,0.9);*/
- /*padding: 10px;*/
- position: absolute;
- z-index: 20;
- height: 100%;
- width: 100%;
- left: 0px;
- top: 0px;
-}
-.intro-page .title {
- font-size: 200%;
- font-weight: bold;
- text-align: center;
- margin: 1em;
-}
-.intro-page .introduction {
- font-size: 125%;
- margin: 1em 10%;
-}
-.intro-page .buttons {
- position: absolute;
- top: 200px;
- left: 182px;
- text-align: right;
+ background: #267ec9;
}
-#qs-startbutton {
- border: 4px solid #BABABA;
- border-radius: 10px 10px 10px 10px;
- font-size: 50px;
- padding: 10px 20px;
+.intro-page .title {
+ font-size: 2em;
+ line-height: 2em;
+ font-weight: bold;
+ text-align: center;
+}
+.intro-page .introduction {
+ font-size: 1.25em;
+ margin: 0 1em;
+}
+.intro-page .buttons {
+ margin: 3em auto;
+ text-align: center;
+}
+.qs-footer {
+ overflow: hidden;
+}
+.qs-footer .button, .qs-startbutton, .qs-finishbutton, .questionset-results .button, .video-container > .button {
+ display: inline-block;
+ padding: 0.2em 1em;
+ border: 0.2em solid #fff;
+ border-radius: 0.4em;
+ margin: 0 0.5em 1em;
cursor: pointer;
+ color: #ffffff;
+ box-shadow: 0 0 0.5em #999;
+
+ background: rgb(100,152,254); /* Old browsers */
+ background: -moz-linear-gradient(top, rgba(100,152,254,1) 0%, rgba(4,104,206,1) 100%); /* FF3.6+ */
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(100,152,254,1)), color-stop(100%,rgba(4,104,206,1))); /* Chrome,Safari4+ */
+ background: -webkit-linear-gradient(top, rgba(100,152,254,1) 0%,rgba(4,104,206,1) 100%); /* Chrome10+,Safari5.1+ */
+ background: -o-linear-gradient(top, rgba(100,152,254,1) 0%,rgba(4,104,206,1) 100%); /* Opera 11.10+ */
+ background: -ms-linear-gradient(top, rgba(100,152,254,1) 0%,rgba(4,104,206,1) 100%); /* IE10+ */
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6498fe', endColorstr='#0468ce',GradientType=0 ); /* IE6-9 */
+}
+.qs-footer .button:hover, .qs-startbutton:hover, .questionset-results .button:hover, .video-container > .button:hover {
+ text-decoration: none;
+ box-shadow: 0 0 0.5em #999;
+ color: #ffffff;
+
+ background: rgb(4,104,206); /* Old browsers */
+ background: -moz-linear-gradient(top, rgba(4,104,206,1) 0%, rgba(100,152,254,1) 100%); /* FF3.6+ */
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(4,104,206,1)), color-stop(100%,rgba(100,152,254,1))); /* Chrome,Safari4+ */
+ background: -webkit-linear-gradient(top, rgba(4,104,206,1) 0%,rgba(100,152,254,1) 100%); /* Chrome10+,Safari5.1+ */
+ background: -o-linear-gradient(top, rgba(4,104,206,1) 0%,rgba(100,152,254,1) 100%); /* Opera 11.10+ */
+ background: -ms-linear-gradient(top, rgba(4,104,206,1) 0%,rgba(100,152,254,1) 100%); /* IE10+ */
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#0468ce', endColorstr='#6498fe',GradientType=0 ); /* IE6-9 */
+}
+.qs-footer > .prev {
+ float: left;
+}
+
+.qs-footer > .qs-solutionbutton {
+ float: none;
+}
+
+.qs-footer > .next, .qs-footer > .finish, .qs-finishbutton {
+ float: right;
+}
+
+.qs-footer a.next.button:after {
+ font-family: H5PFontAwesome;
+ content: " \f054";
+}
+
+.qs-footer a.prev.button:before {
+ font-family: H5PFontAwesome;
+ content: "\f053 ";
+}
+
+.questionset-results .qs-finishbutton {
+ display: none;
+}
+
+.qs-footer a.finish.button:before {
+ font-family: H5PFontAwesome;
+ content: "\f00c ";
+}
+
+.questionset-results a.button.qs-solutionbutton:before {
+ font-family: H5PFontAwesome;
+ content: "\f06e ";
+}
+
+.video-container {
+ position: relative;
+}
+.video-container > video {
+ background-color: #000;
+}
+.video-container > .button {
+ position: absolute;
+ top: 0.5em;
+ right: 0.5em;
}
.qs-progress {
- line-height: 40px;
- padding: 0;
+ text-align: center;
+ line-height: 1.5em;
}
.questionset-results {
- background-image: url(img/Paper-clean.png);
- background-color: rgba(255, 255, 255, 0.75);
-
- padding: 10px;
- height: 480px;
text-align: center;
+ background: rgba(255, 255, 255, 0.9);
+ filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#E6FFFFFF,endColorstr=#E6FFFFFF);
+ padding: 0.625em;
}
.questionset-results .greeting {
- margin-top: 180px;
+ text-align: left;
+ border-bottom: 0.1em solid #ddd;
+ width: 100%;
}
.questionset-results .score {
- font-size: 25px;
- margin-top: 40px;
+ margin: 0;
+ display: block;
+ margin-bottom: 2em;
}
.questionset-results .resulttext {
- font-size: 20px;
- line-height: 25px;
- margin: 40px 100px;
- padding-left: 60px;
- min-height: 60px;
+ text-align: left;
+ font-size: 1.25em;
+ line-height: 1.25em;
+ margin: 1em 0em;
background-repeat: no-repeat;
background-position: left center;
}
-.questionset-results .resulttext.fail {
- background-image: url(img/mark-fail.png);
-}
.questionset-results .resulttext.fail em {
font-style: normal;
color: #b9272d;
}
-.questionset-results .resulttext.success {
- background-image: url(img/mark-pass.png);
+.questionset-results .score.success .emoticon:before {
+ font-family: icomoon-questionset;
+ font-size: 5em;
+ line-height: 100%;
+ content: "\e606";
+ float: left;
}
+
+.questionset-results .score.fail .emoticon:before {
+ font-family: icomoon-questionset;
+ font-size: 5em;
+ line-height: 100%;
+ content: "\e607";
+ float: left;
+}
+
+.questionset-results .resulttext.success,
+.questionset-results .resulttext.almost,
+.questionset-results .resulttext.fail
+{
+ display: block;
+ background: #eee;
+ padding: 1em;
+ border-radius: 1em;
+ margin-left: 6.5em;
+ position: relative;
+ font-size: 1em;
+}
+
+.questionset-results .resulttext.success:before,
+.questionset-results .resulttext.fail:before
+{
+ font-family: icomoon-questionset;
+ content: "";
+ font-size: 5em;
+ position: absolute;
+ left: -15px;
+ top: 36px;
+ height: 0;
+ width: 0;
+ border-top: 15px solid transparent;
+ border-bottom: 15px solid transparent;
+ border-right: 15px solid #eee;
+ display: inline-block;
+}
+
.questionset-results .resulttext.success em {
font-style: normal;
color: #6aa81b;
+ text-align: left;
}
-.questionset-results .buttons {
- position: absolute;
- bottom: 40px;
- right: 25px;
-}
-
-button, .button {
- cursor: pointer;
-}
\ No newline at end of file
diff --git a/fonts/icomoon.eot b/fonts/icomoon.eot
new file mode 100644
index 0000000..d8cdc1a
Binary files /dev/null and b/fonts/icomoon.eot differ
diff --git a/fonts/icomoon.svg b/fonts/icomoon.svg
new file mode 100644
index 0000000..1a48364
--- /dev/null
+++ b/fonts/icomoon.svg
@@ -0,0 +1,14 @@
+
+
+
\ No newline at end of file
diff --git a/fonts/icomoon.ttf b/fonts/icomoon.ttf
new file mode 100644
index 0000000..9649f7e
Binary files /dev/null and b/fonts/icomoon.ttf differ
diff --git a/fonts/icomoon.woff b/fonts/icomoon.woff
new file mode 100644
index 0000000..5d29f5d
Binary files /dev/null and b/fonts/icomoon.woff differ
diff --git a/js/questionset.js b/js/questionset.js
index 078d1da..3985f57 100644
--- a/js/questionset.js
+++ b/js/questionset.js
@@ -1,125 +1,140 @@
-// Will render a Question with multiple choices for answers.
-
-// Options format:
-// {
-// title: "Optional title for question box",
-// question: "Question text",
-// answers: [{text: "Answer text", correct: false}, ...],
-// singleAnswer: true, // or false, will change rendered output slightly.
-// }
-//
-// Events provided:
-// - h5pQuestionSetFinished: Triggered when a question is finished. (User presses Finish-button)
var H5P = H5P || {};
+if (H5P.getPath === undefined) {
+ /**
+ * Find the path to the content files based on the id of the content
+ *
+ * Also identifies and returns absolute paths
+ *
+ * @param {String} path Absolute path to a file, or relative path to a file in the content folder
+ * @param {Number} contentId Identifier of the content requesting the path
+ * @returns {String} The path to use.
+ */
+ H5P.getPath = function (path, contentId) {
+ if (path.substr(0, 7) === 'http://' || path.substr(0, 8) === 'https://') {
+ return path;
+ }
+
+ return H5PIntegration.getContentPath(contentId) + path;
+ };
+}
+
+/**
+ * Will render a Question with multiple choices for answers.
+ *
+ * Events provided:
+ * - h5pQuestionSetFinished: Triggered when a question is finished. (User presses Finish-button)
+ *
+ * @param {Array} options
+ * @param {int} contentId
+ * @returns {H5P.QuestionSet} Instance
+ */
H5P.QuestionSet = function (options, contentId) {
- if ( !(this instanceof H5P.QuestionSet) )
+ if (!(this instanceof H5P.QuestionSet)) {
return new H5P.QuestionSet(options, contentId);
+ }
var $ = H5P.jQuery;
- var cp = H5P.getContentPath(contentId);
- var texttemplate = '' +
-'<% if (introPage.showIntroPage) { %>' +
-'
' +
-'
<%= introPage.title %>
' +
-'
<%= introPage.introduction %>
' +
-'
' +
-'
' +
-'<%} %>' +
-'' +
-'
<%= title %>
' +
-' <% for (var i=0; i
' +
-' ' +
-'
<%= questions[i].library %>
' +
-'
' +
-' <% } %>' +
-' ' +
-' ' +
- '';
- var resulttemplate = '' +
-'' +
-'
<%= greeting %>
' +
-'
<%= score %>
' +
-'
<%= resulttext %>
' +
-'
' +
-'
' +
- '';
+ var texttemplate =
+ '<% if (introPage.showIntroPage) { %>' +
+ '' +
+ '
<%= introPage.title %>
' +
+ '
<%= introPage.introduction %>
' +
+ '
' +
+ '
' +
+ '<% } %>' +
+ '' +
+ ' <% for (var i=0; i
' +
+ ' ' +
+ ' <% } %>' +
+ ' ' +
+ ' ';
+
+ var resulttemplate =
+ '' +
+ '
<%= message %>
' +
+ '
' +
+ '
' +
+ '
<% if (comment) { %>
<%= comment %>
<% } %><%= score %>
<%= resulttext %>' +
+ '
' +
+ '
' +
+ '
';
- var that = this;
var defaults = {
- title: "",
randomOrder: false,
initialQuestion: 0,
- backgroundImage: "",
+ backgroundImage: undefined,
progressType: 'dots',
passPercentage: 50,
questions: [],
introPage: {
- showIntroPage: true,
- title: "Welcome",
- introduction: "Click start to start.",
- startButtonText: "Start"
+ showIntroPage: false,
+ title: '',
+ introduction: '',
+ startButtonText: 'Start'
},
texts: {
- prevButton: "Previous",
- nextButton: "Next",
- finishButton: "Finish",
- textualProgress: "Question: @current of @total questions"
+ prevButton: 'Previous',
+ nextButton: 'Next',
+ finishButton: 'Finish',
+ textualProgress: 'Question: @current of @total questions'
},
endGame: {
showResultPage: true,
- resultPage: {
- successGreeting: "Congratulations!",
- successComment: "You have enough correct answers to pass the test.",
- failGreeting: "Sorry!",
- failComment: "You don't have enough correct answers to pass this test.",
- scoreString: "@score/@total",
- finishButtonText: "Finish"
- },
- animations: {
- showAnimations: false,
- successVideo: undefined,
- failVideo: undefined
- }
- }
+ message: 'Your result:',
+ successGreeting: 'Congratulations!',
+ successComment: 'You have enough correct answers to pass the test.',
+ failGreeting: 'Sorry!',
+ failComment: "You don't have enough correct answers to pass this test.",
+ scoreString: 'You got @score points of @total possible.',
+ finishButtonText: 'Finish',
+ solutionButtonText: 'Show solution',
+ showAnimations: false,
+ successVideo: undefined,
+ failVideo: undefined
+ },
+ postUserStatistics: (H5P.postUserStatistics === true)
};
var template = new EJS({text: texttemplate});
var endTemplate = new EJS({text: resulttemplate});
- var params = $.extend({}, defaults, options);
+ var params = $.extend(true, {}, defaults, options);
var currentQuestion = 0;
var questionInstances = new Array();
- var allQuestionsAnswered = false;
var $myDom;
+ renderSolutions = false;
- if (params.randomOrder) {
- // TODO: Randomize order of questions
- console.log("TODO: Randomize order of questions");
- }
+// if (params.randomOrder) {
+// // TODO: Randomize order of questions
+// }
// Instantiate question instances
- for (var i=0; i= params.questions.length) { questionNumber = params.questions.length - 1; }
+ if (questionNumber < 0) {
+ questionNumber = 0;
+ }
+ if (questionNumber >= params.questions.length) {
+ questionNumber = params.questions.length - 1;
+ }
// Hide all questions
- $('.question-container', $myDom).hide();
+ $('.question-container', $myDom).hide().eq(questionNumber).show();
- // Reshow the requested question
- $('#q-' + questionNumber, $myDom).show();
+ // Trigger resize on question in case the size of the QS has changed.
+ if (questionInstances[questionNumber].resize !== undefined) {
+ questionInstances[questionNumber].resize();
+ }
// Update progress indicator
// Test if current has been answered.
- if (params.progressType == 'textual') {
+ if (params.progressType === 'textual') {
$('.progress-text', $myDom).text(params.texts.textualProgress.replace("@current", questionNumber+1).replace("@total", params.questions.length));
- } else {
+ }
+ else {
// Set currentNess
$('.progress-dot.current', $myDom).removeClass('current');
- $('#qdot-' + questionNumber, $myDom).addClass('current');
+ $('.progress-dot:eq(' + questionNumber +')', $myDom).addClass('current');
}
// Remember where we are
@@ -175,44 +196,94 @@ H5P.QuestionSet = function (options, contentId) {
return currentQuestion;
};
+ var showSolutions = function () {
+ for (var i = 0; i < questionInstances.length; i++) {
+ questionInstances[i].showSolutions();
+ }
+ };
+
+ var rendered = false;
+
+ var reRender = function () {
+ rendered = false;
+ };
+
var _displayEndGame = function () {
+ if (rendered) {
+ $myDom.children().hide().filter('.questionset-results').show();
+ return;
+ }
+ rendered = true;
+
// Get total score.
var finals = getScore();
var totals = totalScore();
- var scoreString = params.endGame.resultPage.scoreString.replace("@score", finals).replace("@total", totals);
+ var scoreString = params.endGame.scoreString.replace("@score", finals).replace("@total", totals);
var success = ((100 * finals / totals) >= params.passPercentage);
var eventData = {
score: scoreString,
passed: success
};
var displayResults = function () {
+ if (params.postUserStatistics === true) {
+ H5P.setFinished(contentId, getScore(), totalScore());
+ }
+
if (!params.endGame.showResultPage) {
$(returnObject).trigger('h5pQuestionSetFinished', eventData);
return;
}
var eparams = {
- greeting: (success ? params.endGame.resultPage.succesGreeting : params.endGame.resultPage.failGreeting),
+ message: params.endGame.message,
+ comment: (success ? params.endGame.successGreeting : params.endGame.failGreeting),
score: scoreString,
scoreclass: (success ? 'success' : 'fail'),
- resulttext: (success ? params.endGame.resultPage.successComment : params.endGame.resultPage.failComment),
- finishButtonText: params.endGame.resultPage.finishButtonText
+ resulttext: (success ? params.endGame.successComment : params.endGame.failComment),
+ finishButtonText: params.endGame.finishButtonText,
+ solutionButtonText: params.endGame.solutionButtonText
};
// Show result page.
$myDom.children().hide();
$myDom.append(endTemplate.render(eparams));
- $('.qs-finishbutton').click(function (ev) {
+ $('.qs-finishbutton').click(function () {
$(returnObject).trigger('h5pQuestionSetFinished', eventData);
});
+ $('.qs-solutionbutton', $myDom).click(function () {
+ showSolutions();
+ $myDom.children().hide().filter('.questionset').show();
+ _showQuestion(params.initialQuestion);
+ });
};
- if (params.endGame.animations.showAnimations) {
- var videoData = success ? params.endGame.animations.successVideo : params.endGame.animations.failVideo;
+ if (params.endGame.showAnimations) {
+ var videoData = success ? params.endGame.successVideo : params.endGame.failVideo;
if (videoData) {
- H5P.playVideo($myDom, videoData, params.endGame.animations.skipButtonText, cp, function () {
+ $myDom.children().hide();
+ var $videoContainer = $('').appendTo($myDom);
+
+ var video = new H5P.Video({
+ files: videoData,
+ fitToWrapper: true,
+ controls: false,
+ autoplay: false
+ }, contentId);
+ video.endedCallback = function () {
displayResults();
- });
+ $videoContainer.hide();
+ };
+ video.attach($videoContainer);
+ video.play();
+
+ if (params.endGame.skipButtonText) {
+ $('' + params.endGame.skipButtonText + '').click(function () {
+ video.stop();
+ $videoContainer.hide();
+ displayResults();
+ }).appendTo($videoContainer);
+ }
+
return;
}
}
@@ -222,54 +293,68 @@ H5P.QuestionSet = function (options, contentId) {
// Function for attaching the multichoice to a DOM element.
var attach = function (target) {
- if (typeof(target) == "string") {
- $myDom = $("#" + target);
- } else {
+ if (typeof(target) === "string") {
+ $myDom = $('#' + target);
+ }
+ else {
$myDom = $(target);
}
// Render own DOM into target.
- $myDom.html(template.render(params)).css({
- backgroundImage: 'url(' + cp + params.backgroundImage.path + ')'
- });
+ $myDom.html(template.render(params));
+ if (params.backgroundImage !== undefined) {
+ $myDom.css({
+ overflow: 'hidden',
+ background: '#000 url("' + H5P.getPath(params.backgroundImage.path, contentId) + '") no-repeat 50% 50%',
+ backgroundSize: '100% auto'
+ });
+ }
// Attach questions
- for (var i=0; i= 0; i--) {
- score += questionInstances[i].totalScore();
+ score += questionInstances[i].getMaxScore();
}
return score;
};
+
+ /**
+ * Gather copyright information for the current content.
+ *
+ * @returns {H5P.ContentCopyrights}
+ */
+ var getCopyrights = function () {
+ var info = new H5P.ContentCopyrights();
+
+ // Background
+ if (params.backgroundImage.copyright !== undefined) {
+ var background = new H5P.MediaCopyright(params.backgroundImage.copyright);
+ background.setThumbnail(new H5P.Thumbnail(H5P.getPath(params.backgroundImage.path, contentId), params.backgroundImage.width, params.backgroundImage.height));
+ info.addMedia(background);
+ }
+
+ // Questions
+ for (var i = 0; i < questionInstances.length; i++) {
+ var questionInstance = questionInstances[i];
+ if (questionInstance.getCopyrights !== undefined) {
+ var rights = questionInstance.getCopyrights();
+ if (rights !== undefined) {
+ rights.setLabel('Question '+(i+1));
+ info.addContent(rights);
+ }
+ }
+ }
+
+ // Success video
+ var video = params.endGame.successVideo[0];
+ if (video.copyright !== undefined) {
+ info.addMedia(new H5P.MediaCopyright(video.copyright));
+ }
+
+ // Fail video
+ video = params.endGame.failVideo[0];
+ if (video.copyright !== undefined) {
+ info.addMedia(new H5P.MediaCopyright(video.copyright));
+ }
+
+ return info;
+ }
// Masquerade the main object to hide inner properties and functions.
var returnObject = {
attach: attach, // Attach to DOM object
getQuestions: function () {return questionInstances;},
getScore: getScore,
+ showSolutions: function () {
+ renderSolutions = true;
+ },
totalScore: totalScore,
- defaults: defaults // Provide defaults for inspection
+ reRender: reRender,
+ defaults: defaults, // Provide defaults for inspection
+ getCopyrights: getCopyrights
};
return returnObject;
};
diff --git a/language/nb.json b/language/nb.json
new file mode 100644
index 0000000..78d5451
--- /dev/null
+++ b/language/nb.json
@@ -0,0 +1,144 @@
+{
+ "semantics": [
+ {
+ "label": "Bakgrunnsbilde",
+ "description": "Bakgrunnsbilde for spørsmålssettet(ikke obligatorisk)."
+ },
+ {
+ "label": "Fremdriftsindikator",
+ "description": "Velg om fremdriften skal angis som prikker(få spørsmål) eller som tekst(mange spørsmål).",
+ "options": [
+ {
+ "label": "Angi fremdrift med tekst"
+ },
+ {
+ "label": "Angi fremdrift med prikker"
+ }
+ ]
+ },
+ {
+ "label": "Krav for å bestå",
+ "description": "Antall prosent riktig som kreves for å bestå spørsmålssettet."
+ },
+ {
+ "label": "Spørsmål",
+ "entity": "spørsmål",
+ "field": {
+ "label": "Spørsmål",
+ "fields": [
+ {
+ "label": "Spørsmålstype",
+ "description": "Velg spørsmålstype for dette spørsmålet"
+ }
+ ]
+ }
+ },
+ {
+ "label": "Introduksjon",
+ "fields": [
+ {
+ "label": "Vis introduksjon"
+ },
+ {
+ "label": "Tittel",
+ "description": "Tittel for intoduksjonssiden."
+ },
+ {
+ "label": "Introduksjonstekst",
+ "description": "Denne teksten vises før spørsmålssettet starter."
+ },
+ {
+ "label": "Tekst til \"Start\" knappen",
+ "default": "Start"
+ }
+ ]
+ },
+ {
+ "label": "Ledetekster",
+ "fields": [
+ {
+ "label": "Forrige-knappen",
+ "default": "Forrige"
+ },
+ {
+ "label": "Neste-knappen",
+ "default": "Neste"
+ },
+ {
+ "label": "Avslutt-knappen",
+ "default": "Avslutt"
+ },
+ {
+ "label": "Fremdriftstekst",
+ "description": "Tekst brukt hvis tekstlig angivelse av fremdrift er valgt. Variabler: @current og @total",
+ "default": "Deloppgåve @current av @total"
+ }
+ ]
+ },
+ {
+ "label": "Spørsmålssett avslutning",
+ "fields": [
+ {
+ "label": "Vis resultater"
+ },
+ {
+ "label": "Overskrift over tilbakemeldinger",
+ "default": "Ditt resultat:",
+ "description": "Denne overskriften vises over tilbakemeldingene på slutten av spørsmålssettet."
+ },
+ {
+ "label": "Poengvisningstekst",
+ "default": "Du fikk @score poeng av @total mulige.",
+ "description": "Tekst som viser brukerens oppnådde poeng. \"@score\" blir erstattet med utregnet resultat, \"@total\" blir erstattet med høyest mulige resultat."
+ },
+ {
+ "label": "Tittel ved bestått",
+ "default": "Gratulerer!",
+ "description": "Denne tittelen vises dersom brukeren har bestått spørsmålssettet."
+ },
+ {
+ "label": "Kommentar ved bestått",
+ "default": "Du presterte meget godt!",
+ "description": "Denne kommentaren vises dersom brukeren har bestått spørsmålssettet."
+ },
+ {
+ "label": "Tittel ved ikke bestått",
+ "default": "Ikke bestått",
+ "description": "Denne tittelen vises dersom brukeren ikke har bestått spørsmålssettet."
+ },
+ {
+ "label": "Kommentar ved ikke bestått",
+ "default": "Dette gikk ikke så bra. Prøv igjen!",
+ "description": "Denne kommentaren vises dersom brukeren ikke har bestått spørsmålssettet."
+ },
+ {
+ "label": "Tekst til \"Fasit\" knapp",
+ "default": "Vis fasit",
+ "description": ""
+ },
+ {
+ "label": "Tekst til \"Avslutt\" knapp",
+ "default": "Avslutt"
+ },
+ {
+ "label": "Vis video før resultatene"
+ },
+ {
+ "label": "Tillat å hoppe over video"
+ },
+ {
+ "label": "Tekst til \"Hopp over video\" knapp",
+ "default": "Hopp over"
+ },
+ {
+ "label": "Video ved bestått",
+ "description": "Denne videoen vil bli vist dersom brukeren består spørsmålssettet."
+ },
+ {
+ "label": "Video ved ikke bestått",
+ "description": "Denne videoen vil bli vist dersom brukeren ikke består spørsmålssettet."
+ }
+ ]
+ }
+ ]
+}
diff --git a/language/nn.json b/language/nn.json
new file mode 100644
index 0000000..0720be7
--- /dev/null
+++ b/language/nn.json
@@ -0,0 +1,144 @@
+{
+ "semantics": [
+ {
+ "label": "Bakgrunnsbilde",
+ "description": "Bakgrunnsbilde for spørsmålssettet(ikke obligatorisk)."
+ },
+ {
+ "label": "Fremdriftsindikator",
+ "description": "Velg om fremdriften skal angis som prikker(få spørsmål) eller som tekst(mange spørsmål).",
+ "options": [
+ {
+ "label": "Angi fremdrift med tekst"
+ },
+ {
+ "label": "Angi fremdrift med prikker"
+ }
+ ]
+ },
+ {
+ "label": "Krav for å bestå",
+ "description": "Antall prosent riktig som kreves for å bestå spørsmålssettet."
+ },
+ {
+ "label": "Spørsmål",
+ "entity": "spørsmål",
+ "field": {
+ "label": "Spørsmål",
+ "fields": [
+ {
+ "label": "Spørsmålstype",
+ "description": "Velg spørsmålstype for dette spørsmålet"
+ }
+ ]
+ }
+ },
+ {
+ "label": "Introduksjon",
+ "fields": [
+ {
+ "label": "Vis introduksjon"
+ },
+ {
+ "label": "Tittel",
+ "description": "Tittel for intoduksjonssiden."
+ },
+ {
+ "label": "Introduksjonstekst",
+ "description": "Denne teksten vises før spørsmålssettet starter."
+ },
+ {
+ "label": "Tekst til \"Start\" knappen",
+ "default": "Start"
+ }
+ ]
+ },
+ {
+ "label": "Ledetekster",
+ "fields": [
+ {
+ "label": "Forrige-knappen",
+ "default": "Forrige"
+ },
+ {
+ "label": "Neste-knappen",
+ "default": "Neste"
+ },
+ {
+ "label": "Avslutt-knappen",
+ "default": "Avslutt"
+ },
+ {
+ "label": "Fremdriftstekst",
+ "description": "Tekst brukt hvis tekstlig angivelse av fremdrift er valgt. Variabler: @current og @total",
+ "default": "Deloppgave @current av @total"
+ }
+ ]
+ },
+ {
+ "label": "Spørsmålssett avslutning",
+ "fields": [
+ {
+ "label": "Vis resultat"
+ },
+ {
+ "label": "Overskrift over tilbakemeldingar",
+ "default": "Ditt resultat:",
+ "description": "Denne overskriften vises over tilbakemeldingane på slutten av spørsmålssettet."
+ },
+ {
+ "label": "Poengvisningstekst",
+ "default": "Du fikk @score poeng av @total mulige.",
+ "description": "Tekst som viser brukerens oppnådde poeng. \"@score\" blir erstatta med utregna resultat, \"@total\" blir erstatta med høgest mulig resultat."
+ },
+ {
+ "label": "Tittel ved bestått",
+ "default": "Gratulerer!",
+ "description": "Denne tittelen vises dersom brukeren har bestått spørsmålssettet."
+ },
+ {
+ "label": "Kommentar ved bestått",
+ "default": "Du presterte meget godt!",
+ "description": "Denne kommentaren vises dersom brukaren har bestått spørsmålssettet."
+ },
+ {
+ "label": "Tittel ved ikkje bestått",
+ "default": "Ikkje bestått",
+ "description": "Denne tittelen visast dersom brukaren ikkje har bestått spørsmålssettet."
+ },
+ {
+ "label": "Kommentar ved ikkje bestått",
+ "default": "Dette gikk ikkje så bra. Prøv igjen!",
+ "description": "Denne kommentaren vises dersom brukaren ikkje har bestått spørsmålssettet."
+ },
+ {
+ "label": "Tekst til \"Fasit\" knapp",
+ "default": "Vis fasit",
+ "description": ""
+ },
+ {
+ "label": "Tekst til \"Avslutt\" knapp",
+ "default": "Avslutt"
+ },
+ {
+ "label": "Vis video før resultata"
+ },
+ {
+ "label": "Tillat å hoppe over video"
+ },
+ {
+ "label": "Tekst til \"Hopp over video\" knapp",
+ "default": "Hopp over"
+ },
+ {
+ "label": "Video ved bestått",
+ "description": "Denne videoen vil bli vist dersom brukaren består spørsmålssettet."
+ },
+ {
+ "label": "Video ved ikke bestått",
+ "description": "Denne videoen vil bli vist dersom brukaren ikkje består spørsmålssettet."
+ }
+ ]
+ }
+ ]
+}
diff --git a/library.json b/library.json
index cd31dac..f172de4 100644
--- a/library.json
+++ b/library.json
@@ -3,8 +3,9 @@
"contentType": "question",
"majorVersion": 1,
"minorVersion": 0,
- "patchVersion": 6,
+ "patchVersion": 43,
"runnable": 1,
+ "fullscreen": 0,
"machineName": "H5P.QuestionSet",
"author": "Amendor AS",
"license": "cc-by-sa",
@@ -15,9 +16,31 @@
{"path": "css/questionset.css"}
],
"preloadedDependencies": [
+ {
+ "machineName": "H5P.API",
+ "majorVersion": 1,
+ "minorVersion": 0
+ },
{
"machineName": "EmbeddedJS",
- "majorVersion": 1,
+ "majorVersion": 1,
+ "minorVersion": 0
+ },
+ {
+ "machineName": "FontAwesome",
+ "majorVersion": 3,
+ "minorVersion": 1
+ },
+ {
+ "machineName": "H5P.Video",
+ "majorVersion": 1,
+ "minorVersion": 0
+ }
+ ],
+ "editorDependencies": [
+ {
+ "machineName": "H5PEditor.VerticalTabs",
+ "majorVersion": 1,
"minorVersion": 0
}
]
diff --git a/semantics.json b/semantics.json
index d1ef7e8..b63bc42 100644
--- a/semantics.json
+++ b/semantics.json
@@ -1,26 +1,9 @@
[
- {
- "name": "title",
- "type": "text",
- "label": "Title",
- "description": "Question set title (optional)."
- },
- {
- "name": "randomOrder",
- "type": "boolean",
- "label": "Randomize order",
- "description": "Whether questions should be shown in random order."
- },
- {
- "name": "initialQuestion",
- "type": "number",
- "label": "Initial question",
- "description": "Which question to start with. Count from 0."
- },
{
"name": "backgroundImage",
"type": "image",
"label": "Background image",
+ "optional": true,
"description": "An optional background image for the Question set."
},
{
@@ -28,17 +11,17 @@
"type": "select",
"label": "Progress indicator",
"description": "Question set progress indicator style.",
- "values": [
+ "options": [
{
- "text": "Textual",
- "value": "textual"
+ "value": "textual",
+ "label": "Textual"
},
{
- "text": "Dots",
- "value": "dots"
+ "value": "dots",
+ "label": "Dots"
}
],
- "default": "textual"
+ "default": "dots"
},
{
"name": "passPercentage",
@@ -52,50 +35,68 @@
},
{
"name": "questions",
+ "label": "Questions",
"type": "list",
+ "widget": "verticalTabs",
+ "min": 1,
"entity": "question",
"field": {
"name": "question",
- "type": "group",
- "label": "Question",
- "fields": [
- {
- "name": "library",
- "type": "library",
- "label": "Question library",
- "description": "Library for this question.",
- "options": [
- "H5P.MultiChoice 1.0"
- ]
- }
+ "type": "library",
+ "label": "Question type",
+ "description": "Library for this question.",
+ "options": [
+ "H5P.MultiChoice 1.0",
+ "H5P.DragQuestion 1.0",
+ "H5P.Blanks 1.0"
]
}
},
{
"name": "introPage",
"type": "group",
- "label": "Intro page",
- "description": "Data for the intro page.",
+ "label": "Quiz introduction",
"fields": [
{
"name": "showIntroPage",
"type": "boolean",
- "label": "Show intro page?"
+ "label": "Display introduction"
},
{
"name": "title",
"type": "text",
- "label": "Title"
+ "label": "Title",
+ "optional": true,
+ "description": "This title will be displayed above the introduction text.",
+ "tags": [
+ "sub",
+ "sup",
+ "strong",
+ "em"
+ ]
},
{
"name": "introduction",
"type": "text",
- "label": "Introduction text"
+ "widget": "html",
+ "label": "Introduction text",
+ "optional": true,
+ "description": "This text will be displayed before the quiz starts.",
+ "enterMode": "p",
+ "tags": [
+ "sub",
+ "sup",
+ "strong",
+ "em",
+ "p"
+ ]
},
{
"name": "startButtonText",
"type": "text",
- "label": "Start button text"
+ "label": "Start button text",
+ "optional": true,
+ "default": "Start Quiz"
}
]
},
@@ -128,94 +129,146 @@
"type": "text",
"label": "Progress text",
"description": "Text used if textual progress is selected.",
- "default": "Question: @current of @total questions"
+ "default": "Question: @current of @total questions",
+ "tags": [
+ "strong",
+ "em"
+ ]
}
]
},
{
"name": "endGame",
"type": "group",
- "label": "End game data",
+ "label": "Quiz finished",
"fields": [
{
"name": "showResultPage",
"type": "boolean",
- "label": "Show result page",
+ "label": "Display results",
"default": true
},
{
- "name": "resultPage",
- "type": "group",
- "label": "Result page",
- "description": "Data and texts for the result page.",
- "fields": [
- {
- "name": "successGreeting",
- "type": "text",
- "label": "Success greeting",
- "description": "Title in result page on success."
- },
- {
- "name": "successComment",
- "type": "text",
- "label": "Success comment",
- "description": "Comment shown after the score."
- },
- {
- "name": "failGreeting",
- "type": "text",
- "label": "Failed greeting",
- "description": "Title in result page on failed quiz."
- },
- {
- "name": "failComment",
- "type": "text",
- "label": "Failed comment",
- "description": "Comment shown after the score on failed quiz."
- },
- {
- "name": "finishButtonText",
- "type": "text",
- "label": "Finish button text",
- "description": "Text for the finish button."
- }
+ "name": "message",
+ "type": "text",
+ "label": "Feedback heading",
+ "default": "Your result:",
+ "optional": true,
+ "description": "This heading will be displayed at the end of the quiz when the user has answered all questions.",
+ "tags": [
+ "strong",
+ "em"
]
},
{
- "name": "animations",
- "type": "group",
- "label": "Animations",
- "fields": [
- {
- "name": "showAnimations",
- "type": "boolean",
- "label": "Show animations"
- },
- {
- "name": "skippable",
- "type": "boolean",
- "label": "Skippable"
- },
- {
- "name": "skipButtonText",
- "type": "text",
- "label": "Skip button text",
- "common": true
- },
- {
- "name": "successVideo",
- "type": "video",
- "label": "Success video",
- "description": "Video displayed on successful quiz."
- },
- {
- "name": "failVideo",
- "type": "video",
- "label": "Fail video",
- "description": "Video displayed on failed quiz."
- }
+ "name": "scoreString",
+ "type": "text",
+ "label": "Score display text",
+ "description": "Text used to display total user score. \"@score\" will be replaced by calculated score, \"@total\" will be replaced by maximum possible score. ",
+ "default": "You got @score points of @total possible.",
+ "optional": true
+ },
+ {
+ "name": "successGreeting",
+ "type": "text",
+ "label": "Quiz passed greeting",
+ "placeholder": "Congratulations!",
+ "default": "Congratulations!",
+ "optional": true,
+ "description": "This text will be displayed above the score if the user has successfully passed the quiz.",
+ "tags": [
+ "strong",
+ "em"
]
+ },
+ {
+ "name": "successComment",
+ "type": "text",
+ "widget": "html",
+ "label": "Passed comment",
+ "default": "You did very well!",
+ "optional": true,
+ "description": "This comment will be displayed after the score if the user has successfully passed the quiz.",
+ "tags": [
+ "sub",
+ "sup",
+ "strong",
+ "em",
+ "p"
+ ]
+ },
+ {
+ "name": "failGreeting",
+ "type": "text",
+ "label": "Quiz failed title",
+ "default": "Oh, no!",
+ "optional": true,
+ "description": "This text will be displayed above the score if the user has failed the quiz.",
+ "tags": [
+ "strong",
+ "em"
+ ]
+ },
+ {
+ "name": "failComment",
+ "type": "text",
+ "widget": "html",
+ "label": "Failed comment",
+ "default": "This didn't go so well.",
+ "optional": true,
+ "description": "This comment will be displayed after the score if the user has failed the quiz.",
+ "tags": [
+ "sub",
+ "sup",
+ "strong",
+ "em",
+ "p"
+ ]
+ },
+ {
+ "name": "solutionButtonText",
+ "type": "text",
+ "label": "Solution button label",
+ "default": "Show solution",
+ "description": "Text for the solution button."
+ },
+ {
+ "name": "finishButtonText",
+ "type": "text",
+ "label": "Finish button text",
+ "default": "Finish"
+ },
+ {
+ "name": "showAnimations",
+ "type": "boolean",
+ "label": "Display video before quiz results"
+ },
+ {
+ "name": "skippable",
+ "type": "boolean",
+ "label": "Enable skip video button"
+ },
+ {
+ "name": "skipButtonText",
+ "type": "text",
+ "label": "Skip video button label",
+ "default": "Skip video",
+ "common": true
+ },
+ {
+ "name": "successVideo",
+ "type": "video",
+ "label": "Passed video",
+ "optional": true,
+ "description": "This video will be played if the user successfully passed the quiz."
+ },
+ {
+ "name": "failVideo",
+ "type": "video",
+ "label": "Fail video",
+ "optional": true,
+ "description": "This video will be played if the user failes the quiz."
}
]
}
-]
+]
\ No newline at end of file