mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-06-06 17:51:15 -04:00
More changes to init procedure and API.
This commit is contained in:
parent
15dd200b28
commit
a087e96d69
6 changed files with 17 additions and 13 deletions
|
@ -1,5 +1,5 @@
|
|||
|
||||
modulejs.define('h5ai-info', ['$', 'core/server'], function ($, server) {
|
||||
modulejs.define('info', ['$'], function ($) {
|
||||
|
||||
var setCheckResult = function (id, result) {
|
||||
|
||||
|
@ -14,12 +14,12 @@ modulejs.define('h5ai-info', ['$', 'core/server'], function ($, server) {
|
|||
|
||||
init = function () {
|
||||
|
||||
server.request({action: 'get', checks: true}, function (json) {
|
||||
$.getJSON('server/php/index.php', {action: 'get', checks: true}, function (json) {
|
||||
|
||||
if (json) {
|
||||
$('.test').each(function () {
|
||||
|
||||
setCheckResult(this, json[$(this).data('id')]);
|
||||
setCheckResult(this, json.checks[$(this).data('id')]);
|
||||
});
|
||||
}
|
||||
});
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
modulejs.define('h5ai-main', ['_', 'core/event'], function (_, event) {
|
||||
modulejs.define('main', ['_', 'core/event'], function (_, event) {
|
||||
|
||||
event.pub('beforeView');
|
||||
|
|
@ -24,8 +24,7 @@
|
|||
var filename = 'client/js/scripts.js',
|
||||
$scriptTag = $('script[src$="' + filename + '"]'),
|
||||
src = $scriptTag.attr('src'),
|
||||
main = $scriptTag.data('main'),
|
||||
backend = $scriptTag.data('backend'),
|
||||
mode = $scriptTag.data('mode'),
|
||||
|
||||
appHref = src.substr(0, src.length - filename.length),
|
||||
|
||||
|
@ -41,11 +40,16 @@
|
|||
modulejs.define('moment', function () { return moment; });
|
||||
modulejs.define('_', function () { return _; });
|
||||
|
||||
$(function () { modulejs.require(main); });
|
||||
$(function () { modulejs.require('main'); });
|
||||
};
|
||||
|
||||
|
||||
if (backend === 'php') {
|
||||
if (mode === 'info') {
|
||||
|
||||
modulejs.define('$', function () { return jQuery; });
|
||||
$(function () { modulejs.require('info'); });
|
||||
|
||||
} else if (mode === 'php') {
|
||||
|
||||
$.getJSON('.', {
|
||||
action: 'get',
|
||||
|
@ -55,7 +59,7 @@
|
|||
server: true
|
||||
}, run);
|
||||
|
||||
} else if (backend === 'aai') {
|
||||
} else if (mode === 'aai') {
|
||||
|
||||
var loadJson = function (href) {
|
||||
|
||||
|
@ -81,7 +85,7 @@
|
|||
types: types,
|
||||
langs: langs,
|
||||
server: {
|
||||
backend: backend,
|
||||
backend: mode,
|
||||
api: false,
|
||||
name: 'apache',
|
||||
version: null
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue