mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-27 13:34:30 -04:00
Cleans config to pure json.
This commit is contained in:
parent
0e05e6d0a1
commit
b649cd1519
6 changed files with 30 additions and 31 deletions
|
@ -21,20 +21,28 @@
|
|||
|
||||
// @include "inc/**/*.js"
|
||||
|
||||
$(function () {
|
||||
/*global H5AI_CONFIG, amplify, Base64, jQuery, Modernizr, moment, _ */
|
||||
$.ajax({
|
||||
url: $('script[src$="/js/scripts.js"]').attr('src').replace(/\/js\/scripts.js$/, '/config.json'),
|
||||
complete: function (data) {
|
||||
|
||||
// `jQuery`, `moment` and `underscore` are itself functions,
|
||||
// so they have to be wrapped to not be handled as constructors.
|
||||
modulejs.define('config', H5AI_CONFIG);
|
||||
modulejs.define('amplify', amplify);
|
||||
modulejs.define('base64', Base64);
|
||||
modulejs.define('$', function () { return jQuery; });
|
||||
modulejs.define('modernizr', Modernizr);
|
||||
modulejs.define('moment', function () { return moment; });
|
||||
modulejs.define('_', function () { return _; });
|
||||
var config = JSON.parse(data.responseText.replace(/\/\*[\s\S]*?\*\/|\/\/.*?(\n|$)/g, ''));
|
||||
|
||||
modulejs.require($('body').attr('id'));
|
||||
});
|
||||
$(function () {
|
||||
/*global amplify, Base64, jQuery, Modernizr, moment, _ */
|
||||
|
||||
// `jQuery`, `moment` and `underscore` are itself functions,
|
||||
// so they have to be wrapped to not be handled as constructors.
|
||||
modulejs.define('config', config);
|
||||
modulejs.define('amplify', amplify);
|
||||
modulejs.define('base64', Base64);
|
||||
modulejs.define('$', function () { return jQuery; });
|
||||
modulejs.define('modernizr', Modernizr);
|
||||
modulejs.define('moment', function () { return moment; });
|
||||
modulejs.define('_', function () { return _; });
|
||||
|
||||
modulejs.require($('body').attr('id'));
|
||||
});
|
||||
}}
|
||||
);
|
||||
|
||||
}(jQuery));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue