mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-25 12:34:47 -04:00
Another partial commit.
This commit is contained in:
parent
abb9b7bd0e
commit
cb9341451b
15 changed files with 88 additions and 453 deletions
|
@ -1,5 +1,5 @@
|
|||
|
||||
modulejs.define('ext/custom', ['_', '$', 'core/settings', 'core/ajax'], function (_, $, allsettings, ajax) {
|
||||
modulejs.define('ext/custom', ['_', '$', 'core/settings'], function (_, $, allsettings) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false,
|
||||
|
@ -7,6 +7,23 @@ modulejs.define('ext/custom', ['_', '$', 'core/settings', 'core/ajax'], function
|
|||
footer: '_h5ai.footer.html'
|
||||
}, allsettings.custom),
|
||||
|
||||
getHtml = function (url, callback) {
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'POST',
|
||||
dataType: 'html',
|
||||
success: function (html) {
|
||||
|
||||
callback(html);
|
||||
},
|
||||
error: function () {
|
||||
|
||||
callback();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
init = function () {
|
||||
|
||||
if (!settings.enabled) {
|
||||
|
@ -14,7 +31,7 @@ modulejs.define('ext/custom', ['_', '$', 'core/settings', 'core/ajax'], function
|
|||
}
|
||||
|
||||
if (_.isString(settings.header)) {
|
||||
ajax.getHtml(settings.header, function (html) {
|
||||
getHtml(settings.header, function (html) {
|
||||
|
||||
if (html) {
|
||||
$('<div id="content-header">' + html + '</div>').prependTo('#content');
|
||||
|
@ -23,7 +40,7 @@ modulejs.define('ext/custom', ['_', '$', 'core/settings', 'core/ajax'], function
|
|||
}
|
||||
|
||||
if (_.isString(settings.footer)) {
|
||||
ajax.getHtml(settings.footer, function (html) {
|
||||
getHtml(settings.footer, function (html) {
|
||||
|
||||
if (html) {
|
||||
$('<div id="content-footer">' + html + '</div>').appendTo('#content');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue