forked from kitian616/jekyll-TeXt-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
293 additions
and
263 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
--- | ||
layout: blog-default | ||
title: All Posts | ||
--- | ||
<div class="main"> | ||
<section class="m-all"> | ||
<h1 class="page-heading">All Posts</h1> | ||
<div class="tag-wrapper"> | ||
{% include blog/tags.html %} | ||
</div> | ||
|
||
<!--group by year: http://stackoverflow.com/questions/19086284/jekyll-liquid-templating-how-to-group-blog-posts-by-year--> | ||
<section class="year-wrapper"> | ||
{% for post in site.posts %} | ||
{% assign currentdate = post.date | date: "%Y" %} | ||
{% if currentdate != date %} | ||
{% unless forloop.first %}</ul></section>{% endunless %} | ||
<section id="{{ post.date | date: "%Y" }}"> | ||
<h1 class="yaer-title" id="year-{{ post.date | date: "%Y" }}">{{ currentdate }}</h1> | ||
<ul class="post-list"> | ||
{% assign date = currentdate %} | ||
{% endif %} | ||
<li class="post-block {% for tag in post.tags %} tag-{{ tag }} {% endfor %}"> | ||
<span class="post-date">{{ post.date | date:"%b %d" }}</span><a class="post-link" href="{{ post.url | prepend: site.base_path | replace: '//', '/' }}">{{ post.title }}</a> | ||
</li> | ||
{% if forloop.last %}</ul></section>{% endif %} | ||
{% endfor %} | ||
</section> | ||
</section> | ||
</div> | ||
|
||
<script type="text/javascript"> | ||
// function queryString is copied from | ||
// http://stackoverflow.com/questions/979975/how-to-get-the-value-from-url-parameter#answer-979995 | ||
function queryString() { | ||
// This function is anonymous, is executed immediately and | ||
// the return value is assigned to QueryString! | ||
var query_string = {}; | ||
var query = window.location.search.substring(1); | ||
var vars = query.split("&"); | ||
for (var i=0;i<vars.length;i++) { | ||
var pair = vars[i].split("="); | ||
// If first entry with this name | ||
if (typeof query_string[pair[0]] === "undefined") { | ||
query_string[pair[0]] = pair[1]; | ||
// If second entry with this name | ||
} else if (typeof query_string[pair[0]] === "string") { | ||
var arr = [ query_string[pair[0]], pair[1] ]; | ||
query_string[pair[0]] = arr; | ||
// If third or later entry with this name | ||
} else { | ||
query_string[pair[0]].push(pair[1]); | ||
} | ||
} | ||
return query_string; | ||
} | ||
|
||
function tagSelect(tag) { | ||
if (tag === undefined || tag === '') { | ||
$('.page-heading').text('All Posts'); | ||
$('.article-tag.tag-show-all').focus(); | ||
$('.post-block').show(); | ||
} else { | ||
$('.page-heading').text('Tag: ' + tag); | ||
$('.post-block').not('.tag-' + tag).hide(); | ||
$('.article-tag').filter('.tag-' + tag).focus(); | ||
$('.post-block').filter('.tag-' + tag).show(); | ||
} | ||
$('.year-wrapper section').each(function() { | ||
var li_all_show = false; | ||
var li_lists = $(this).find('li'); | ||
for (var i = 0; i < li_lists.length; i++) { | ||
if($(li_lists[i]).css('display') !== 'none') { | ||
li_all_show = true; | ||
break; | ||
} | ||
} | ||
if (li_all_show === false) { | ||
$(this).hide(); | ||
} else { | ||
$(this).show(); | ||
} | ||
}); | ||
tag === undefined || window.history.replaceState(null, '', '{{ "/all.html?tag=" | prepend: site.blog.baseurl }}' + tag); | ||
} | ||
|
||
$(function() { | ||
var query = queryString(); | ||
var tag = undefined; | ||
query.tag === undefined || (tag = decodeURI(query.tag)); | ||
tagSelect(tag); | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
--- | ||
layout: blog-default | ||
title: Blog | ||
--- | ||
<div class="main"> | ||
<section class="m-home"> | ||
<div class="m-post-list"> | ||
<!-- This loops through the paginated posts --> | ||
{% for post in paginator.posts %} | ||
<article> | ||
<h1> | ||
<a class="article-link" href="{{ post.url | prepend: site.base_path | replace: '//', '/' }}">{{ post.title }}</a> | ||
</h1> | ||
<div class="m-article-content"> | ||
{{ post.excerpt }} | ||
</div> | ||
{% include blog/article-data.html %} | ||
</article> | ||
{% endfor %} | ||
</div> | ||
|
||
<!-- Pagination links --> | ||
{% if paginator.total_pages > 1 %} | ||
<nav class="m-pagination"> | ||
<p>{{ site.posts | size }} post articles | {{ paginator.total_pages }} pages. </p> | ||
<ul class="clearfix"> | ||
{% if paginator.previous_page %} | ||
<li><a class="round-button" href="{{ paginator.previous_page_path | prepend: site.base_path | replace: '//', '/' }}"> | ||
<div class="icon icon--previous">{% include icon/previous.svg %}</div> | ||
</a></li> | ||
{% else %} | ||
<li><div class="round-button inactive"> | ||
<div class="icon icon--prrevious">{% include icon/previous.svg %}</div> | ||
</div></li> | ||
{% endif %} | ||
|
||
{% for page in (1..paginator.total_pages) %} | ||
{% if page == paginator.page %} | ||
<li><div class="cur-page"> | ||
<div class="round-button"> | ||
<span>{{ page }}</span> | ||
</div> | ||
</div></li> | ||
{% elsif page == 1 %} | ||
<li><a class="round-button" href="{{ paginator.previous_page_path | prepend: site.base_path | replace: '//', '/' }}"><span>{{ page }}</span></a></li> | ||
{% else %} | ||
<li><a class="round-button" href="{{ site.paginate_path | prepend: site.base_path | replace: '//', '/' | replace: ':num', page }}"><span>{{ page }}</span></a></li> | ||
{% endif %} | ||
{% endfor %} | ||
|
||
{% if paginator.next_page %} | ||
<li><a class="round-button" href="{{ paginator.next_page_path | prepend: site.base_path | replace: '//', '/' }}"> | ||
<div class="icon icon--next">{% include icon/next.svg %}</div> | ||
</a></li> | ||
{% else %} | ||
<li><div class="round-button inactive"> | ||
<div class="icon icon--next">{% include icon/next.svg %}</div> | ||
</div></li> | ||
{% endif %} | ||
</ul> | ||
</nav> | ||
{% endif %} | ||
</section> | ||
</div> | ||
|
||
{% if site.isdebug == false %} | ||
<script src="https://cdn1.lncld.net/static/js/av-min-1.2.1.js"></script> | ||
<script> | ||
$(function() { | ||
// 初始化 | ||
AV.init({ | ||
appId: '{{ site.app_id }}', | ||
appKey: '{{ site.app_key }}' | ||
}); | ||
$(".article-view").each(function() { | ||
var curId = this.id; | ||
var query = new AV.Query('{{ site.app_class }}'); | ||
query.equalTo('key', /(.*)-(.*)/.exec(curId)[2]); | ||
query.first().then(function(result) { | ||
if (result) { | ||
$('#' + curId).text(result.attributes.views); | ||
} | ||
}, function(error) { | ||
if (error) { | ||
throw error; | ||
} | ||
}); | ||
}); | ||
}); | ||
</script> | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.