document.write( "" ); document.write( "" ); /* brb: New code for HTML5 brightcove video player. Processing of videos in DF takes place in the Figures.process_media method. So we need to rewrite it to use the new player markup and methods. */ Figures = Figures.extend({ sequence_cuepoint: [], // holds the cuepoint for each sequence bcVideo: {}, // holds all of the video players (by ID) bcPlayerData: { 'accountId': '1500315202001', 'playerId': 'B1AhVYg4l' }, process_media: function() { var context = this; // save off 'this' // Process each video $("[data-mmtype='mov']").each(function() { var $this = $(this); var $parent = $this.parent("[data-type='figure']"); var video_mmsrc = $this.attr("data-mmsrc"); var video_id = $parent.attr("data-figure-id"); // Replace the current figure HTML with the new HTML5 video HTML playerHTML = '
Check one or more options from the list.
", { "draggable" : false, "width" : 320, "buttons" : [ { text : 'OK', click : window.Standard_Dialog.close } ] } ); return; } // if we made it to here, we're at least going to show which items are correct and incorrect // we might overwrite with review mode below, but that's OK for ( var i = 0; i < question.queries.length; ++i ) { var query = question.queries[ i ]; query.jq.html( query.getHTML( "review_correct_incorrect" ) ); } // update question tries ++question.tries; // if answer is incorrect, and max_tries is set, and # of tries is less than max_tries // (and the user didn't just give up) if ( (!all_answers_correct && question.md.max_tries != null && question.tries < question.md.max_tries) && question.gave_up != true ) { // tell user he can try again t.show_question_feedback( question, false, true ); return; } else { t.show_question_feedback( question, all_answers_correct, false ); } // if we make it to here we need to set ARGA info for the question, and show queries in review mode // if md.question_report_text is set, we submit the question as a whole, rather than as individual queries var query_correct_answers = ""; var query_responses = ""; var query_responses_for_questionData = ""; var query_grade_sum = 0; // for each query in the question... for ( var i = 0; i < question.queries.length; ++i ) { var query = question.queries[ i ]; // establish a question number to use var query_number = t.get_query_number( question, i ); // get a query weight var query_weight = question.get_weight(); // if the question has more than one query, divide weight accordingly if ( question.queries.length > 1 ) { query_weight = Math.round( query_weight / question.queries.length ); } // if credit_after_max_tries is set, give at least that credit now, as long as the student tried if ( question.md.credit_after_max_tries != null ) { var query_grade = query.getGradeForARGA(); if ( query_grade >= 0 && query_grade < question.md.credit_after_max_tries ) { query.overrideGrade( question.md.credit_after_max_tries * 1 ); } } // set the ARGA response, unless we're saving one response for the whole question if ( !question.md_set( "question_report_text" ) ) { t.ARGA_set_query_response( query, query_number, query_weight ); // otherwise compose query roll-ups } else { if ( query_correct_answers != "" ) { query_correct_answers += " / "; query_responses += " / "; query_responses_for_questionData += t.query_responses_separator; } query_correct_answers += query.getCorrectAnswerForARGA(); query_responses += query.getUserAnswerForARGA(); // see restore_saved_answers for how this is used later query_responses_for_questionData += query.getUserAnswerForARGA() + t.query_responses_grade_separator + query.getOriginalGrade(); query_grade_sum += query.getGradeForARGA() * 1; } // show in review mode, unless question metadata says not to show correct answers if ( question.md.show_correct_answers != "false" ) { query.jq.html( query.getHTML( "review" ) ); } } // if we're saving one response for the whole question, save here if ( question.md_set( "question_report_text" ) ) { var question_grade = Math.round( query_grade_sum / question.queries.length ); t.ARGA_set_question_response( question, query_correct_answers, query_responses, question_grade, query_responses_for_questionData ); } // grade the activity t.grade_activity(); // then if ARGA is running, submit data; show_grade_saved_message will be called on completion. if ( player.ARGA_running ) { t.ARGA_submit_data(); } // update the question_action_div t.update_question_action_div( question_index ); // if the item is in a sequence, show the next question t.show_next_question( question ); // update section status player.update_section_status(); // re-call mathjax conversion here MathJax.Hub.Queue( [ "Typeset", MathJax.Hub ] ); if ( typeof question_index == "object" ) { // extract the question_index from the object question_index = question_index.data.question_index; } player.activity.questions[ question_index ].checkModelUpdateConditionals( question_index ); // re-call mathjax conversion here MathJax.Hub.Queue( [ "Typeset", MathJax.Hub ] ); //safe_log("submit_question: all_questions_answered = " + player.get_current_section().all_questions_answered); if ( (player.get_current_section().all_questions_answered == true) && player.get_current_section().index < player.sections.length ) { //safe_log("submit_question: showing next button"); $( "#next_button" ).show(); } if ( (player.get_current_section().all_questions_answered == true) && (player.get_current_section().index == player.sections.length - 1) ) { //safe_log("submit_question: hide next button"); $( "#next_button" ).hide(); player.show_completion_message(); } } } ); var Player_manuscript_type = Player.extend( { model : {}, INIT_LASX: 0, doSectionUpdateConditionals : function( s ) { for ( var i = 0; i < s.md.model_update_conditional.length; ++i ) { var c = s.md.model_update_conditional[ i ]; var condition = c.condition; condition = condition.replace( /model/g, "player.model" ); var updateStatement = c.updateStatement.replace( /setModel/g, "player.setModel" ); updateStatement = updateStatement.replace( /\smodel/g, "player.model" ); updateStatement = unescape( updateStatement ); condition = unescape( condition ); condition = condition.replace( /&/g, '&' ); if ( condition == "else" || eval( condition ) == true ) { // if section_to_show is "done", we're done! //safe_log( "triggering model update from section" ); eval( updateStatement ); } } }, get_LASX: function() { var las = Get_ARGA_Data("LASX"); if (las === null || las === undefined || las === "" || !/\d/.test(las)) { return 1; } return Number(las); }, update_section_status: function() { //safe_log("update_section_status"); //safe_log("section_currently_showing = " + this.section_currently_showing); //safe_log("last_available_section = " + this.last_available_section); if (this.section_currently_showing != null && this.last_available_section <= this.section_currently_showing) { var s = this.get_current_section(); s.all_questions_answered = true; // if the current section has any questions, see if they've all been answered var qs_to_check = []; s.jq.find("[data-type=question]").each(function(index, element) { var q_index = $(element).attr("data-question_index"); var question = player.activity.questions[q_index]; s.all_questions_answered = s.all_questions_answered && question.is_complete(); if (question.question_sequence != null) { for (var i = 0; i < qs_to_check.length; ++i) { if (qs_to_check[i] == question.question_sequence) break; } if (i == qs_to_check.length) { qs_to_check.push(question.question_sequence); } } }); // now check question sequences to make sure they're done too s.all_question_sequences_completed = true; for (var i = 0; i < qs_to_check.length; ++i) { s.all_question_sequences_completed = s.all_question_sequences_completed && (qs_to_check[i].sequence_complete == "complete"); } // brb: Note: the following if statement is true if there are NO // questions on the page if (s.all_questions_answered && s.all_question_sequences_completed) { var $curr_sec = $("#digfir_section_" + this.section_currently_showing); // brb: always increment if there are questions on the page if ($curr_sec.find("[data-type='question']").length > 0) { //safe_log("incrementing last_available_section"); this.last_available_section = this.section_currently_showing + 1; } // brb: if there are no questions on the page (we may need // to expand this to look for other interactive elements) else { // brb: only increment if there are no