Merge branch 'MDL-64684-master' of git://github.com/andrewnicols/moodle

This commit is contained in:
Jun Pataleta 2019-02-11 11:40:26 +08:00
commit 91425ec00d
2 changed files with 14 additions and 5 deletions

View File

@ -1326,6 +1326,9 @@ class page_requirements_manager {
protected function get_amd_footercode() {
global $CFG;
$output = '';
// We will cache JS if cachejs is not set, or it is true.
$cachejs = !isset($CFG->cachejs) || $CFG->cachejs;
$jsrev = $this->get_jsrev();
$jsloader = new moodle_url('/lib/javascript.php');
@ -1341,15 +1344,21 @@ class page_requirements_manager {
$jsextension = '';
}
$minextension = '.min';
if (!$cachejs) {
$minextension = '';
}
$requirejsconfig = str_replace('[BASEURL]', $requirejsloader, $requirejsconfig);
$requirejsconfig = str_replace('[JSURL]', $jsloader, $requirejsconfig);
$requirejsconfig = str_replace('[JSMIN]', $minextension, $requirejsconfig);
$requirejsconfig = str_replace('[JSEXT]', $jsextension, $requirejsconfig);
$output .= html_writer::script($requirejsconfig);
if ($CFG->debugdeveloper) {
$output .= html_writer::script('', $this->js_fix_url('/lib/requirejs/require.js'));
} else {
if ($cachejs) {
$output .= html_writer::script('', $this->js_fix_url('/lib/requirejs/require.min.js'));
} else {
$output .= html_writer::script('', $this->js_fix_url('/lib/requirejs/require.js'));
}
// First include must be to a module with no dependencies, this prevents multiple requests.

View File

@ -6,8 +6,8 @@ var require = {
waitSeconds : 0,
paths: {
jquery: '[JSURL]lib/jquery/jquery-3.2.1.min[JSEXT]',
jqueryui: '[JSURL]lib/jquery/ui-1.12.1/jquery-ui.min[JSEXT]',
jquery: '[JSURL]lib/jquery/jquery-3.2.1[JSMIN][JSEXT]',
jqueryui: '[JSURL]lib/jquery/ui-1.12.1/jquery-ui[JSMIN][JSEXT]',
jqueryprivate: '[JSURL]lib/requirejs/jquery-private[JSEXT]'
},