mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-25 12:34:47 -04:00
Cleans code.
This commit is contained in:
parent
26d0de5985
commit
ede2316f53
2 changed files with 29 additions and 23 deletions
|
@ -198,7 +198,7 @@ options, types and langs
|
||||||
|
|
||||||
/* [all]
|
/* [all]
|
||||||
Adds Piwik tracker javascript code.
|
Adds Piwik tracker javascript code.
|
||||||
baseURL without protocol
|
"baseURL" without protocol
|
||||||
*/
|
*/
|
||||||
"piwik-analytics": {
|
"piwik-analytics": {
|
||||||
"enabled": false,
|
"enabled": false,
|
||||||
|
|
|
@ -25,8 +25,6 @@
|
||||||
globalConfigHref = $scriptTag.attr('src').replace(/scripts.js$/, '../config.json'),
|
globalConfigHref = $scriptTag.attr('src').replace(/scripts.js$/, '../config.json'),
|
||||||
localConfigHref = $scriptTag.data('config') || './_h5ai.config.json',
|
localConfigHref = $scriptTag.data('config') || './_h5ai.config.json',
|
||||||
|
|
||||||
ajaxOpts = {dataType: 'text'},
|
|
||||||
|
|
||||||
parse = function (response) {
|
parse = function (response) {
|
||||||
|
|
||||||
return response.replace ? JSON.parse(response.replace(/\/\*[\s\S]*?\*\/|\/\/.*?(\n|$)/g, '')) : {};
|
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) {
|
run = function (config) {
|
||||||
/*global amplify, Base64, jQuery, Modernizr, moment, _ */
|
/*global amplify, Base64, jQuery, Modernizr, moment, _ */
|
||||||
|
|
||||||
|
@ -57,27 +82,8 @@
|
||||||
|
|
||||||
modulejs.require($('body').attr('id'));
|
modulejs.require($('body').attr('id'));
|
||||||
});
|
});
|
||||||
},
|
|
||||||
|
|
||||||
config = {
|
|
||||||
options: {},
|
|
||||||
types: {},
|
|
||||||
langs: {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$.ajax(globalConfigHref, ajaxOpts).always(function (g) {
|
loadConfig(run);
|
||||||
|
|
||||||
extendLevel1(config, parse(g));
|
|
||||||
if (localConfigHref === 'ignore') {
|
|
||||||
run(config);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$.ajax(localConfigHref, ajaxOpts).always(function (l) {
|
|
||||||
|
|
||||||
extendLevel1(config, parse(l));
|
|
||||||
run(config);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
}(jQuery));
|
}(jQuery));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue