function onUnlocked() { if (Adapt.devtools.get('_unlocked')) { breakCoreLocking(); // reload the page/menu if (Adapt.location._currentId == Adapt.course.get('_id')) Router.handleRoute ? Router.handleRoute() : Router.handleCourse(); else Router.handleId(Adapt.location._currentId); } }
function enable() { removeHooks(); Adapt.devtools.set('_isEnabled', true); Adapt.trigger('devtools:enable'); // reload the menu/page if (Adapt.location._currentId == Adapt.course.get('_id')) Router.handleRoute ? Router.handleRoute() : Router.handleCourse(); else Router.handleId(Adapt.location._currentId); }
navigateAndDisableTrickleUpTo:function(id) { var model = Adapt.findById(id); var pageModel = Adapt.findById(Adapt.location._currentId); // first ensure page incomplete prompt won't activate this._disablePageIncompletePrompt(pageModel); // now navigate if (model._siblings == 'contentObjects') { Backbone.history.navigate("#/id/"+id, {trigger:true}); } else { var level = model.get('_type') == 'component' ? model.getParent() : model; var siblings = level.getParent().getChildren(), sibling = null; // disable trickle on all preceeding article(s)|block(s) for (var i=0, count=siblings.indexOf(level); i < count; i++) { sibling = siblings.at(i); console.log('disabling trickle on '+sibling.get('_id')); if (sibling.has('_trickle')) { sibling.get('_trickle')._isEnabled = false; } else { sibling.set('_trickle', {_isEnabled:false}); } } // check if already on page if (Adapt.location._currentId == model.findAncestor('contentObjects').get('_id')) { this.listenToOnce(Adapt, 'pageView:ready', function(view) { _.defer(_.bind(function() { Adapt.scrollTo($('.'+id)); this.checkVisibility(id); }, this)); }); if (Adapt.location._currentId == Adapt.course.get('_id')) Router.handleRoute ? Router.handleRoute() : Router.handleCourse(); else Router.handleId(Adapt.location._currentId); } else { this.listenToOnce(Adapt, 'pageView:ready', function() { _.defer(_.bind(function() { this.checkVisibility(id); }, this)); }); Backbone.history.navigate("#/id/"+id, {trigger:true}); } } // restore pageIncompletePrompt config this._restorePageIncompletePrompt(pageModel); this.invalidate(); },