Upgrade JS scripts to make compatible with Moodle 2.4.*