mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-25 12:34:47 -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) {
|
var setCheckResult = function (id, result) {
|
||||||
|
|
||||||
|
@ -14,12 +14,12 @@ modulejs.define('h5ai-info', ['$', 'core/server'], function ($, server) {
|
||||||
|
|
||||||
init = function () {
|
init = function () {
|
||||||
|
|
||||||
server.request({action: 'get', checks: true}, function (json) {
|
$.getJSON('server/php/index.php', {action: 'get', checks: true}, function (json) {
|
||||||
|
|
||||||
if (json) {
|
if (json) {
|
||||||
$('.test').each(function () {
|
$('.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');
|
event.pub('beforeView');
|
||||||
|
|
|
@ -24,8 +24,7 @@
|
||||||
var filename = 'client/js/scripts.js',
|
var filename = 'client/js/scripts.js',
|
||||||
$scriptTag = $('script[src$="' + filename + '"]'),
|
$scriptTag = $('script[src$="' + filename + '"]'),
|
||||||
src = $scriptTag.attr('src'),
|
src = $scriptTag.attr('src'),
|
||||||
main = $scriptTag.data('main'),
|
mode = $scriptTag.data('mode'),
|
||||||
backend = $scriptTag.data('backend'),
|
|
||||||
|
|
||||||
appHref = src.substr(0, src.length - filename.length),
|
appHref = src.substr(0, src.length - filename.length),
|
||||||
|
|
||||||
|
@ -41,11 +40,16 @@
|
||||||
modulejs.define('moment', function () { return moment; });
|
modulejs.define('moment', function () { return moment; });
|
||||||
modulejs.define('_', function () { return _; });
|
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('.', {
|
$.getJSON('.', {
|
||||||
action: 'get',
|
action: 'get',
|
||||||
|
@ -55,7 +59,7 @@
|
||||||
server: true
|
server: true
|
||||||
}, run);
|
}, run);
|
||||||
|
|
||||||
} else if (backend === 'aai') {
|
} else if (mode === 'aai') {
|
||||||
|
|
||||||
var loadJson = function (href) {
|
var loadJson = function (href) {
|
||||||
|
|
||||||
|
@ -81,7 +85,7 @@
|
||||||
types: types,
|
types: types,
|
||||||
langs: langs,
|
langs: langs,
|
||||||
server: {
|
server: {
|
||||||
backend: backend,
|
backend: mode,
|
||||||
api: false,
|
api: false,
|
||||||
name: 'apache',
|
name: 'apache',
|
||||||
version: null
|
version: null
|
||||||
|
|
|
@ -15,7 +15,7 @@ html.no-js( lang="en" )
|
||||||
link( rel="apple-touch-icon", type="image/png", href="client/images/app-48x48.png" )
|
link( rel="apple-touch-icon", type="image/png", href="client/images/app-48x48.png" )
|
||||||
link( rel="stylesheet", href="//fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic,700italic|Ubuntu:400,700,400italic,700italic" )
|
link( rel="stylesheet", href="//fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic,700italic|Ubuntu:400,700,400italic,700italic" )
|
||||||
link( rel="stylesheet", href="client/css/styles.css" )
|
link( rel="stylesheet", href="client/css/styles.css" )
|
||||||
script( src="client/js/scripts.js", data-main="h5ai-info", data-backend="php" )
|
script( src="client/js/scripts.js", data-mode="info" )
|
||||||
|
|
||||||
body#h5ai-info
|
body#h5ai-info
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ head
|
||||||
link( rel="apple-touch-icon", type="image/png", href="#{href}client/images/app-48x48.png" )
|
link( rel="apple-touch-icon", type="image/png", href="#{href}client/images/app-48x48.png" )
|
||||||
link( rel="stylesheet", href="//fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic,700italic|Ubuntu:400,700,400italic,700italic" )
|
link( rel="stylesheet", href="//fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic,700italic|Ubuntu:400,700,400italic,700italic" )
|
||||||
link( rel="stylesheet", href="#{href}client/css/styles.css" )
|
link( rel="stylesheet", href="#{href}client/css/styles.css" )
|
||||||
script( src="#{href}client/js/scripts.js", data-main="h5ai-main", data-backend="aai" )
|
script( src="#{href}client/js/scripts.js", data-mode="aai" )
|
||||||
|
|
||||||
|<body id="h5ai-main">
|
|<body id="h5ai-main">
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ html.no-js( lang="en" )
|
||||||
link( rel="apple-touch-icon", type="image/png", href!="#{href}client/images/app-48x48.png" )
|
link( rel="apple-touch-icon", type="image/png", href!="#{href}client/images/app-48x48.png" )
|
||||||
link( rel="stylesheet", href="//fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic,700italic|Ubuntu:400,700,400italic,700italic" )
|
link( rel="stylesheet", href="//fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic,700italic|Ubuntu:400,700,400italic,700italic" )
|
||||||
link( rel="stylesheet", href!="#{href}client/css/styles.css" )
|
link( rel="stylesheet", href!="#{href}client/css/styles.css" )
|
||||||
script( src!="#{href}client/js/scripts.js", data-main="h5ai-main", data-backend="php" )
|
script( src!="#{href}client/js/scripts.js", data-mode="php" )
|
||||||
|
|
||||||
body#h5ai-main
|
body#h5ai-main
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue