mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-25 12:34:47 -04:00
Adds optional custom headers/footers that are propageted to all subfolders.
This commit is contained in:
parent
8a2451474a
commit
289ce2993c
4 changed files with 55 additions and 18 deletions
|
@ -2,25 +2,30 @@
|
|||
modulejs.define('ext/custom', ['_', '$', 'core/settings', 'core/server', 'core/event'], function (_, $, allsettings, server, event) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false,
|
||||
header: '_h5ai.header.html',
|
||||
footer: '_h5ai.footer.html'
|
||||
enabled: false
|
||||
}, allsettings.custom),
|
||||
|
||||
onLocationChanged = function () {
|
||||
|
||||
$('#content-header, #content-footer').stop(true, true).slideUp(200);
|
||||
|
||||
server.request({action: 'get', custom: true}, function (response) {
|
||||
|
||||
var h, f;
|
||||
if (response) {
|
||||
if (response.custom.header) {
|
||||
$('#content-header').html(response.custom.header).stop(true, true).slideDown(400);
|
||||
$('#content-header').html(response.custom.header).stop().slideDown(200);
|
||||
h = true;
|
||||
}
|
||||
if (response.custom.footer) {
|
||||
$('#content-footer').html(response.custom.footer).stop(true, true).slideDown(400);
|
||||
$('#content-footer').html(response.custom.footer).stop().slideDown(200);
|
||||
f = true;
|
||||
}
|
||||
}
|
||||
if (!h) {
|
||||
$('#content-header').stop().slideUp(200);
|
||||
}
|
||||
if (!f) {
|
||||
$('#content-footer').stop().slideUp(200);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue