Gmeek/templates/post.html
2023-08-12 20:51:38 +08:00

87 lines
3.0 KiB
HTML

{% extends 'base.html' %}
{% block title%}{{ blogBase['postTitle'] }}{% endblock %}
{% block style %}
<style>
h1 a:not([href]){color:inherit;text-decoration:none;vertical-align: bottom;font-size:40px;font-family:Monaco;}
.title-right{display:flex;margin:auto 0 0 auto;}
.title-right .circle{padding: 14px 16px;margin-right:8px;}
#cmButton{height:48px;margin-top:48px;}
.comments{border-top: 2px solid var(--color-border-default);margin-top:64px;}
</style>
{% endblock %}
{% block header %}
<h1>
<a>{{ blogBase['postTitle'] }}</a>
</h1>
<div class="title-right">
<button id="buttonHome" class="btn btn-invisible circle" onclick="window.location.href='/'" title="{{ i18n['home'] }}">
<svg class="octicon" width="16" height="16">
<path id="pathHome" fill-rule="evenodd"></path>
</svg>
</button>
<button class="btn btn-invisible circle" onclick="window.open('{{ blogBase["postSourceUrl"] }}')" title="Issue">
<svg class="octicon" width="16" height="16">
<path id="pathIssue" fill-rule="evenodd"></path>
</svg>
</button>
<button id="changeTheme" class="btn btn-invisible circle" onclick="modeSwitch()" title="{{ i18n['switchTheme'] }}">
<svg class="octicon" width="16" height="16" >
<path id="themeSwitch" fill-rule="evenodd"></path>
</svg>
</button>
</div>
{% endblock %}
{% block content %}
<div class="markdown-body">
{{ blogBase['postBody'] }}
</div>
<button class="btn btn-block" type="button" onclick="openComments()" id="cmButton" value="{{ blogBase['repoName'] }}">{{ i18n['comments'] }}</button>
<div class="comments" id="comments"></div>
{% endblock %}
{% block script %}
<script>
document.getElementById("pathHome").setAttribute("d",IconList["home"]);
document.getElementById("pathIssue").setAttribute("d",IconList["github"]);
function openComments(){
cm=document.getElementById("comments");
cmButton=document.getElementById("cmButton");
cmButton.innerHTML="loading";
span=document.createElement("span");
span.setAttribute("class","AnimatedEllipsis");
cmButton.appendChild(span);
script=document.createElement("script");
script.setAttribute("src","https://utteranc.es/client.js");
script.setAttribute("repo",cmButton.value);
script.setAttribute("issue-term","title");
if(localStorage.getItem("meek_theme")=="dark"){script.setAttribute("theme","dark-blue");}
else{script.setAttribute("theme","github-light");}
script.setAttribute("crossorigin","anonymous");
script.setAttribute("async","");
cm.appendChild(script);
int=self.setInterval("iFrameLoading()",200);
}
function iFrameLoading(){
var utterances=document.getElementsByClassName('utterances');
if(utterances.length==1){
if(utterances[0].style.height!=""){
utterancesLoad=1;
int=window.clearInterval(int);
document.getElementById("cmButton").style.display="none";
console.log("utterances Load OK");
}
}
}
</script>
{% endblock %}