mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-06-02 16:19:48 -04:00
Add markdown support for custom headers and footers.
This commit is contained in:
parent
f0721afb88
commit
b6cf568e31
7 changed files with 132 additions and 36 deletions
|
@ -1,5 +1,5 @@
|
|||
|
||||
modulejs.define('ext/custom', ['_', '$', 'core/settings', 'core/server', 'core/event'], function (_, $, allsettings, server, event) {
|
||||
modulejs.define('ext/custom', ['_', '$', 'core/settings', 'core/server', 'core/event', 'core/resource'], function (_, $, allsettings, server, event, resource) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false
|
||||
|
@ -10,16 +10,38 @@ modulejs.define('ext/custom', ['_', '$', 'core/settings', 'core/server', 'core/e
|
|||
server.request({action: 'get', custom: true, customHref: item.absHref}, function (response) {
|
||||
|
||||
var h, f;
|
||||
|
||||
if (response) {
|
||||
|
||||
if (response.custom.header) {
|
||||
$('#content-header').html(response.custom.header).stop().slideDown(200);
|
||||
if (response.custom.header_type === 'md') {
|
||||
resource.loadMarkdown(function (md) {
|
||||
|
||||
if (md) {
|
||||
$('#content-header').html(md.toHTML(response.custom.header)).stop().slideDown(200);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$('#content-header').html(response.custom.header).stop().slideDown(200);
|
||||
}
|
||||
h = true;
|
||||
}
|
||||
|
||||
if (response.custom.footer) {
|
||||
$('#content-footer').html(response.custom.footer).stop().slideDown(200);
|
||||
if (response.custom.footer_type === 'md') {
|
||||
resource.loadMarkdown(function (md) {
|
||||
|
||||
if (md) {
|
||||
$('#content-footer').html(md.toHTML(response.custom.footer)).stop().slideDown(200);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$('#content-footer').html(response.custom.footer).stop().slideDown(200);
|
||||
}
|
||||
f = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!h) {
|
||||
$('#content-header').stop().slideUp(200);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue