From 04acc85a9a459f1fc861ee4f3ab052ac24de341f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=86=E7=93=9C=E4=BA=91?= Date: Thu, 3 Aug 2023 11:05:53 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E6=96=87=E7=AB=A0?= =?UTF-8?q?=E5=AD=97=E4=BD=93=E5=A4=A7=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [comment]: # (##{"fontSize":“20px”}##) --- Gmeek.js | 2 ++ Gmeek.py | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Gmeek.js b/Gmeek.js index 78e8e80..778afa3 100644 --- a/Gmeek.js +++ b/Gmeek.js @@ -147,6 +147,8 @@ else{ document.getElementById("pathHome").setAttribute("d",value=IconList["home"]); document.getElementById("pathIssue").setAttribute("d",value=IconList["github"]); + if(blogBase["fontSize"]!=""){document.getElementById("postBody").setAttribute("style","font-size:"+blogBase["fontSize"])} + if(blogBase["commentNum"]>0){ cmButton=document.getElementById("cmButton"); span=document.createElement("span"); diff --git a/Gmeek.py b/Gmeek.py index f67701a..68d89ff 100644 --- a/Gmeek.py +++ b/Gmeek.py @@ -82,6 +82,7 @@ class GMEEK(): postBase["startSite"]=self.blogBase["startSite"] postBase["i18n"]=self.blogBase["i18n"] postBase["commentNum"]=issue["commentNum"] + postBase["fontSize"]=issue["fontSize"] postBase["repoName"]=options.repo_name postBase["GMEEK_VERSION"]=options.Gmeek_version @@ -139,10 +140,18 @@ class GMEEK(): self.blogBase["postListJson"][postNum]["description"]=issue.body.split(period)[0]+period try: - modifyTime=json.loads(issue.body.split("\r\n")[-1:][0].split("##")[1]) - self.blogBase["postListJson"][postNum]["createdAt"]=modifyTime["timestamp"] + postConfig=json.loads(issue.body.split("\r\n")[-1:][0].split("##")[1]) 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())) + 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 self.blogBase["postListJson"][postNum]["dateLabelColor"]=self.blogBase["yearColorList"][int(thisYear)%len(self.blogBase["yearColorList"])]