Another partial commit.

This commit is contained in:
Lars Jung 2012-10-07 13:48:27 +02:00
parent abb9b7bd0e
commit cb9341451b
15 changed files with 88 additions and 453 deletions

View file

@ -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');