mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-06-03 16:48:38 -04:00
Refactor js init sequence.
This commit is contained in:
parent
b1b5e37ab6
commit
5f2a7985d8
5 changed files with 34 additions and 33 deletions
30
src/_h5ai/client/js/inc/boot.js
Normal file
30
src/_h5ai/client/js/inc/boot.js
Normal file
|
@ -0,0 +1,30 @@
|
|||
modulejs.define('boot', ['$'], function ($) {
|
||||
|
||||
if ($('html').hasClass('no-browser')) {
|
||||
return;
|
||||
}
|
||||
|
||||
var module = $('script[data-module]').data('module');
|
||||
var data = {action: 'get', setup: true, options: true, types: true, theme: true, langs: true};
|
||||
var url;
|
||||
|
||||
if (module === 'index') {
|
||||
url = '.';
|
||||
} else if (module === 'info') {
|
||||
data.updatecmds = true;
|
||||
url = 'server/php/index.php';
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
data: data,
|
||||
type: 'POST',
|
||||
dataType: 'json'
|
||||
}).done(function (config) {
|
||||
|
||||
modulejs.define('config', config);
|
||||
$(function () { modulejs.require('main/' + module); });
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue