Skip to content

Commit

Permalink
fix: gitignore, close kitian616#9
Browse files Browse the repository at this point in the history
  • Loading branch information
kitian616 committed Nov 23, 2017
2 parents debfbde + 6641e6b commit ba65e9a
Show file tree
Hide file tree
Showing 5 changed files with 428 additions and 54 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,4 @@ build-iPhoneSimulator/
# jekyll
_site/
.sass-cache/
.jekyll-metadata

/_posts/
.jekyll-metadata
44 changes: 22 additions & 22 deletions _layouts/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,27 +96,27 @@ <h1><a href="{{ href }}">{{ post.title }}</a></h1>
</div>
</div>
{% if site.leancloud.app_id and site.leancloud.app_key and site.leancloud.app_class and site.isdebug == false %}
<script src="https://cdn1.lncld.net/static/js/av-min-1.2.1.js"></script>
<script>
$(function() {
AV.init({
appId: '{{ site.leancloud.app_id }}',
appKey: '{{ site.leancloud.app_key }}'
});
$(".article-view").each(function() {
var curId = this.id,
query = new AV.Query('{{ site.leancloud.app_class }}');
query.equalTo('key', curId.substr(9));
query.first().then(function(result) {
if (result) {
$('#' + curId).text(result.attributes.views);
}
}, function(error) {
if (error) {
throw error;
}
<script src="https://cdn1.lncld.net/static/js/3.4.1/av-min.js"></script>
<script>
$(function() {
AV.init({
appId: '{{ site.leancloud.app_id }}',
appKey: '{{ site.leancloud.app_key }}'
});
$(".article-view").each(function() {
var curId = this.id;
var query = new AV.Query('{{ site.leancloud.app_class }}');
query.equalTo('key', curId.substr(9));
query.first().then(function(result) {
if (result) {
$('#' + curId).text(result.attributes.views);
}
}, function(error) {
if (error) {
throw error;
}
});
});
});
});
});
</script>
</script>
{% endif %}
146 changes: 146 additions & 0 deletions _layouts/home.html.orig
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
---
layout: blog-default
titles:
en: Blog
zh: 博客
zh-Hans: 博客
zh-Hant: 博客
---
<div class="m-home">
<div class="main">
<div class="m-post-list">
{% for post in paginator.posts %}
<article>
{% assign __path = post.url %}
{% include snippets/prepend-baseurl.html %}
{% assign href = __return %}
<h1><a href="{{ href }}">{{ post.title }}</a></h1>
<div class="m-article-content">
{% if site.excerpt_type == 'html' %}
{{ post.excerpt }}
{% else %}
{{ post.excerpt | strip_html | truncate: 350 }}
{% endif %}
</div>
{% assign __path = post.url %}
{% include snippets/prepend-baseurl.html %}
{% assign __locale = site.data.locale.READMORE %}
{% include snippets/locale-to-string.html %}
<a href="{{ href }}">{{ __return }}</a>
{% include blog/article-data.html %}
</article>
{% endfor %}
</div>
{% if paginator.total_pages > 1 %}
<nav class="m-pagination">
{% assign __locale = site.data.locale.STATISTICS %}
{% include snippets/locale-to-string.html %}
{% assign post_count = site.posts | size %}
{% assign page_count = paginator.total_pages %}
<p>{{ __return | replace: '[POST_COUNT]', post_count | replace: '[PAGE_COUNT]', page_count }}</p>
<ul class="inline-list">
{% if paginator.previous_page %}
{% assign __path = paginator.previous_page_path %}
{% include snippets/prepend-baseurl.html %}
{% assign href = __return %}
<li><a class="round-button" href="{{ href }}">
<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="round-button cur"><span>{{ page }}</span></div>
</li>
{% elsif page == 1 %}
{% if site.paths.home %}
{% assign __path = site.paths.home %}
{% else %}
{% assign __path = '/' %}
{% endif %}
{% include snippets/prepend-baseurl.html %}
{% assign href = __return %}
<li>
<a class="round-button" href="{{ href }}"><span>{{ page }}</span></a>
</li>
{% else %}
{% assign __path = site.paginate_path %}
{% include snippets/prepend-baseurl.html %}
{% assign href = __return %}
<li>
<a class="round-button" href="{{ href | replace: ':num', page }}"><span>{{ page }}</span></a>
</li>
{% endif %}
{% endfor %}
{% if paginator.next_page %}
{% assign __path = paginator.next_page_path %}
{% include snippets/prepend-baseurl.html %}
{% assign href = __return %}
<li>
<a class="round-button" href="{{ href }}">
<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 %}
</div>
</div>
{% if site.leancloud.app_id and site.leancloud.app_key and site.leancloud.app_class and site.isdebug == false %}
<<<<<<< HEAD
<script src="https://cdn1.lncld.net/static/js/av-min-1.2.1.js"></script>
<script>
$(function() {
AV.init({
appId: '{{ site.leancloud.app_id }}',
appKey: '{{ site.leancloud.app_key }}'
});
$(".article-view").each(function() {
var curId = this.id,
query = new AV.Query('{{ site.leancloud.app_class }}');
query.equalTo('key', curId.substr(9));
query.first().then(function(result) {
if (result) {
$('#' + curId).text(result.attributes.views);
}
}, function(error) {
if (error) {
throw error;
}
=======
<script src="https://cdn1.lncld.net/static/js/3.4.1/av-min.js"></script>
<script>
$(function() {
AV.init({
appId: '{{ site.leancloud.app_id }}',
appKey: '{{ site.leancloud.app_key }}'
});
$(".article-view").each(function() {
var curId = this.id;
var query = new AV.Query('{{ site.leancloud.app_class }}');
query.equalTo('key', curId.substr(9));
query.first().then(function(result) {
if (result) {
$('#' + curId).text(result.attributes.views);
}
}, function(error) {
if (error) {
throw error;
}
});
});
>>>>>>> 6641e6bb1bd5093d0c71e190e49ef9fec4e1dd93
});
});
});
</script>
{% endif %}
58 changes: 29 additions & 29 deletions _layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -147,35 +147,35 @@ <h1 itemprop="headline" itemprop="name headline">{{ __return }}</h1>
});
</script>
{% if page.key and site.leancloud.app_id and site.leancloud.app_key and site.leancloud.app_class and site.isdebug == false %}
<script src="https://cdn1.lncld.net/static/js/av-min-1.2.1.js"></script>
<script type="text/javascript">
$(function() {
// 初始化
AV.init({
appId: '{{ site.leancloud.app_id }}',
appKey: '{{ site.leancloud.app_key }}'
});
// 查询
var query = new AV.Query('{{ site.leancloud.app_class }}');
query.equalTo('key', '{{ page.key }}');
query.first().then(function(result) {
if (result) {
addOne(result)
} else {
// 新建
var Blog = AV.Object.extend('{{ site.leancloud.app_class }}');
var blog = new Blog();
blog.set('title', '{{ page.title }}');
blog.set('key', '{{ page.key }}');
blog.set('views', 0);
blog.save().then(function(page) {
addOne(page)
}, function(error) {
if (error) {
throw error;
}
});
}
<script src="https://cdn1.lncld.net/static/js/3.4.1/av-min.js"></script>
<script type="text/javascript">
$(function() {
// 初始化
AV.init({
appId: '{{ site.leancloud.app_id }}',
appKey: '{{ site.leancloud.app_key }}'
});
// 查询
var query = new AV.Query('{{ site.leancloud.app_class }}');
query.equalTo('key', '{{ page.key }}');
query.first().then(function(result) {
if (result) {
addOne(result)
} else {
//新建
var Blog = AV.Object.extend('{{ site.leancloud.app_class }}');
var blog = new Blog();
blog.set('title', '{{ page.title }}');
blog.set('key', '{{ page.key }}');
blog.set('views', 0);
blog.save().then(function(page) {
addOne(page)
}, function(error) {
if (error) {
throw error;
}
});
}

function addOne(page) {
page.increment('views', 1);
Expand Down
Loading

0 comments on commit ba65e9a

Please sign in to comment.