-
Notifications
You must be signed in to change notification settings - Fork 0
/
site.js
52 lines (44 loc) · 1.64 KB
/
site.js
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
---
---
var map = L.map('headerMap', {
scrollWheelZoom: false,
touchZoom: false
}).setView([30.28315869171644, -97.74244308471678], 13);
var baseLayer = L.tileLayer('https://{s}.tiles.mapbox.com/v3/jseppi.ipgbh1ko/{z}/{x}/{y}.png', {
subdomains: 'abcd',
attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors'
});
baseLayer.addTo(map);
function debounce(a,b,c){var d;return function(){var e=this,f=arguments;clearTimeout(d),d=setTimeout(function(){d=null,c||a.apply(e,f)},b),c&&!d&&a.apply(e,f)}}
var debouncedMapResize = debounce(function() {
$('#headerMap').height($('header').height());
map.invalidateSize();
}, 50);
$(window).resize(function () {
debouncedMapResize();
});
debouncedMapResize();
function githubWatchers() {
var watchers = $('.followers');
$.ajax({
url: 'https://api.github.com/repos/' +
'maptime' + '/' +
'{{site.repo}}' + '/subscribers',
dataType: 'jsonp',
success: function(res) {
if (!res.data.length) return;
var template =
"<a class='thumbnail contain' href='http://github.com/<%=login%>' style='background-image:url(<%=avatar_url%>)'>" +
"<span class='popup center fill-light strong small round pad0y pad1x'>" +
"<span class='truncate'><%=login%></span>" +
"</span>" +
"</a>";
var data = _(res.data)
.map(function(i) { return _(template).template(i); })
.reverse()
.join('');
watchers.append(data);
}
});
};
$(githubWatchers);