Skip to content

Commit

Permalink
FEV-130 - IVQ, Skip Back/Next (#3651)
Browse files Browse the repository at this point in the history
* FEV-140
[IVQ-Player] local issue - continue used for 2 places
Without UI

* FEV-130
1. add imgs
2. fix position

* FEV-130 - IVQ, Skip Back/Next
1: add comments
2: change logic
  • Loading branch information
korniiov authored and eitanavgil committed Feb 25, 2018
1 parent 79bf411 commit cdbf659
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 1 deletion.
39 changes: 38 additions & 1 deletion modules/Quiz/resources/css/quiz.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 47 additions & 0 deletions modules/Quiz/resources/quiz.js
Original file line number Diff line number Diff line change
Expand Up @@ -659,8 +659,55 @@
$('#kplayer_pid_kplayer').css('display', 'block');
$('#kplayer_pid_kplayer').attr('aria-hidden', 'false');
},

addQuePointsNavigationButtons:function (questionNr) {
var _this = this;
var allPoints = $.cpObject.cpArray;
var currentPoint = allPoints[questionNr];
if(currentPoint){
var nextBtn = $('<a/>').addClass('cp-navigation-btn next-cp disabled');
var prevBtn = $('<a/>').addClass('cp-navigation-btn prev-cp disabled');
var separator = $("<div/>").addClass('separator-block').append($('<span/>').addClass('separator'));

var prevQuePoint = allPoints[currentPoint.key-1];
if(currentPoint.key > allPoints[0].key && prevQuePoint){
//allow go to prev CP: 1 - if canSkip is true; 2 - if canSkip is false but current CP and prev CP is already answered
if( (_this.KIVQModule.canSkip) || (!_this.KIVQModule.canSkip && currentPoint.isAnswerd && prevQuePoint.isAnswerd) ){
prevBtn.attr({'href':'#','tabindex': 7}).removeClass('disabled')
.on('keydown', _this.keyDownHandler)
.on('click',function (e) {
e.preventDefault();
_this.KIVQModule.continuePlay();
_this.seekToQuestionTime = prevQuePoint.startTime;
_this.KIVQModule.gotoScrubberPos(prevQuePoint.key);
_this.isSeekingIVQ = true;
mw.log("Quiz: gotoScrubberPos : " + prevQuePoint.key);
});
}
}
var nextQuePoint = allPoints[currentPoint.key+1];
if(currentPoint.key < allPoints[allPoints.length-1].key && nextQuePoint){
//allow go to next CP: 1 - if canSkip is true; 2 - if canSkip is false but current CP and next CP is already answered
if( (_this.KIVQModule.canSkip) || (!_this.KIVQModule.canSkip && nextQuePoint.isAnswerd)){
nextBtn.attr({'href':'#','tabindex': 8}).removeClass('disabled')
.on('keydown', _this.keyDownHandler)
.on('click',function (e) {
e.preventDefault();
_this.KIVQModule.continuePlay();
_this.seekToQuestionTime = nextQuePoint.startTime;
_this.KIVQModule.gotoScrubberPos(nextQuePoint.key);
_this.isSeekingIVQ = true;
mw.log("Quiz: gotoScrubberPos : " + nextQuePoint.key);
});
}
}
var navigation = $("<div/>").addClass('cp-navigation').append(prevBtn, separator, nextBtn );
$('.ftr-container').prepend( navigation);
}
},
addFooter: function (questionNr) {
var _this = this;
_this.addQuePointsNavigationButtons(questionNr);

if (_this.KIVQModule.quizSubmitted) {
$(".ftr-right").html(gM('mwe-quiz-next')).on('click', function () {
Expand Down

0 comments on commit cdbf659

Please sign in to comment.