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 es translation
|
||||
* custom headers/footers are now optional and disabled by default
|
||||
|
||||
|
||||
### v0.17 - *2011-11-28*
|
||||
|
|
|
@ -18,10 +18,15 @@ var H5AI_CONFIG = {
|
|||
|
||||
/*
|
||||
* 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",
|
||||
"customFooter": "_h5ai.footer.html",
|
||||
"customHeader": false,
|
||||
"customFooter": false,
|
||||
|
||||
/*
|
||||
* An array of view modes the user may choose from. Currently there
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
},
|
||||
customize = function () {
|
||||
|
||||
if (H5AI.core.settings.customHeader) {
|
||||
$.ajax({
|
||||
url: H5AI.core.settings.customHeader,
|
||||
dataType: "html",
|
||||
|
@ -59,7 +60,9 @@
|
|||
$("#content > header").append($(data)).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (H5AI.core.settings.customFooter) {
|
||||
$.ajax({
|
||||
url: H5AI.core.settings.customFooter,
|
||||
dataType: "html",
|
||||
|
@ -67,6 +70,7 @@
|
|||
$("#content > footer").prepend($(data)).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
fetchPath = function (pathname, callback) {
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ class Customize {
|
|||
|
||||
$absPath = $h5ai->getAbsPath();
|
||||
$options = $h5ai->getOptions();
|
||||
$this->customHeader = $absPath . "/" . $options["customHeader"];
|
||||
$this->customFooter = $absPath . "/" . $options["customFooter"];
|
||||
$this->customHeader = $options["customHeader"] ? $absPath . "/" . $options["customHeader"] : false;
|
||||
$this->customFooter = $options["customFooter"] ? $absPath . "/" . $options["customFooter"] : false;
|
||||
}
|
||||
|
||||
public function getHeader() {
|
||||
|
@ -23,7 +23,7 @@ class Customize {
|
|||
|
||||
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