add i18n
This commit is contained in:
parent
f55fed093b
commit
1ee33693f0
@ -50,15 +50,15 @@ h1 a{margin-left: 4px;margin-top: 16px;}
|
|||||||
<div class="title-right">
|
<div class="title-right">
|
||||||
|
|
||||||
<div class="subnav-search">
|
<div class="subnav-search">
|
||||||
<form action="https://www.google.com/search" method="get" target="_blank"><input type="search" name="q" class="form-control subnav-search-input" aria-label="Search site" value=""><button class="btn" type="submit">Search</button></form>
|
<form action="https://www.google.com/search" method="get" target="_blank"><input type="search" name="q" class="form-control subnav-search-input" aria-label="Search site" value=""><button class="btn" type="submit" id="buttonSearch"></button></form>
|
||||||
<svg class="subnav-search-icon octicon octicon-search" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true"> <path id="searchSVG" fill-rule="evenodd" d=""></path></svg>
|
<svg class="subnav-search-icon octicon octicon-search" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true"> <path id="searchSVG" fill-rule="evenodd" d=""></path></svg>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button id="buttonLink" style="display: none;" class="btn btn-invisible circle" onclick="window.location.href='/link.html'" title="友情链接"><svg class="octicon" width="16" height="16" ><path fill-rule="evenodd"></path></svg></button>
|
<button id="buttonLink" style="display: none;" class="btn btn-invisible circle" onclick="window.location.href='/link.html'"><svg class="octicon" width="16" height="16" ><path fill-rule="evenodd"></path></svg></button>
|
||||||
|
|
||||||
<button id="buttonAbout" style="display: none;" class="btn btn-invisible circle" onclick="window.location.href='/about.html'" title="关于"><svg class="octicon" width="16" height="16" ><path fill-rule="evenodd"></path></svg></button>
|
<button id="buttonAbout" style="display: none;" class="btn btn-invisible circle" onclick="window.location.href='/about.html'"><svg class="octicon" width="16" height="16" ><path fill-rule="evenodd"></path></svg></button>
|
||||||
|
|
||||||
<div><button id="changeTheme" class="btn btn-invisible circle" onclick="modeSwitch()" title="切换主题"><svg class="octicon" width="16" height="16" ><path id="themeSwitch" fill-rule="evenodd"></path></svg></button></div>
|
<div><button id="changeTheme" class="btn btn-invisible circle" onclick="modeSwitch()"><svg class="octicon" width="16" height="16" ><path id="themeSwitch" fill-rule="evenodd"></path></svg></button></div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -73,13 +73,19 @@ h1 a{margin-left: 4px;margin-top: 16px;}
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
var blogBase=%s
|
var blogBase=%s
|
||||||
|
|
||||||
|
var i18nEN=["switch theme","website run","days","links","about me","Search"];
|
||||||
|
var i18nCN=["切换主题","网站运行","天","友情链接","关于","搜索"];
|
||||||
|
if(blogBase["i18n"]=="CN"){var i18n=i18nCN;}
|
||||||
|
else{var i18n=i18nEN;}
|
||||||
|
|
||||||
if(blogBase["startSite"]!=""){
|
if(blogBase["startSite"]!=""){
|
||||||
var now=new Date();
|
var now=new Date();
|
||||||
var startSite=new Date(blogBase["startSite"]);
|
var startSite=new Date(blogBase["startSite"]);
|
||||||
var diff=now.getTime()-startSite.getTime();
|
var diff=now.getTime()-startSite.getTime();
|
||||||
var diffDay=Math.floor(diff/(1000*60*60*24));
|
var diffDay=Math.floor(diff/(1000*60*60*24));
|
||||||
document.getElementById("year").innerHTML=now.getFullYear();
|
document.getElementById("year").innerHTML=now.getFullYear();
|
||||||
document.getElementById("runday").innerHTML="Blog run "+diffDay+" days • ";
|
document.getElementById("runday").innerHTML=i18n[1]+diffDay+i18n[2]+" • ";
|
||||||
}
|
}
|
||||||
|
|
||||||
var postListJson=blogBase["postListJson"]
|
var postListJson=blogBase["postListJson"]
|
||||||
@ -88,6 +94,11 @@ document.title=blogBase["title"];
|
|||||||
document.getElementById("avatarImg").src=blogBase["avatarUrl"];
|
document.getElementById("avatarImg").src=blogBase["avatarUrl"];
|
||||||
document.getElementById("blogTitle").innerHTML=blogBase["title"].substring(1);
|
document.getElementById("blogTitle").innerHTML=blogBase["title"].substring(1);
|
||||||
document.getElementById("blogSubTitle").innerHTML=blogBase["subTitle"];
|
document.getElementById("blogSubTitle").innerHTML=blogBase["subTitle"];
|
||||||
|
document.getElementById("changeTheme").setAttribute("title",i18n[0]);
|
||||||
|
document.getElementById("buttonLink").setAttribute("title",i18n[3]);
|
||||||
|
document.getElementById("buttonLink").setAttribute("title",i18n[4]);
|
||||||
|
document.getElementById("buttonSearch").innerHTML=i18n[5];
|
||||||
|
|
||||||
if(blogBase["filingNum"]!=""){document.getElementById("filingNum").innerHTML=blogBase["filingNum"]+" • ";}
|
if(blogBase["filingNum"]!=""){document.getElementById("filingNum").innerHTML=blogBase["filingNum"]+" • ";}
|
||||||
document.getElementById("footerblogTitle").innerHTML=blogBase["title"];
|
document.getElementById("footerblogTitle").innerHTML=blogBase["title"];
|
||||||
document.getElementById("footerblogTitle").href=blogBase["homeUrl"];
|
document.getElementById("footerblogTitle").href=blogBase["homeUrl"];
|
||||||
|
|||||||
@ -38,11 +38,11 @@ h1 {display:flex;}
|
|||||||
<h1>
|
<h1>
|
||||||
<div id="postTitle"></div>
|
<div id="postTitle"></div>
|
||||||
<div class="title-right">
|
<div class="title-right">
|
||||||
<button class="btn btn-invisible circle" onclick="window.location.href='/'" title="首页"><svg class="octicon octicon-sun" width="16" height="16"><path id="pathHome" fill-rule="evenodd"></path></svg></button>
|
<button id="buttonHome" class="btn btn-invisible circle" onclick="window.location.href='/'"><svg class="octicon octicon-sun" width="16" height="16"><path id="pathHome" fill-rule="evenodd"></path></svg></button>
|
||||||
|
|
||||||
<button class="btn btn-invisible circle" onclick="gotoSource()" title="Issue"><svg class="octicon octicon-sun" width="16" height="16"><path id="pathIssue" fill-rule="evenodd"></path></svg></button>
|
<button class="btn btn-invisible circle" onclick="gotoSource()" title="Issue"><svg class="octicon octicon-sun" width="16" height="16"><path id="pathIssue" fill-rule="evenodd"></path></svg></button>
|
||||||
|
|
||||||
<button class="btn btn-invisible circle" onclick="modeSwitch()" title="切换主题"><svg class="octicon octicon-sun" width="16" height="16"><path id="themeSwitch" fill-rule="evenodd"></path></svg></button>
|
<button id="changeTheme" class="btn btn-invisible circle" onclick="modeSwitch()"><svg class="octicon octicon-sun" width="16" height="16"><path id="themeSwitch" fill-rule="evenodd"></path></svg></button>
|
||||||
</div>
|
</div>
|
||||||
</h1>
|
</h1>
|
||||||
<div id="postBody"></div>
|
<div id="postBody"></div>
|
||||||
@ -58,18 +58,26 @@ h1 {display:flex;}
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
var blogBase=%s
|
var blogBase=%s
|
||||||
|
|
||||||
|
var i18nEN=["switch theme","website run","days","Home"];
|
||||||
|
var i18nCN=["切换主题","网站运行","天","首页"];
|
||||||
|
if(blogBase["i18n"]=="CN"){var i18n=i18nCN;}
|
||||||
|
else{var i18n=i18nEN;}
|
||||||
|
|
||||||
if(blogBase["startSite"]!=""){
|
if(blogBase["startSite"]!=""){
|
||||||
var now=new Date();
|
var now=new Date();
|
||||||
var startSite=new Date(blogBase["startSite"]);
|
var startSite=new Date(blogBase["startSite"]);
|
||||||
var diff=now.getTime()-startSite.getTime();
|
var diff=now.getTime()-startSite.getTime();
|
||||||
var diffDay=Math.floor(diff/(1000*60*60*24));
|
var diffDay=Math.floor(diff/(1000*60*60*24));
|
||||||
document.getElementById("year").innerHTML=now.getFullYear();
|
document.getElementById("year").innerHTML=now.getFullYear();
|
||||||
document.getElementById("runday").innerHTML="Blog run "+diffDay+" days • ";
|
document.getElementById("runday").innerHTML=i18n[1]+diffDay+i18n[2]+" • ";
|
||||||
}
|
}
|
||||||
|
|
||||||
document.title=blogBase["postTitle"];
|
document.title=blogBase["postTitle"];
|
||||||
document.getElementById("postTitle").innerHTML=blogBase["postTitle"];
|
document.getElementById("postTitle").innerHTML=blogBase["postTitle"];
|
||||||
document.getElementById("postBody").innerHTML=blogBase["postBody"];
|
document.getElementById("postBody").innerHTML=blogBase["postBody"];
|
||||||
|
document.getElementById("changeTheme").setAttribute("title",i18n[0]);
|
||||||
|
document.getElementById("buttonHome").setAttribute("title",i18n[3]);
|
||||||
|
|
||||||
if(blogBase["faviconUrl"]!=""){
|
if(blogBase["faviconUrl"]!=""){
|
||||||
link=document.createElement("link");
|
link=document.createElement("link");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user