Change when course format javascript loads

Change when course format javascript loads

by Kimber Warden -
Number of replies: 3

I'm using collapsed topics as my course format. The course is graphic intensive and takes some time to fully load. The code that remembers which topics should be open or collapsed seems to be the last thing to load, resulting in the page unexpectedly jumping around several seconds after the user has entered the course. Is there a way I can make the course format code load earlier?

I'm using Moodle 2.2

Average of ratings: -
In reply to Kimber Warden

Re: Change when course format javascript loads

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Moved from Themes forum.

Hopefully Gareth can give you a better answer than I can.

Cheers

Mart

In reply to Kimber Warden

Re: Change when course format javascript loads

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Dear Kimber,

Given the way that I need to manipulate the page after it has finished loading and with Moodle JavaScript guidelines, there is no easy way of making the format's code load earlier.  However, I can conceive of adapting the code such that the PHP sets the state of the toggles when it is creating it as it can know the state of the toggles.  But, this is not a trivial task and may take me some time to accomplish, possibly a couple of hours, perhaps a couple of days depending on the issues encountered along the way.

The idea is a good one and I do consider it to be a desireable enhancement that would make the page load faster which is a good thing.  When I get time to do it is another question.

Kind regards,

Gareth