-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
205 lines (183 loc) · 8.14 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
---
layout: nolayout
---
<!DOCTYPE html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Chad's Website</title>
<link href="/css/vendor/bootstrap-3.0.1.min.css" rel="stylesheet" />
<link href="/css/vendor/font-awesome-3.2.1.min.css" rel="stylesheet" />
<link href="/css/site.css" rel="stylesheet" />
<link href="http://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic,700italic" rel="stylesheet" />
<script src="/js/vendor/modernizr-2.6.2.min.js"></script>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-xs-12 col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
<header>
<h3 class="page-title"><a href="/">Chad's Website</a></h3>
</header>
<section id="content">
<div class="row">
{% assign postCount = site.posts | size %}
{% if postCount > 0 %}
<div class="col-xs-12">
<div class="panel panel-default">
<div class="panel-heading text-center">Recent blog posts</div>
<div class="panel-body">
<ul class="list-unstyled">
{% for post in site.posts %}
<li>
<a href="{{ post.url }}">{{ post.title }}</a>
<small><abbr class="js-relative-date" data-raw-datetime="{{post.date}}" title="{{ post.date | date: '%B %-d, %Y @ %I:%M %-P' }}">{{ post.date | date: '%B %-d, %Y @ %I:%M %-P' }}</abbr></small>
</li>
{% endfor %}
</ul>
</div>
</div>
</div>
{% endif %}
<div class="col-xs-12">
<div class="panel panel-default">
<div class="panel-heading text-center">Recent bookmarks on Pinboard</div>
<div id="pinboardItems" class="panel-body"></div>
</div>
</div>
<div class="col-xs-12">
<div class="panel panel-default">
<div class="panel-heading text-center">Recent listens via Last.fm</div>
<div id="lastfmItems" class="panel-body"></div>
</div>
</div>
</div>
</section>
<footer>
<div class="text-center page-footer">
<ul class="list-unstyled author-links">
<li><a href="https://github.com/chadxz"><span class="icon-github icon-large"></span><span class="hidden">chadxz on github</span></a></li>
<li><a href="https://twitter.com/chadmcelligott"><span class="icon-twitter icon-large"></span><span class="hidden">@chadmcelligott on twitter</span></a></li>
<li><a href="http://www.linkedin.com/in/chadmcelligott/"><span class="icon-linkedin icon-large"></span><span class="hidden">Chad McElligott on LinkedIn</span></a></li>
</ul>
</div>
</footer>
</div>
</div>
</div>
<script type="text/template" id="pinboard-template">
<ul class="list-unstyled">
<% _.forEach(data, function (item) { %>
<li>
<a href="<%- item.href %>" title="<%- item.description %>"><%- item.description %></a>
<small><abbr title="<%= moment(item.time).format(dateTimeFormat) %>"><%= moment(item.time).fromNow() %></abbr></small>
</li>
<% }); %>
</ul>
<a href="https://pinboard.in/u:chadxz" title="Chad's pinboard">View all bookmarks at pinboard.in</a>
</script>
<script type="text/template" id="lastfm-template">
<ul class="list-unstyled">
<% _.forEach(data, function(item) { %>
<li>
<% item.artist.url = lastfmMusicUrl + item.artist.url.replace(/\s/gi, '+'); %>
<a href="<%- item.artist.url %>" title="<%- item.artist.name %> on Last.fm"><%- item.artist.name %> </a> -
<a href="<%- item.url %>" title="<%- item.name %> on Last.fm"><%- item.name %></a>
<% if (item['@attr'] && item['@attr'].nowplaying) { %>
<small><span class="light">♬</span> now playing <span class="light">♬</span></small>
<% } else { %>
<small><abbr title="<%= moment.unix(item.date.uts).format(dateTimeFormat) %>"><%= moment.unix(item.date.uts).fromNow() %></abbr></small>
<% } %>
</li>
<% }); %>
</ul>
<a href="http://www.last.fm/user/chadxz" title="Chad's Last.fm profile">View listening profile at Last.fm</a>
</script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="/js/vendor/jquery-1.10.2.min.js"><\/script>')</script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.1/js/bootstrap.min.js"></script>
<script>$.fn.modal || document.write('<script src="/js/vendor/bootstrap-3.0.1.min.js"><\/script>')</script>
<script src="/js/vendor/lodash-2.2.1.min.js"></script>
<script src="/js/vendor/moment-2.2.1.min.js"></script>
<script>
;(function () {
var templateOptions, renderPinboardTemplate,
renderLastfmTemplate, refreshCount;
function loadLastfmData(template) {
$.ajax({
type: 'GET',
url: 'http://immense-refuge-7911.herokuapp.com/lastfm?limit=5',
success: function (data) {
var refreshInterval = 30000;
$('#lastfmItems').html(template(data));
// if currently listening to music, periodically refresh this data.
// stop refreshing if no longer 'now playing' for more than 1m30s
if (data[0]['@attr'] && data[0]['@attr'].nowplaying) {
refreshCount = 0;
setTimeout(function () {
loadLastfmData(template)
}, refreshInterval);
} else {
if (refreshCount <= 2) {
refreshCount++;
setTimeout(function () {
loadLastfmData(template)
}, refreshInterval);
}
}
},
error: function () {
$('#lastfmItems').html('<p>the data service is unavailable at this time</p>');
}
});
}
function loadPinboardData(template) {
$.ajax({
type: 'GET',
url: 'http://immense-refuge-7911.herokuapp.com/pinboard?limit=5',
success: function (data) {
$('#pinboardItems').html(template(data));
},
error: function () {
$('#pinboardItems').html('<p>the data service is unavailable at this time</p>');
}
});
}
templateOptions = {
variable: 'data',
imports: {
'moment': moment,
'dateTimeFormat': 'MMMM D, YYYY @ h:mm a',
'lastfmMusicUrl': 'http://www.last.fm/music/'
}
};
renderPinboardTemplate = _.template($('#pinboard-template').html(), null, templateOptions);
renderLastfmTemplate = _.template($('#lastfm-template').html(), null, templateOptions);
$(document).ready(function () {
$('abbr.js-relative-date').each(function () {
var el = $(this),
relativeDate = moment(el.data('raw-datetime')).fromNow();
el.text(relativeDate);
});
loadPinboardData(renderPinboardTemplate);
refreshCount = 3;
loadLastfmData(renderLastfmTemplate);
});
})();
</script>
<script>
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-42018114-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script');
var s = document.getElementsByTagName('script')[0];
ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>