$("[data-mmtype='mov']").each(function() {
safe_log("mov: " + $(this).attr("data-autoplay"));
$(this).attr("data-autoplay", "false");
});
// Create overlay on first page
$( document ).ready( function() {
'use strict';
$( 'head' ).append( $( "" ) );
} );
var Activity_clinch = window.Activity_manuscript_type.extend( {
update_question_action_div : function( question_index ) {
'use strict';
this._super( question_index );
// Show feedback block after click submit
var question = this.questions[ question_index ];
question.jq.find( '[data-block_type=feedback_block]' ).show();
question.jq.find( '[data-type=termref]' ).each( function( index, element ) {
// It is placed here because it should work for queries
var $element = $( element );
$element.unbind();
$element.click( function() { window.player.glossary.show_definition( this ); } );
} );
},
show_question_feedback : function( question, is_correct, try_again ) {
'use strict';
// Remove prior feedback if there
$( "#question_feedback_" + question.index ).remove();
// If we don't have any feedback at all, return
if ( question.md.feedback === null && question.md.feedback_correct === null && question.md.feedback_incorrect === null && question.md.feedback_hint === null ) {
return;
}
var hint_fdb = $( question.jq ).find( '.query_mc_feedback_correct_incorrect' );
var hint_fdb_text = $( hint_fdb ).text();
$( hint_fdb ).html( '' );
var html = "
" +
"
" + this.feedbackTitle + "
";
// Include general feedback if there
if ( question.md.feedback ) {
html += "
" + question.md.feedback + "
";
}
// Include correct feedback if there and the answer is correct
if ( is_correct && question.md.feedback_correct ) {
if ( hint_fdb_text ) {
html += "
" + hint_fdb_text + "
";
}
else {
html += "
" + question.md.feedback_correct + "
";
}
}
// Include incorrect or hint feedback if there and the answer is incorrect
if ( !is_correct && question.md.feedback_incorrect ) {
if ( hint_fdb_text && try_again ) {
html += "
'; // Toolbar
$chapter.prepend( html );
// Button at the bottom of the manuscript to go on to the previous and to the next step
html = '';
$chapter.append( html );
}
// Activate all other buttons
window.UI_Elements.activate_buttons();
},
show_toc : function() {
'use strict';
$( "#toc_dialog" ).remove();
var html = "";
for ( var i = 0; i < this.sections.length; ++i ) {
var s = this.sections[ i ];
var extra_style = "";
if ( this.md.sequenced_sections === "true" && i > this.last_available_section ) {
extra_style = "toc_section_not_available";
}
html += "
" + (i + 1) + ". " + s.title + "
";
}
html = "
Click on a slide to view it. Note: Grey slides are not accessible until preceding slides have been viewed or completed.
" + html;
html = "
" + html + "
";
$( "body" ).append( html );
$( "#toc_dialog" ).dialog( {
title : "Table of Contents", width : 450, modal : true, draggable : false, resizable : false, buttons : [
{ text : "OK", click : function() { $( "#toc_dialog" ).dialog( "close" ); } }
]
} );
}
} );
var Essay_Query = Essay_Query.extend( {
getHTML : function( mode ) {
'use strict';
// Start with the query text, if there
var html = this.query_text_html();
var val, disabled;
if ( ( !this.user_answer && !this.answer_was_just_entered ) || mode === 'preview' ) {
val = '';
disabled = '';
// Otherwise we have an answer, so fill it in
}
else {
// Make sure we convert double quotes to " for placement in 'value="xxx"' attributes
val = this.user_answer;
// Convert breaks to newlines
val = val.replace( / /g, '\n' );
// Also disable the input if we're not in review_correct_incorrect mode
if ( mode !== 'review_correct_incorrect' ) {
disabled = 'disabled';
}
}
html += "";
return html;
},
userHasAnswered : function() {
'use strict';
return ( this.user_answer || this.md.accept_blank_answers );
},
getPointsPossible : function() {
var points = this.md.accept_blank_answers ? 0 : 1 * this.points_possible;
return points;
}
} );
var MC_Query = MC_Query.extend( {
evaluateAnswer : function() {
'use strict';
if ( $( 'input:radio[name=query_answer_' + this.query_index + ']:checked' ).val() !== undefined ) {
// Get the user's selected answer, which will be 0-based
this.user_answer_index = $( 'input:radio[name=query_answer_' + this.query_index + ']:checked' ).val() * 1;
// Set grade accordingly (if this.md.no_correct_answer is true, any answer is correct)
if ( this.user_answer_index === this.correct_answer_index || this.md.no_correct_answer === "true" ) {
this.setGrade( 100 );
}
else {
this.setGrade( 0 );
}
return true;
}
else {
window.Standard_Dialog.open( "