var disableTouchZooming = function() { 'use strict'; var head = document.head || document.querySelector( 'head' ); var firstChild = head.firstChild; var meta = document.createElement( 'meta' ); meta.setAttribute( 'name', 'viewport' ); meta.setAttribute( 'content', 'initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width' ); if ( firstChild ) { head.insertBefore( meta, firstChild ); } else { head.appendChild( meta ); } }; Figures = Figures.extend({ process_media: function () { // we're not currently using this (jwplayer is not being included) $("[data-mmtype='mp3']").each(function (index, element) { var jq = $(element); var id = jq.attr("data-figure-id"); var mmsrc = jq.attr("data-mmsrc"); // http://www.longtailvideo.com/jw/upload/bunny.mp3 // http://www.youtube.com/embed/CsGYh8AacgY var src = jq.attr("src"); var attr = jq.attr("data-attr"); if (attr == null) attr = ""; attr = attr.split(/\s*,\s*/); var params = new Object(); params.width = jq.width(); params.height = jq.height() + 24; // 24 is for the controler at the bottom params.file = mmsrc; params.image = src; params.controlbar = "bottom"; params.screencolor = "ffffff"; params["viral.allowmenu"] = "false"; params["viral.onpause"] = "false"; params["viral.oncomplete"] = "false"; // determine url of flashplayer based on whether we're published or not if (UI_Elements.in_preview_mode()) { params.flashplayer = "/js/preview/player.swf"; } else { params.flashplayer = "js/player.swf"; } safe_log(params.flashplayer); for (var i = 0; i < attr.length; ++i) { var a = attr[i].split(/\s*=\s*/); params[a[0]] = a[1]; } jwplayer(id).setup(params); }); //AF: this is less than ideal, but i had to make this a global variable so it can be accessed by the video players when they fire the templateloaded event. // we should look into changing it. videos.templateReady = function (figureObjectID) { var vidplayer = brightcove.api.getExperience(figureObjectID); var experienceModule = vidplayer.getModule(brightcove.api.modules.APIModules.EXPERIENCE); var playerModule = vidplayer.getModule(brightcove.api.modules.APIModules.VIDEO_PLAYER); var questionSequence = $("#" + figureObjectID).closest('[data-type="figure"]').nextAll('[data-block_type="question_sequence"], [data-block_type="question_sequence_one_at_a_time"]'); questionSequence.each(function (index, element) { if ($(element).attr("data-block_type") == "figure") { if ($(element).find(".BrightcoveExperience").size() > 0) { //we have found another video following the current one, so stop return false; } } var questionSequenceIndex = $(element).attr("question_sequence_index"); var questionSequenceMetaData = $(element).find('[data-type="box_inner"]').children('[data-type="metadata"]').find('[key="cuepoint"]').html(); $(element).hide(); if (questionSequenceMetaData != null) { var cuePointsModule = vidplayer.getModule(brightcove.api.modules.APIModules.CUE_POINTS); var CuePointType = brightcove.api.modules.CuePointsModule.CuePointType; var cuePoints = [{ name: figureObjectID, metadata: questionSequenceIndex, time: questionSequenceMetaData, type: CuePointType.CODE }]; cuePointsModule.addCuePoints(videos[figureObjectID], cuePoints); videos.question_sequence_to_video_map[questionSequenceIndex] = figureObjectID; } }); playerModule.addEventListener(brightcove.api.events.CuePointEvent.CUE, videos.cuePointEvent); }; videos.cuePointEvent = function (e) { //get the player - the name property of the cuePoint is set to the ID of the Brightcove experience //so we can find the player here. var vidplayer = brightcove.api.getExperience(e.cuePoint.name); globalPlayer = brightcove.api.getExperience(e.cuePoint.name); safe_log("got vid player"); var playerModule = vidplayer.getModule(brightcove.api.modules.APIModules.VIDEO_PLAYER); safe_log("got module"); playerModule.pause(true); safe_log("paused"); player.show_question_sequence(e.cuePoint.metadata, false); }; } }); var Player_devtk = Player_manuscript_type.extend({ add_question: function(index, element) { var a = player.activity; // this fn gets called within the scope of a jquery each, so we can't refer to "this" var jq = $(element); // see if we're in a question_pool or question_sequence block var qs_parent = jq.parents("[data-block_type=question_sequence], [data-block_type=question_sequence_one_at_a_time]"); var q = a.questions[a.questions.length] = new Question({ "index": a.questions.length , "number": jQuery.trim($("[data-type='number']", jq).html()) , "title": jQuery.trim($("[data-type='title']", jq).html()) , "jq": jq , "points_possible": 0 }); // store the question index in the DOM too jq.attr("data-question_index", q.index); // get question queries a.question_being_initialized = q; $("[data-type='query']", jq).each(a.add_query); // if the question has queries, add bling to the bottom if (q.queries.length > 0) { var html = "
" + "Congratulations! You have completed this activity." + "
" + "" + "Total Score: " + player.activity.total_points_earned + " out of " + player.activity.total_points_possible + " points (" + player.activity.grade_percent + "%)
" + "