mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-29 06:25:18 -04:00
Makes custom headers/footers optional. Disabled by default.
This commit is contained in:
parent
20858a1f43
commit
cbdd185602
4 changed files with 30 additions and 20 deletions
|
@ -32,6 +32,7 @@ h5ai is provided under the terms of the [MIT License](http://github.com/lrsjng/h
|
||||||
|
|
||||||
* updates year in `LICENSE.TXT`
|
* updates year in `LICENSE.TXT`
|
||||||
* updates es translation
|
* updates es translation
|
||||||
|
* custom headers/footers are now optional and disabled by default
|
||||||
|
|
||||||
|
|
||||||
### v0.17 - *2011-11-28*
|
### v0.17 - *2011-11-28*
|
||||||
|
|
|
@ -18,10 +18,15 @@ var H5AI_CONFIG = {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Filenames of customized header and footer files to look for
|
* Filenames of customized header and footer files to look for
|
||||||
* in each folder.
|
* in each folder. For Example:
|
||||||
|
*
|
||||||
|
* "customHeader": "_h5ai.header.html",
|
||||||
|
* "customFooter": "_h5ai.footer.html",
|
||||||
|
*
|
||||||
|
* This is disabled by default.
|
||||||
*/
|
*/
|
||||||
"customHeader": "_h5ai.header.html",
|
"customHeader": false,
|
||||||
"customFooter": "_h5ai.footer.html",
|
"customFooter": false,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* An array of view modes the user may choose from. Currently there
|
* An array of view modes the user may choose from. Currently there
|
||||||
|
|
|
@ -52,21 +52,25 @@
|
||||||
},
|
},
|
||||||
customize = function () {
|
customize = function () {
|
||||||
|
|
||||||
$.ajax({
|
if (H5AI.core.settings.customHeader) {
|
||||||
url: H5AI.core.settings.customHeader,
|
$.ajax({
|
||||||
dataType: "html",
|
url: H5AI.core.settings.customHeader,
|
||||||
success: function (data) {
|
dataType: "html",
|
||||||
$("#content > header").append($(data)).show();
|
success: function (data) {
|
||||||
}
|
$("#content > header").append($(data)).show();
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$.ajax({
|
if (H5AI.core.settings.customFooter) {
|
||||||
url: H5AI.core.settings.customFooter,
|
$.ajax({
|
||||||
dataType: "html",
|
url: H5AI.core.settings.customFooter,
|
||||||
success: function (data) {
|
dataType: "html",
|
||||||
$("#content > footer").prepend($(data)).show();
|
success: function (data) {
|
||||||
}
|
$("#content > footer").prepend($(data)).show();
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
fetchPath = function (pathname, callback) {
|
fetchPath = function (pathname, callback) {
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ class Customize {
|
||||||
|
|
||||||
$absPath = $h5ai->getAbsPath();
|
$absPath = $h5ai->getAbsPath();
|
||||||
$options = $h5ai->getOptions();
|
$options = $h5ai->getOptions();
|
||||||
$this->customHeader = $absPath . "/" . $options["customHeader"];
|
$this->customHeader = $options["customHeader"] ? $absPath . "/" . $options["customHeader"] : false;
|
||||||
$this->customFooter = $absPath . "/" . $options["customFooter"];
|
$this->customFooter = $options["customFooter"] ? $absPath . "/" . $options["customFooter"] : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHeader() {
|
public function getHeader() {
|
||||||
|
@ -23,7 +23,7 @@ class Customize {
|
||||||
|
|
||||||
private function getContent($file, $tag) {
|
private function getContent($file, $tag) {
|
||||||
|
|
||||||
return file_exists($file) ? ("<" . $tag . ">" . file_get_contents($file) . "</" . $tag . ">") : "";
|
return (is_string($file) && file_exists($file)) ? ("<" . $tag . ">" . file_get_contents($file) . "</" . $tag . ">") : "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue