mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-03-19 12:00:01 +01:00
Cleans code.
This commit is contained in:
parent
26d0de5985
commit
ede2316f53
@ -198,7 +198,7 @@ options, types and langs
|
||||
|
||||
/* [all]
|
||||
Adds Piwik tracker javascript code.
|
||||
baseURL without protocol
|
||||
"baseURL" without protocol
|
||||
*/
|
||||
"piwik-analytics": {
|
||||
"enabled": false,
|
||||
|
@ -25,8 +25,6 @@
|
||||
globalConfigHref = $scriptTag.attr('src').replace(/scripts.js$/, '../config.json'),
|
||||
localConfigHref = $scriptTag.data('config') || './_h5ai.config.json',
|
||||
|
||||
ajaxOpts = {dataType: 'text'},
|
||||
|
||||
parse = function (response) {
|
||||
|
||||
return response.replace ? JSON.parse(response.replace(/\/\*[\s\S]*?\*\/|\/\/.*?(\n|$)/g, '')) : {};
|
||||
@ -40,6 +38,33 @@
|
||||
});
|
||||
},
|
||||
|
||||
loadConfig = function (callback) {
|
||||
|
||||
var ajaxOpts = {
|
||||
dataType: 'text'
|
||||
},
|
||||
config = {
|
||||
options: {},
|
||||
types: {},
|
||||
langs: {}
|
||||
};
|
||||
|
||||
$.ajax(globalConfigHref, ajaxOpts).always(function (g) {
|
||||
|
||||
extendLevel1(config, parse(g));
|
||||
if (localConfigHref === 'ignore') {
|
||||
callback(config);
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax(localConfigHref, ajaxOpts).always(function (l) {
|
||||
|
||||
extendLevel1(config, parse(l));
|
||||
callback(config);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
run = function (config) {
|
||||
/*global amplify, Base64, jQuery, Modernizr, moment, _ */
|
||||
|
||||
@ -57,27 +82,8 @@
|
||||
|
||||
modulejs.require($('body').attr('id'));
|
||||
});
|
||||
},
|
||||
|
||||
config = {
|
||||
options: {},
|
||||
types: {},
|
||||
langs: {}
|
||||
};
|
||||
|
||||
$.ajax(globalConfigHref, ajaxOpts).always(function (g) {
|
||||
|
||||
extendLevel1(config, parse(g));
|
||||
if (localConfigHref === 'ignore') {
|
||||
run(config);
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax(localConfigHref, ajaxOpts).always(function (l) {
|
||||
|
||||
extendLevel1(config, parse(l));
|
||||
run(config);
|
||||
});
|
||||
});
|
||||
loadConfig(run);
|
||||
|
||||
}(jQuery));
|
||||
|
Loading…
x
Reference in New Issue
Block a user