文章页自定义style

[comment]: # (##{"style":“<style>#postBody{font-size:20px}</style>”}##)
This commit is contained in:
呆瓜云 2023-08-14 09:53:56 +08:00
parent 9d852ee859
commit 4aa6d04d4b
2 changed files with 6 additions and 8 deletions

View File

@ -103,7 +103,7 @@ class GMEEK():
postBase["startSite"]=self.blogBase["startSite"]
postBase["i18n"]=self.blogBase["i18n"]
postBase["commentNum"]=issue["commentNum"]
postBase["fontSize"]=issue["fontSize"]
postBase["style"]=issue["style"]
postBase["script"]=issue["script"]
postBase["top"]=issue["top"]
postBase["repoName"]=options.repo_name
@ -189,10 +189,10 @@ class GMEEK():
self.blogBase["postListJson"][postNum]["createdAt"]=postConfig["timestamp"]
else:
self.blogBase["postListJson"][postNum]["createdAt"]=int(time.mktime(issue.created_at.timetuple()))
if "fontSize" in postConfig:
self.blogBase["postListJson"][postNum]["fontSize"]=str(postConfig["fontSize"])
if "style" in postConfig:
self.blogBase["postListJson"][postNum]["style"]=str(postConfig["style"])
else:
self.blogBase["postListJson"][postNum]["fontSize"]=""
self.blogBase["postListJson"][postNum]["style"]=""
if "script" in postConfig:
self.blogBase["postListJson"][postNum]["script"]=str(postConfig["script"])
else:

View File

@ -17,6 +17,8 @@ h1 a:not([href]){color:inherit;text-decoration:none;vertical-align: bottom;font-
.g-emoji{font-size:24px;}
@media (max-width: 767px) {body {padding: 8px;}}
</style>
{{ blogBase['style'] }}
{% endblock %}
{% block header %}
<h1>
@ -56,10 +58,6 @@ h1 a:not([href]){color:inherit;text-decoration:none;vertical-align: bottom;font-
{% block script %}
<script>
{% if blogBase['fontSize']!="" -%}
document.getElementById("postBody").setAttribute("style","font-size:{{ blogBase['fontSize'] }}");
{%- endif %}
{% if blogBase['commentNum']>0 -%}
cmButton=document.getElementById("cmButton");
span=document.createElement("span");