1 |
efrain |
1 |
// This file is part of Moodle - http://moodle.org/
|
|
|
2 |
//
|
|
|
3 |
// Moodle is free software: you can redistribute it and/or modify
|
|
|
4 |
// it under the terms of the GNU General Public License as published by
|
|
|
5 |
// the Free Software Foundation, either version 3 of the License, or
|
|
|
6 |
// (at your option) any later version.
|
|
|
7 |
//
|
|
|
8 |
// Moodle is distributed in the hope that it will be useful,
|
|
|
9 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
10 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
11 |
// GNU General Public License for more details.
|
|
|
12 |
//
|
|
|
13 |
// You should have received a copy of the GNU General Public License
|
|
|
14 |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
15 |
|
|
|
16 |
// A module name should be composed of:
|
|
|
17 |
// moodle-<component>-<module>[-<submodule>][-skin]
|
|
|
18 |
var parts = me.name.replace(/^moodle-/,'').split('-'),
|
|
|
19 |
component = parts.shift(),
|
|
|
20 |
module = parts[0],
|
|
|
21 |
min = '-min';
|
|
|
22 |
|
|
|
23 |
if (/-(skin|core)$/.test(me.name)) {
|
|
|
24 |
// For these types, we need to remove the final word and set the type.
|
|
|
25 |
parts.pop();
|
|
|
26 |
me.type = 'css';
|
|
|
27 |
|
|
|
28 |
// CSS is not minified - clear the min option.
|
|
|
29 |
min = '';
|
|
|
30 |
}
|
|
|
31 |
|
|
|
32 |
if (module) {
|
|
|
33 |
// Determine the filename based on the remaining parts.
|
|
|
34 |
var filename = parts.join('-');
|
|
|
35 |
|
|
|
36 |
// Build the first part of the filename.
|
|
|
37 |
me.path = component + '/' + module + '/' + filename + min + '.' + me.type;
|
|
|
38 |
} else {
|
|
|
39 |
// This is a hangup from the old ways of writing Modules.
|
|
|
40 |
// We will start to warn about this once we have removed all core components of this form.
|
|
|
41 |
me.path = component + '/' + component + '.' + me.type;
|
|
|
42 |
}
|