Skip to content

Commit

Permalink
update onesentence
Browse files Browse the repository at this point in the history
  • Loading branch information
ZingLix committed Mar 16, 2024
1 parent e79efa7 commit 8f8ebeb
Show file tree
Hide file tree
Showing 14 changed files with 103 additions and 47 deletions.
43 changes: 22 additions & 21 deletions _includes/short-about.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
<section class="visible-md visible-lg">
<hr>
<h5><a href="{{'/about/' | prepend: site.baseurl }}">ABOUT ME</a></h5>
<div class="short-about">
{% if site.sidebar-avatar %}
<img src="{{site.sidebar-avatar}}" />
{% endif %}
{% if site.sidebar-about-description %}
<hr>
<h5><a href="{{'/about/' | prepend: site.baseurl }}">ABOUT ME</a></h5>
<div class="short-about">
{% if site.sidebar-avatar %}
<img src="{{site.sidebar-avatar}}" />
{% endif %}
{% if site.sidebar-about-description %}

<p id="sentence" onclick="window.location.href='/onesentence'" title="点击有彩蛋">{{site.sidebar-about-description}}</p>
<script>
fetch('https://api.ljnb.top/')
.then(response =>{return response.json();})
.then(data => {
$('p#sentence').text(data['sentence']);
});

</script>
{% endif %}
<!-- SNS Link -->
{% include sns-links.html %}
</div>
</section>
<p id="sentence" onclick="window.location.href='/onesentence'" title="点击有彩蛋">{{site.sidebar-about-description}}</p>
<script>
let r = Math.floor(Math.random() * 12);
fetch(`/api/onesentence/${r}.json`)
.then(response => { return response.json(); })
.then(data => {
$('p#sentence').text(data['sentence']);
});

</script>
{% endif %}
<!-- SNS Link -->
{% include sns-links.html %}
</div>
</section>
4 changes: 4 additions & 0 deletions api/onesentence/0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"sentence": "我们必须知道,我们必将知道。",
"from": "David Hilbert"
}
4 changes: 4 additions & 0 deletions api/onesentence/1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"sentence": "“I have never grown up, but I will never stop growing.”",
"from": null
}
4 changes: 4 additions & 0 deletions api/onesentence/10.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"sentence": "我口袋只剩玫瑰一片,而此行又山高路远。",
"from": "《小尖尖》"
}
4 changes: 4 additions & 0 deletions api/onesentence/11.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"sentence": "看脚下一片黑暗,望头顶星光璀璨",
"from": "《火车驶向云外,梦安魂于九霄》"
}
4 changes: 4 additions & 0 deletions api/onesentence/2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"sentence": "“Per Aspera Ad Astra”",
"from": null
}
4 changes: 4 additions & 0 deletions api/onesentence/3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"sentence": "山中何事?松花酿酒,春水煎茶。",
"from": "《人月圆·山中书事》"
}
4 changes: 4 additions & 0 deletions api/onesentence/4.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"sentence": "循此苦旅,以达天际。",
"from": null
}
4 changes: 4 additions & 0 deletions api/onesentence/5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"sentence": "且将新火试新茶,诗酒趁年华。",
"from": "《望江南·超然台作》"
}
4 changes: 4 additions & 0 deletions api/onesentence/6.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"sentence": "探索世界的好奇心万岁!",
"from": null
}
4 changes: 4 additions & 0 deletions api/onesentence/7.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"sentence": "Tick tock, never stop.",
"from": null
}
4 changes: 4 additions & 0 deletions api/onesentence/8.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"sentence": "我随清风浮云去,雾散之时即归来。",
"from": null
}
4 changes: 4 additions & 0 deletions api/onesentence/9.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"sentence": "人生本该自由,乘兴而去,尽兴而归。",
"from": null
}
59 changes: 33 additions & 26 deletions onesentence.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,45 @@


<!-- Page Header -->
<header class="intro-header" style="background-image: url('{{ site.baseurl }}/{% if page.header-img %}{{ page.header-img }}{% else %}{{ site.header-img }}{% endif %}')">
<div class="container">
<div class="row">
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
<div class="site-heading" id="tag-heading" style="font-size: 40px;display: block;">
<div style="position: relative; margin-top: 35vh;margin-bottom: 35vh; margin-left: auto;margin-right: auto; width: 55%;">

<div style="position: absolute;left: 0; top: 0;"></div>
<div id="sentence" style="font-size: 3.3rem; text-align: center; line-height: 80px; word-break: normal; margin: 0; padding: 15px 50px;" onclick="update()">...</div>
<div style="position: absolute;right: 0; bottom: 0;"></div>

<div id="from" style="display: none;font-size: 20px;float: right;margin-top: 40px;color: rgba(255, 255, 255, 0.8);"></div>
<header class="intro-header"
style="background-image: url('{{ site.baseurl }}/{% if page.header-img %}{{ page.header-img }}{% else %}{{ site.header-img }}{% endif %}')">
<div class="container">
<div class="row">
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
<div class="site-heading" id="tag-heading" style="font-size: 40px;display: block;">
<div
style="position: relative; margin-top: 35vh;margin-bottom: 35vh; margin-left: auto;margin-right: auto; width: 55%;">

<div style="position: absolute;left: 0; top: 0;"></div>
<div id="sentence"
style="font-size: 3.3rem; text-align: center; line-height: 80px; word-break: normal; margin: 0; padding: 15px 50px;"
onclick="update()">...</div>
<div style="position: absolute;right: 0; bottom: 0;"></div>

<div id="from"
style="display: none;font-size: 20px;float: right;margin-top: 40px;color: rgba(255, 255, 255, 0.8);">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</header>

<script>
document.body.classList.add('page-fullscreen');
function update(){
fetch('https://api.ljnb.top/')
.then(response =>{return response.json();})
.then(data => {
$('div#sentence').text(data['sentence']);
if(data['from']!=null){
$('div#from').show().text("——"+data['from']);
}else{
$('div#from').hide();
}
});
document.body.classList.add('page-fullscreen');
function update() {
let r = Math.floor(Math.random() * 12);
fetch(`/api/onesentence/${r}.json`)
.then(response => { return response.json(); })
.then(data => {
$('div#sentence').text(data['sentence']);
if (data['from'] != null) {
$('div#from').show().text("——" + data['from']);
} else {
$('div#from').hide();
}
});
}
update();
</script>

0 comments on commit 8f8ebeb

Please sign in to comment.