needComment用于配置是否需要评论功能
This commit is contained in:
parent
e93fd1b946
commit
4d9fe5ac8f
5
Gmeek.py
5
Gmeek.py
@ -74,14 +74,13 @@ class GMEEK():
|
||||
os.mkdir(self.post_dir)
|
||||
|
||||
if os.path.exists(self.static_dir):
|
||||
target_static_dir = os.path.join(self.root_dir, 'static')
|
||||
shutil.copytree(self.static_dir, target_static_dir)
|
||||
shutil.copytree(self.static_dir, os.path.join(self.root_dir, 'static'))
|
||||
print("Copy static to docs")
|
||||
else:
|
||||
print("static not exist")
|
||||
|
||||
def defaultConfig(self):
|
||||
dconfig={"singlePage":[],"startSite":"","filingNum":"","onePageListNum":15,"commentLabelColor":"#006b75","yearColorList":["#bc4c00", "#0969da", "#1f883d", "#A333D0"],"i18n":"CN","themeMode":"manual","dayTheme":"light","nightTheme":"dark","urlMode":"pinyin","script":"","style":"","indexScript":"","indexStyle":"","bottomText":"","showPostSource":1,"iconList":{},"UTC":+8,"rssSplit":"sentence","exlink":{}}
|
||||
dconfig={"singlePage":[],"startSite":"","filingNum":"","onePageListNum":15,"commentLabelColor":"#006b75","yearColorList":["#bc4c00", "#0969da", "#1f883d", "#A333D0"],"i18n":"CN","themeMode":"manual","dayTheme":"light","nightTheme":"dark","urlMode":"pinyin","script":"","style":"","indexScript":"","indexStyle":"","bottomText":"","showPostSource":1,"iconList":{},"UTC":+8,"rssSplit":"sentence","exlink":{},"needComment":1}
|
||||
config=json.loads(open('config.json', 'r', encoding='utf-8').read())
|
||||
self.blogBase={**dconfig,**config}.copy()
|
||||
self.blogBase["postListJson"]=json.loads('{}')
|
||||
|
||||
@ -57,8 +57,10 @@
|
||||
{% block content %}
|
||||
<div class="markdown-body" id="postBody">{{ blogBase['postBody'] }}</div>
|
||||
<div style="font-size:small;margin-top:8px;float:right;">{{ blogBase['bottomText'] }}</div>
|
||||
{% if blogBase['needComment']==1 %}
|
||||
<button class="btn btn-block" type="button" onclick="openComments()" id="cmButton">{{ i18n['comments'] }}</button>
|
||||
<div class="comments" id="comments"></div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block script %}
|
||||
@ -72,6 +74,8 @@ document.getElementById("pathIssue").setAttribute("d",IconList["github"]);
|
||||
span.innerHTML="{{ blogBase['commentNum'] }}";
|
||||
cmButton.appendChild(span);
|
||||
{%- endif %}
|
||||
|
||||
{% if blogBase['needComment']==1 %}
|
||||
function openComments(){
|
||||
cm=document.getElementById("comments");
|
||||
cmButton=document.getElementById("cmButton");
|
||||
@ -109,6 +113,7 @@ function iFrameLoading(){
|
||||
}
|
||||
}
|
||||
}
|
||||
{%- endif %}
|
||||
</script>
|
||||
{{ blogBase['script'] }}
|
||||
{% endblock %}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user