-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
101 lines (91 loc) · 4.06 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
---
layout: home
---
<h1 class="page-title">Issues</h1>
<section>
{%- assign latest_issue = site.issues | reverse | first -%}
{%- assign issues = site.issues | reverse | shift -%}
<a class="issue-preview latest" href="{{ latest_issue.url | relative_url }}">
{% if latest_issue.front_cover %}
<img src="{{ latest_issue.front_cover | relative_url }}" alt="{{ latest_issue.front_cover | relative_url }}"/>
{% elsif latest_issue.image %}
<img src="{{ latest_issue.image | relative_url }}" alt="{{ latest_issue.image | relative_url }}"/>
{% endif %}
<h4>{{ latest_issue.title | escape }}</h4>
</a>
<div class="issue-slider">
<a href="/issues/" class="mobile-link">View more issues</a>
<a href="#" class="left">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" viewBox="0 0 185.343 185.343" style="enable-background:new 0 0 185.343 185.343; transform: rotate(180deg);" xml:space="preserve">
<g>
<g>
<path style="fill: currentColor;" d="M51.707,185.343c-2.741,0-5.493-1.044-7.593-3.149c-4.194-4.194-4.194-10.981,0-15.175 l74.352-74.347L44.114,18.32c-4.194-4.194-4.194-10.987,0-15.175c4.194-4.194,10.987-4.194,15.18,0l81.934,81.934 c4.194,4.194,4.194,10.987,0,15.175l-81.934,81.939C57.201,184.293,54.454,185.343,51.707,185.343z"/>
</g>
</g>
</svg>
</a>
<ul class="issue-list">
{%- for issue in issues -%}
<li>
<a class="issue-preview" href="{{ issue.url | relative_url }}">
{% if issue.front_cover %}
<img src="{{ issue.front_cover | relative_url }}" alt="{{ issue.front_cover | relative_url }}"/>
{% elsif issue.image %}
<img src="{{ issue.image | relative_url }}" alt="{{ issue.image | relative_url }}"/>
{% endif %}
<h4>{{ issue.title | escape }}</h4>
</a>
</li>
{%- endfor -%}
</ul>
<a href="#" class="right">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" viewBox="0 0 185.343 185.343" style="enable-background:new 0 0 185.343 185.343;" xml:space="preserve">
<g>
<g>
<path style="fill: currentColor;" d="M51.707,185.343c-2.741,0-5.493-1.044-7.593-3.149c-4.194-4.194-4.194-10.981,0-15.175 l74.352-74.347L44.114,18.32c-4.194-4.194-4.194-10.987,0-15.175c4.194-4.194,10.987-4.194,15.18,0l81.934,81.934 c4.194,4.194,4.194,10.987,0,15.175l-81.934,81.939C57.201,184.293,54.454,185.343,51.707,185.343z"/>
</g>
</g>
</svg>
</a>
</div>
</section>
<h1 class="page-title">Our Articles</h1>
<section>
<ul id="article-list" class="article-list">
{% for article in site.articles reversed %}
<li hidden>
<a class="article-preview" href="{{ article.url | relative_url }}">
<h4>{{ article.title | escape }}</h4>
<p>{{ article.description | escape }}</p>
</a>
</li>
{% endfor %}
</ul>
<button id="load-btn" class="load-btn" onClick="load()">Load More</button>
</section>
<script>
const LOAD_AMT = 8;
let articles = JSON.parse(decodeURI("{{ site.articles | jsonify | uri_escape }}")).reverse();
let index = 0;
function load() {
let list = document.getElementById('article-list');
if(index >= list.children.length) {
return;
}
let origIndex = index;
for(; index < Math.min(list.children.length, origIndex + LOAD_AMT); index++) {
if(articles[index].image) {
let preview = document.createElement('img');
preview.src = articles[index].image;
preview.alt = articles[index].image;
/*add image to anchor instead of list element*/
list.children[index].children.item(0).prepend(preview);
}
list.children[index].hidden = false;
}
if(index >= list.children.length) {
document.getElementById('load-btn').hidden = true;
}
}
load();
</script>