Picture of Ludovic Bas
rooter not working (bookmark)
by Ludovic Bas - Friday, 18 May 2018, 11:34 PM
 

Hello,

is there any particular reason the rooter stops working?

When I resume a course, the bookmark sets the rooter to the previous location as expected. But after that, the page scrolls to a random location and not to the expected location. So, I need to scroll myself to the last component.

 

EDIT: related to trickle (https://github.com/adaptlearning/adapt_framework/issues/2023 )

Picture of Ludovic Bas
Re: rooter not working (bookmark)
by Ludovic Bas - Wednesday, 23 May 2018, 2:11 PM
 

Anybody has the same issue with bookmarking and trickle?

Picture of Matt Leathes
Re: rooter not working (bookmark)
by Matt Leathes - Wednesday, 23 May 2018, 3:25 PM
 

It sounds to me like precisely the issue you linked to in your original post.

I don't know if anyone has a solution yet though

Picture of Ludovic Bas
Re: rooter not working (bookmark)
by Ludovic Bas - Friday, 25 May 2018, 7:39 AM
 

Did you managed to reproduce on your projects? I would like to know if it is always reproductible or not. In my case, all my projects using Bookmark and Trickle are affected.

Picture of Ludovic Bas
Re: rooter not working (bookmark)
by Ludovic Bas - Friday, 25 May 2018, 1:38 PM
 

I've added some logs in the code and this is what I get when I resume the course:

 

resize.js:40 [TRICKLE] OnStepLock
resize.js:61 [TRICKLE] onTrickleResize wrapper 1355
resize.js:40 [TRICKLE] OnStepLock
resize.js:61 [TRICKLE] onTrickleResize wrapper 2152
adapt-contrib-bookmarking.js:121 navigateToPrevious -> defer -> [Bookmark] Backbone.history.navigate());
resize.js:40 [TRICKLE] OnStepLock
resize.js:61 [TRICKLE] onTrickleResize wrapper 2921.2000122070312
resize.js:61 [TRICKLE] onTrickleResize wrapper 2921.2000122070312
resize.js:40 [TRICKLE] OnStepLock
resize.js:40 [TRICKLE] OnStepLock
resize.js:61 [TRICKLE] onTrickleResize wrapper 4381.862548828125
resize.js:40 [TRICKLE] OnStepLock
resize.js:61 [TRICKLE] onTrickleResize wrapper 4919.862548828125

 

I can confirm that my "random block" that showed up instead of my bookmarked location is when the wrapper is 2152 height. So I guess that the navigateToPrevious command is called to soon. It should wait trickle to finish resizing.

Picture of Ludovic Bas
Re: rooter not working (bookmark)
by Ludovic Bas - Friday, 25 May 2018, 2:58 PM
 

I tried to add a delay in the defer method here.

This workaround works but the delay should equals more or less the number of blocks multiplied by delta (approximatively 60ms in my tests) => so the delay can be 500ms or maybe 3s for big pages.

Is there any way to know how many blocks or components exist from the bookmark code so I can get a more accurate workaround?

Otherwise, the bookmark should wait trickle resizing when trickle is activated. Any clue to do that? Using events?

Picture of Matt Leathes
Re: rooter not working (bookmark)
by Matt Leathes - Friday, 25 May 2018, 4:07 PM
 

If you're using trickle v2.1.5 (or better) there is a 'trickle:done' event that you should be able to listen out for...

If you're stuck using an earlier version of trickle (v2.1.5 requires Adapt v2.2) then you can do something like this

scrollToAssessmentStart: function(assessmentArticleId) {
	// need to wait for trickle to finish unlocking the completed parts of the page before we can scrollTo
	var debouncedScrollTo = _.debounce(function() {
		Adapt.scrollTo('.' + assessmentArticleId);
		Adapt.off('trickle:steplock', debouncedScrollTo);
	}, 300);

	Adapt.on('trickle:steplock', debouncedScrollTo);
}

(That's from a project where the assessment was two-thirds of the way down a heavily trickled page and I need to get the 'retry assessment' button to send the user to the first assessment question when the assessment had reset - but should give you enough an idea of what you need to do)

I guess the problem you'll have is that you'll need to go to the page first to activate trickle, wait for it to unlock then scroll to the relevant part of the page.

Picture of Ludovic Bas
Re: rooter not working (bookmark)
by Ludovic Bas - Tuesday, 29 May 2018, 5:41 PM
 

thank you. I used trickle:done event in my trickle 2.1.3 version :)

It works. It takes some times. But it works.

Picture of K Edison
Re: rooter not working (bookmark)
by K Edison - Friday, 13 December 2019, 7:58 PM
 

Hi Matt,

I've used this code below which works great, do you know how I can incorporate a override of trickle with it?

Adapt.on('pageView:postRender', function(view) {

view.$el.on('click', 'a.link-b-20', function(e) { e.preventDefault(); Adapt.scrollTo('.b-15',{duration:500}); }); });

 

Thanks

Kelly

Picture of Matt Leathes
Re: rooter not working (bookmark)
by Matt Leathes - Monday, 16 December 2019, 10:39 AM
 

You can switch off trickle for the page by doing Adapt.trigger('trickle:kill');

Picture of Matt Leathes
Re: rooter not working (bookmark)
by Matt Leathes - Monday, 16 December 2019, 12:22 PM
 

There's also Adapt.trigger('trickle:finished'); but I'm not 100% sure of the difference between the two..! Apparently it's only meant to be used internally by trickle i.e. you should stick with trickle:kill

Picture of K Edison
Re: rooter not working (bookmark)
by K Edison - Monday, 16 December 2019, 3:22 PM
 

Worked! Great thanks :)

Picture of K Edison
Re: rooter not working (bookmark)
by K Edison - Monday, 16 December 2019, 6:58 PM
 

Do you know how I can turn trickle back on once I reach my block?

Thanks in advance.

Kelly

Picture of Matt Leathes
Re: rooter not working (bookmark)
by Matt Leathes - Monday, 16 December 2019, 7:32 PM
 

Good question! Simple answer is: no I don't, sorry.

Picture of Oliver Foster
Re: rooter not working (bookmark)
by Oliver Foster - Tuesday, 17 December 2019, 5:33 PM
 

You can't turn trickle back on once you've killed it without refreshing the page.

Trickle is a brutal device. It's either on/off or running according to its configuration.

There are no "start from this block" style functionalities.