forked from joshuacox/joshuacox.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
147 lines (138 loc) · 4.48 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
---
layout: default
---
<!-- <div class="content full-bleed intro">
Welcome to my homepage!!1
</div> -->
<section id="posts" class="posts section">
</section>
<div class="posts">
<div class="content full-bleed" id="recent-posts">
{% for post in site.posts limit:50 %}<a
href="{{ post.url }}" class="post-excerpt{% if post.photo_url %} photo{% endif %}">
<div class="padded-content">
{% if post.photo_url %}
<div class="title shadow"><h5>{{ post.title }}</h5>   <strong><p>{{ post.description | strip_html }}</p></strong></div>
{% else %}
<div class="title shadow"><h5>{{ post.title }}</h5></div>
{% endif %}<!-- post.photo_url -->
{% if post.photo_url %}
<div class="image" style="background-image:url('{{ post.photo_url }}')"></div>
{% else %}
<!-- <div class="title">{{ post.title }}</div> -->
<info datetime="{{ page.date | date: "%Y-%m-%d" }}">
{{ post.date | date: "%b %Y" }}   -  
</info>
{% if post.description %}
<span class="body">{{ post.description | strip_html }}</span>
{% else %}
<span class="body">{{ post.excerpt | strip_html }}</span>
{% endif %}
{% endif %}<!-- post.photo_url -->
</div>
</a>{% endfor %}
<hr>
<div class="breaker"></div>
<div class="end">
<a href="/archive/">More...</a>
</div>
</div>
</div>
<script type="text/javascript">
(function(){
var columns = null;
function f(){
var cols = window.innerWidth >= 890 ? 2 : 1;
if (columns === cols) { return; }
columns = cols;
// if (cols === 2) console.log('switch to multi-column');
// else console.log('switch to single-column');
var posts = document.getElementById('recent-posts');
var childNodes = posts.childNodes, i, L = childNodes.length, node, h,
col_width, col0_y, col1_y, col1_x,
origin = {x:0, y:0}, node_count = 0, is_col0, row0_max_y = 0;
posts.style.position = (columns === 1) ? null : 'relative';
for (i = 0; i !== L; ++i) {
node = childNodes[i];
if (node.nodeType === Node.ELEMENT_NODE) {
if (node.className === 'breaker') {
if (columns === 1) {
node.style.height = null;
} else {
node.style.height = Math.max(col0_y, col1_y) + 'px';
}
break;
}
if (columns === 1) {
node.style.position = null;
node.style.top = null;
node.style.left = null;
node.style.width = null;
continue;
}
node.style.position = 'absolute';
if (col0_y === undefined) {
origin.x = node.offsetLeft;
origin.y = node.offsetTop;
col_width = node.clientWidth;
col0_y = origin.y + node.clientHeight;
row0_max_y = col0_y;
node.style.top = '0px';
node.style.left = '0px';
node.style.width = col_width + 'px';
//node.style.border = '1px solid red'
} else {
if (col1_y === undefined) {
col1_y = origin.y + node.clientHeight;
col1_x = origin.x + node.clientWidth;
if (col1_y > row0_max_y) {
row0_max_y = col1_y;
}
node.style.top = '0px';
node.style.left = col1_x + 'px';
node.style.width = col_width + 'px';
} else {
// node.style.position = 'absolute';
is_col0 = (node_count % 2) === 0;
node.style.width = col_width + 'px';
if (is_col0) {
node.style.left = origin.x + 'px';
node.style.top = col0_y + 'px';
node.setAttribute('data-height', node.clientHeight);
col0_y += node.clientHeight;
node.classList.add('col0');
} else {
node.style.left = col1_x + 'px';
node.style.top = col1_y + 'px';
node.setAttribute('data-height', node.clientHeight);
col1_y += node.clientHeight;
node.classList.add('col1');
}
}
}
++node_count;
}
}
}
function mysetup(){
f();
var onresize = f;
// var timer = null;
// function onresize() {
// if (timer !== null) { return; }
// timer = setTimeout(function(){ timer = null; f(); }, 100);
// }
if (window.addEventListener) {
window.addEventListener('resize', onresize);
} else {
window.attachEvent('resize', onresize);
}
}
// if (window.addEventListener) {
// window.addEventListener('DOMContentLoaded', setup);
// } else {
// window.attachEvent('onload', setup);
// }
window.initFuncs.push(mysetup);
})();
</script>