Cleans config to pure json.

This commit is contained in:
Lars Jung 2012-09-17 22:37:20 +02:00
parent 0e05e6d0a1
commit b649cd1519
6 changed files with 30 additions and 31 deletions

View file

@ -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));