/
archive.html
142 lines (123 loc) · 4.18 KB
/
archive.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
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title></title>
<link rel="alternate" type="application/rss+xml" title="XML Feed for Whisper" href="https://adrian3.github.io/whisper/rss.xml" />
<link rel="alternate" title="JSON Feed for Whisper" type="application/json" href="https://adrian3.github.io/whisper/feed.json" />
<link href="https://fonts.googleapis.com/css?family=Vollkorn:400,400i,600,600i" rel="stylesheet">
<link rel="stylesheet" href="https://adrian3.github.io/whisper/_themes/whisper/css/whisper.css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body class="{{bodyclass}}">
<header>
<a class="logo" href="https://adrian3.github.io/whisper/index.html">Whisper</a>
<ul class="nav">
<li><a href="https://adrian3.github.io/whisper/setup.html">Setup</a></li>
<li><a href="https://adrian3.github.io/whisper/dropbox.html">Dropbox</a></li>
<li><a href="https://adrian3.github.io/whisper/archive.html">Blog</a></li>
</ul>
</header>
<div class="container">
<style media="screen">
.active {
text-decoration: underline;
}
.column1,
.column2 {
float:left;
}
.column1 {
width: 66%;
padding-right: 20px;
}
.column2 {
margin-top: 58px;
width: 33%;
}
</style>
<section>
<div class="column1">
<h2>Posts: </h2>
<div class="posts"></div>
</div>
<div class="column2">
<h4>Categories: </h4>
<div class="categories"></div>
</div>
</section>
<script type="text/javascript">
function formatDate(d){
var date = Date.parse(d, "Y-m-d");
date = new Date(d)
var day = date.getDate();
var month = new Array();
month[0] = "Jan";
month[1] = "Feb";
month[2] = "Mar";
month[3] = "Apr";
month[4] = "May";
month[5] = "Jun";
month[6] = "Jul";
month[7] = "Aug";
month[8] = "Sep";
month[9] = "Oct";
month[10] = "Nov";
month[11] = "Dec";
var monthName = month[date.getMonth()];
var year = date.getFullYear();
var seconds = date.getSeconds();
var minutes = date.getMinutes();
var hours = date.getHours();
var time = hours+":"+minutes+":"+seconds;
return monthName+' '+day+', '+year;
}
function filterCategories(category){
$('.postRow').slideUp();
$('.'+category).slideDown();
$('.filter').removeClass("active");
$('.category'+category).addClass("active");
}
function removeSpaces(str){
var cleanVar = str.replace(/\s/g, "");
cleanVar = cleanVar.replace("/", "");
return cleanVar;
}
var categories = "";
var posts = "";
function getPosts() {
$.getJSON('posts.json', function(data) {
// console.log(data);
categories = data.categories;
categories.sort();
posts = data.posts;
for (var i = 0; i < categories.length; i++) {
var row = "<button class='filter category"+removeSpaces(categories[i])+"' onclick='filterCategories(\""+removeSpaces(categories[i])+"\")'>"+categories[i]+"</button>";
$('.categories').append(row);
}
for (var i = 0; i < posts.length; i++) {
var categoryClasses = "";
for (var x = 0; x < posts[i].categories.length; x++) {
categoryClasses += " "+removeSpaces(posts[i].categories[x]);
console.log(posts[i].categories[x]);
}
var row = "<p class='postRow "+categoryClasses+"'><a href='"+posts[i].fileName+"'>"+posts[i].title+"</a><br>";
row += formatDate(posts[i].date_published)+"</p>";
$('.posts').append(row);
}
});
}
getPosts();
</script>
<!-- {{prevNextLinks}} -->
</div>
<footer>
<small style="color: #ccc;">© 2018 | <a style="color: #ccc;" href="https://adrian3.github.io/whisper/humans.txt">humans.txt</a> | <a style="color: #ccc;" href="https://adrian3.github.io/whisper/sitemap.xml">sitemap.xml</a> | <a style="color: #ccc;" href="https://adrian3.github.io/whisper/">powered by a whisper</a></small>
</footer>
<script type="text/javascript">
// {{customJavascript}}
</script>
</body>
</html>