131 lines
4.9 KiB
HTML
131 lines
4.9 KiB
HTML
{% extends 'base.html' %}
|
|
{% block head %}
|
|
<title>{{ blogBase['title'] }}</title>
|
|
{% 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;}
|
|
|
|
.SideNav-icon{margin-right: 16px}
|
|
.SideNav-item .Label{color: #fff;margin-left:8px;}
|
|
.genTime{float: right;}
|
|
.d-flex{min-width:0;}
|
|
.listTitle{overflow:hidden;white-space:nowrap;text-overflow: ellipsis;max-width: 100%;}
|
|
.listLabels{white-space:nowrap;}
|
|
|
|
@media (max-width: 767px) {
|
|
body { padding: 8px;}
|
|
h1 a{font-size:24px;}
|
|
.SideNav-item .listLabels{display:none;}
|
|
.subTitle{display:none;}
|
|
.genTime{float: none;}
|
|
}
|
|
</style>
|
|
{% endblock %}
|
|
|
|
{% block header %}
|
|
<h1><a>Tag</a></h1>
|
|
<div class="title-right">
|
|
|
|
<a href="/"><button id="buttonHome" class="btn btn-invisible circle" title="{{ i18n['home'] }}">
|
|
<svg class="octicon" width="16" height="16">
|
|
<path id="pathHome" fill-rule="evenodd" d="{{ IconList['home'] }}"></path>
|
|
</svg>
|
|
</button></a>
|
|
{% for num in blogBase['singeListJson'] -%}
|
|
<a href="/{{ blogBase['singeListJson'][num]['label'] }}.html"><button class="btn btn-invisible circle" title="{{ blogBase['singeListJson'][num]['postTitle'] }}">
|
|
<svg class="octicon" width="16" height="16" >
|
|
<path id="{{ blogBase['singeListJson'][num]['postTitle'] }}" fill-rule="evenodd"></path>
|
|
</svg>
|
|
</button></a>
|
|
{%- endfor %}
|
|
<a href="/rss.xml" target="_blank"><button id="buttonRSS" class="btn btn-invisible circle" title="RSS">
|
|
<svg class="octicon" width="16" height="16" >
|
|
<path id="pathRSS" fill-rule="evenodd"></path>
|
|
</svg>
|
|
</button></a>
|
|
<button 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 style="margin-bottom: 16px;">{{ blogBase['subTitle'] }}</div>
|
|
<nav class="SideNav border"></nav>
|
|
{% endblock %}
|
|
|
|
{% block script %}
|
|
<script>
|
|
document.getElementById("pathRSS").setAttribute("d",IconList["rss"]);
|
|
|
|
{% for num in blogBase['singeListJson'] -%}
|
|
document.getElementById("{{ blogBase['singeListJson'][num]['postTitle'] }}").setAttribute("d",value=IconList["{{ blogBase['singeListJson'][num]['label'] }}"]);
|
|
{%- endfor %}
|
|
|
|
let requestJson="blogBase.json"
|
|
let request=new XMLHttpRequest();
|
|
request.open("GET",requestJson);
|
|
request.responseType='text';
|
|
request.send();
|
|
request.onload=function(){
|
|
jsonData=JSON.parse(request.response);
|
|
console.log(jsonData);
|
|
showList(jsonData);
|
|
}
|
|
|
|
tag=window.location.hash.slice(1)
|
|
|
|
function showList(jsonData){
|
|
let SideNav=document.getElementsByClassName("SideNav")[0];
|
|
for(i in jsonData["postListJson"]){
|
|
|
|
if(jsonData["postListJson"][i]['label']==tag || tag==''){
|
|
let item=document.createElement("a");
|
|
item.setAttribute("class","SideNav-item d-flex flex-items-center flex-justify-between");
|
|
item.setAttribute("href",jsonData["postListJson"][i]['postUrl']);
|
|
|
|
let center=document.createElement("div");
|
|
center.setAttribute("class","d-flex flex-items-center");
|
|
|
|
svg=document.createElementNS('http://www.w3.org/2000/svg','svg');
|
|
path=document.createElementNS("http://www.w3.org/2000/svg","path");
|
|
span=document.createElement("span");
|
|
svg.setAttributeNS(null,"class","SideNav-icon octicon");
|
|
svg.setAttributeNS(null,"style","witdh:16px;height:16px");
|
|
path.setAttributeNS(null, "d", IconList["post"]);
|
|
svg.appendChild(path);
|
|
|
|
let title=document.createElement("span");
|
|
title.setAttribute("class","listTitle");
|
|
title.innerHTML=jsonData["postListJson"][i]['postTitle'];
|
|
center.appendChild(svg);
|
|
center.appendChild(title);
|
|
|
|
let listLabels=document.createElement("div");
|
|
listLabels.setAttribute("class","listLabels");
|
|
let LabelName=document.createElement("span");
|
|
LabelName.setAttribute("class","Label");
|
|
LabelName.setAttribute("style","background-color:"+jsonData["postListJson"][i]['labelColor']);
|
|
LabelName.innerHTML=jsonData["postListJson"][i]['label'];
|
|
listLabels.appendChild(LabelName);
|
|
let LabelTime=document.createElement("span");
|
|
LabelTime.setAttribute("class","Label");
|
|
LabelTime.setAttribute("style","background-color:"+jsonData["postListJson"][i]['dateLabelColor']);
|
|
LabelTime.innerHTML=jsonData["postListJson"][i]['createdDate'];
|
|
listLabels.appendChild(LabelTime);
|
|
|
|
item.appendChild(center);
|
|
item.appendChild(listLabels);
|
|
SideNav.appendChild(item);
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
{% endblock %}
|