自定义文章字体大小

[comment]: # (##{"fontSize":“20px”}##)
This commit is contained in:
呆瓜云 2023-08-03 11:05:53 +08:00
parent abba6eb097
commit 04acc85a9a
2 changed files with 13 additions and 2 deletions

View File

@ -147,6 +147,8 @@ else{
document.getElementById("pathHome").setAttribute("d",value=IconList["home"]); document.getElementById("pathHome").setAttribute("d",value=IconList["home"]);
document.getElementById("pathIssue").setAttribute("d",value=IconList["github"]); document.getElementById("pathIssue").setAttribute("d",value=IconList["github"]);
if(blogBase["fontSize"]!=""){document.getElementById("postBody").setAttribute("style","font-size:"+blogBase["fontSize"])}
if(blogBase["commentNum"]>0){ if(blogBase["commentNum"]>0){
cmButton=document.getElementById("cmButton"); cmButton=document.getElementById("cmButton");
span=document.createElement("span"); span=document.createElement("span");

View File

@ -82,6 +82,7 @@ class GMEEK():
postBase["startSite"]=self.blogBase["startSite"] postBase["startSite"]=self.blogBase["startSite"]
postBase["i18n"]=self.blogBase["i18n"] postBase["i18n"]=self.blogBase["i18n"]
postBase["commentNum"]=issue["commentNum"] postBase["commentNum"]=issue["commentNum"]
postBase["fontSize"]=issue["fontSize"]
postBase["repoName"]=options.repo_name postBase["repoName"]=options.repo_name
postBase["GMEEK_VERSION"]=options.Gmeek_version postBase["GMEEK_VERSION"]=options.Gmeek_version
@ -139,10 +140,18 @@ class GMEEK():
self.blogBase["postListJson"][postNum]["description"]=issue.body.split(period)[0]+period self.blogBase["postListJson"][postNum]["description"]=issue.body.split(period)[0]+period
try: try:
modifyTime=json.loads(issue.body.split("\r\n")[-1:][0].split("##")[1]) postConfig=json.loads(issue.body.split("\r\n")[-1:][0].split("##")[1])
self.blogBase["postListJson"][postNum]["createdAt"]=modifyTime["timestamp"]
except: except:
postConfig={}
if "timestamp" in postConfig:
self.blogBase["postListJson"][postNum]["createdAt"]=postConfig["timestamp"]
else:
self.blogBase["postListJson"][postNum]["createdAt"]=int(time.mktime(issue.created_at.timetuple())) self.blogBase["postListJson"][postNum]["createdAt"]=int(time.mktime(issue.created_at.timetuple()))
if "fontSize" in postConfig:
self.blogBase["postListJson"][postNum]["fontSize"]=str(postConfig["fontSize"])
else:
self.blogBase["postListJson"][postNum]["fontSize"]=""
thisYear=datetime.datetime.fromtimestamp(self.blogBase["postListJson"][postNum]["createdAt"]).year thisYear=datetime.datetime.fromtimestamp(self.blogBase["postListJson"][postNum]["createdAt"]).year
self.blogBase["postListJson"][postNum]["dateLabelColor"]=self.blogBase["yearColorList"][int(thisYear)%len(self.blogBase["yearColorList"])] self.blogBase["postListJson"][postNum]["dateLabelColor"]=self.blogBase["yearColorList"][int(thisYear)%len(self.blogBase["yearColorList"])]