diff --git a/mod/scorm/module.js b/mod/scorm/module.js index f0d65155a7e..f64902113a3 100644 --- a/mod/scorm/module.js +++ b/mod/scorm/module.js @@ -60,25 +60,16 @@ M.mod_scorm.init = function(Y, nav_display, navposition_left, navposition_top, h }; Y.TreeView.prototype.openAll = function () { - var tree = this; - Y.all('.yui3-treeview-can-have-children').each(function() { - var node = tree.getNodeById(this.get('id')); - node.open(); - }); + this.get('container').all('.yui3-treeview-can-have-children').each(function(target) { + this.getNodeById(target.get('id')).open(); + }, this); }; - // TODO: Remove next(), previous() prototype functions after YUI has been updated to 3.11.0 - MDL-41208. - Y.Tree.Node.prototype.next = function () { - if (this.parent) { - return this.parent.children[this.index() + 1]; - } - }; - - Y.Tree.Node.prototype.previous = function () { - if (this.parent) { - return this.parent.children[this.index() - 1]; - } - }; + Y.TreeView.prototype.closeAll = function () { + this.get('container').all('.yui3-treeview-can-have-children').each(function(target) { + this.getNodeById(target.get('id')).close(); + }, this); + } var scorm_parse_toc_tree = function(srcNode) { var SELECTORS = { @@ -141,6 +132,7 @@ M.mod_scorm.init = function(Y, nav_display, navposition_left, navposition_top, h scorm_current_node.select(); } + scorm_tree_node.closeAll(); // remove any reference to the old API if (window.API) { window.API = null; @@ -202,6 +194,7 @@ M.mod_scorm.init = function(Y, nav_display, navposition_left, navposition_top, h } scorm_fixnav(); } + scorm_tree_node.openAll(); }; mod_scorm_activate_item = scorm_activate_item;