1
0
mirror of https://github.com/suk-ws/ph-Bookshelf.git synced 2024-12-05 01:16:53 +08:00

添加了自定义 css/js 的输出功能

- 现在读取的是 data 目录下的 custom.css 和 custom.js 文件
- custom.css 会作为最后一个 <head> 子元素输出,custom.js 会在页面尾在预定义 js 输出后输出
This commit is contained in:
A.C.Sukazyo Eyre 2021-05-05 13:42:29 +08:00
parent 55610855f4
commit f00a421c31
Signed by: Eyre_S
GPG Key ID: EFB47D98FE082FAD
3 changed files with 11 additions and 0 deletions

View File

@ -35,4 +35,12 @@ class SiteMeta {
);
}
public static function getCustomCssContent (string $id): string {
return file_get_contents("./data/$id.css");
}
public static function getCustomScriptContent (string $id): string {
return file_get_contents("./data/$id.js");
}
}

View File

@ -10,6 +10,7 @@
echo "<script src=\"$item\"></script>";
}
?>
<script><?= SiteMeta::getCustomScriptContent("custom") ?></script>
</body>

View File

@ -24,6 +24,8 @@
echo "<link rel=\"stylesheet\" href=\"$item\">";
}
?>
<!-- Customs(css) -->
<style><?= SiteMeta::getCustomCssContent("custom") ?></style>
</head>
<body>
<div class="book">