forked from yearn/yearn-comms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
100 lines (90 loc) · 3.05 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
---
title: Home
layout: default
background: '/img/bg-index.jpg'
---
<!-- Home Intro
================================================== -->
<!--
{% if page.url == "/" %}
<div class="rounded mb-5 hero">
<div class="row align-items-center justify-content-between">
<div class="col-md-6">
<h1 class="font-weight-bold mb-4 serif-font">Welcome to our blog</h1>
<p class="lead mb-4">Here is a collection of all newsletters, articles, and other tutorials about Yearn.finance</p>
<a href="{{site.baseurl}}/about" class="btn btn-dark text-white px-5 btn-lg">About me</a>
</div>
<div class="col-md-6 text-right pl-0 pl-lg-4">
<img class="intro" height="500" src="{{site.baseurl}}/assets/images/intro.svg">
</div>
</div>
</div>
{% endif %}
-->
<!-- Posts List with Sidebar (except featured)
================================================== -->
<section class="row">
<div class="row-sm-8">
<div class="masonry-wrapper">
<div class="masonry">
{% for post in paginator.posts %}
{% unless post.publish == false %}
<div class="masonry-item">
{% include postbox.html %}
</div>
{% endunless %}
{% endfor %}
</div>
</div>
<!-- Pagination -->
<div class="bottompagination">
<span class="navigation" role="navigation">
{% include pagination.html %}
</span>
</div>
</div>
</section>
<script src="//unpkg.com/imagesloaded@4/imagesloaded.pkgd.min.js"></script>
<script>
function resizeMasonryItem(item) {
var grid = document.getElementsByClassName('masonry')[0];
if (grid) {
var rowGap = parseInt(window.getComputedStyle(grid).getPropertyValue('grid-row-gap')),
rowHeight = parseInt(window.getComputedStyle(grid).getPropertyValue('grid-auto-rows')),
gridImagesAsContent = item.querySelector('masonry-image');
var rowSpan = Math.ceil((item.querySelector('.masonry-content').getBoundingClientRect().height + rowGap) / (
rowHeight + rowGap));
/* Set the spanning as calculated above (S) */
item.style.gridRowEnd = 'span ' + rowSpan;
if (gridImagesAsContent) {
item.querySelector('masonry-image').style.height = item.getBoundingClientRect().height + "px";
}
}
}
function resizeAllMasonryItems() {
var allItems = document.querySelectorAll('.masonry-item');
if (allItems) {
for (var i = 0; i > allItems.length; i++) {
resizeMasonryItem(allItems[i]);
}
}
}
function waitForImages() {
var allItems = document.querySelectorAll('.masonry-item');
if (allItems) {
for (var i = 0; i < allItems.length; i++) {
imagesLoaded(allItems[i], function (instance) {
var item = instance.elements[0];
resizeMasonryItem(item);
console.log("Waiting for Images");
});
}
}
}
/* Resize all the grid items on the load and resize events */
var masonryEvents = ['load', 'resize'];
masonryEvents.forEach(function (event) {
window.addEventListener(event, resizeAllMasonryItems);
});
waitForImages();
</script>