var Activity_subtype = Activity_manuscript.extend({ initialize: function() { this._super(); } }); var Player_subtype = Player_manuscript.extend({ tab_block_types: { exclude: ["subtab", "tab_slide"] }, // have to overwrite and simplify show_section here compared to player.js, // to use jquery ui's standard tab functions. show_section: function(section_to_show) { if (section_to_show == "previous") { section_to_show = this.section_currently_showing*1 - 1; } else if (section_to_show == "next") { section_to_show = this.section_currently_showing*1 + 1; } if (section_to_show == null || isNaN(section_to_show) || section_to_show < 0 || section_to_show >= this.sections.length) { return; } $(".subtab").removeClass("selected"); var s = this.sections[section_to_show]; if (s.is_tab) { // callling jquery ui's tabs() here will call tab_selected below, // which will take care of calling update_section_status and updating // the navigation (in this case, showing the right tab). player.tab_jq.tabs( "select" , s.tab_index ); // but for some reason tab_selected isn't running properly when we first start, // so make sure player.section_currently_showing got updated if (player.section_currently_showing != section_to_show) { player.section_currently_showing = section_to_show; // and call update_section_status in this case too player.update_section_status(); } } else { if (s.subtab_link_index != null) { $("#subtab_link_" + s.subtab_link_index).addClass("selected"); } // if user has to view sections in sequence and hasn't gotten up to this one, don't allow it if (player.md.sequenced_sections == "true" && section_to_show > player.last_available_section) { // but let instructors through if (player.activity.is_instructor()) { Standard_Dialog.alert("Please note: Students need to read and complete each section of the activity before moving on to the next section. Instructors, however, can skip around between sections as they choose."); } else { Standard_Dialog.alert(this.md.section_sequence_message); return; } } // add slide number if necessary if (s.slide_holder_tab != null && s.slide_holder_tab.slide_count > 1) { var t = s.jq.find("h2").find("[data-type=title]"); t.find(".slide_index").remove(); var html = "
"; t.prepend(html); } // show proper tab $('.ui-tabs-selected').removeClass('ui-tabs-selected'); $('.ui-state-active').removeClass('ui-state-active'); $('#tab_li_' + s.tab_index).addClass('ui-tabs-selected').addClass('ui-state-active'); if (player.section_currently_showing != null && player.section_currently_showing != section_to_show) { player.get_current_section_jq().hide(); } this.section_currently_showing = section_to_show; this.get_current_section_jq().show(); this.update_section_status(); this.update_navigation(); window.scrollTo(0,0); } // process iframes for the section, unless all were preloaded if (player.md.preload_all_iframes != "true") { this.figures.process_iframes(this.get_current_section().jq); // iframes } }, tab_selected: function(event, ui) { // we don't actually use event; // it's just there because it's part of the standard jquery ui fn prototype // make sure subtab is deselected $(".subtab").removeClass("selected"); var section_to_show = 1*$(ui.tab).attr('data-section_index'); // if user has to view sections in sequence and hasn't gotten up to this one, don't allow it if (player.md.sequenced_sections == "true" && section_to_show > player.last_available_section) { // but let instructors through if (player.activity.is_instructor()) { Standard_Dialog.alert("Please note: Students need to read and complete each section of the activity before moving on to the next section. Instructors, however, can skip around between sections as they choose."); } else { Standard_Dialog.alert(this.md.section_sequence_message); return; } } // make sure the current section is hidden if (player.section_currently_showing != null && player.section_currently_showing != section_to_show) { player.get_current_section_jq().hide(); } player.section_currently_showing = section_to_show; // process iframes for the section, unless all were preloaded if (player.md.preload_all_iframes != "true") { player.figures.process_iframes(player.get_current_section().jq); // iframes } player.update_section_status(); player.update_navigation(); window.scrollTo(0,0); }, show_navigation: function() { // this._super(); return; var html = "