-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
99 lines (93 loc) · 4.17 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
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>SLU Trucks</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<style>
#date { margin-left: 15px; }
.truck img { width: 100%; }
.truck.not-here { opacity: 0.3; }
.truck h4 { width: 100%; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 767px) {
.truck h4 { font-size: 12px; }
}
</style>
</head>
<body>
<nav class="navbar navbar-default">
<div class="container">
<div class="navbar-header">
<a href="#" class="navbar-brand">SLU Trucks <small id="date"></small></a>
</div>
</div>
</nav>
<div class="container">
<div id="trucks" class="row"></div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script>
/*********************************************************************
* #### Twitter Post Fetcher v13.0 ####
* Coded by Jason Mayes 2015. A present to all the developers out there.
* www.jasonmayes.com
* Please keep this disclaimer with my code if you use it. Thanks. :-)
* Got feedback or questions, ask here:
* http://www.jasonmayes.com/projects/twitterApi/
* Github: https://github.com/jasonmayes/Twitter-Post-Fetcher
* Updates will be posted to this site.
*
* Modified by @adilosa. Stripped down to needed functionality only.
*********************************************************************/
window.twitterFetcher = {
callback: function(data) {
tweet = $("<div>" + data.body + "</div>").find('.timeline-Tweet')
.filter(function(tweet) { return $(tweet).find('.timeline-Tweet-retweetCredit').length == 0; } )
.first();
var isTruckHere = /south lake union|slu|amazon|boren|terry|thomas|republican|westlake/.test(
tweet.find('.timeline-Tweet-text').text().toLowerCase()
);
$("#trucks").append(
$("<div></div>")
.addClass('truck ' + (isTruckHere ? 'here' : 'not-here') + ' col-xs-3 col-md-3 col-lg-2')
.append(
$("<a></a>")
.attr({ href: tweet.find('.TweetAuthor-link').attr('href'), target: '_blank' })
.append(
$("<img></img>").attr({ src: tweet.find('.Avatar').data('src-1x').replace("normal", "400x400") })
.addClass('img-rounded')
)
.append($("<h4></h4>").html(tweet.find('.TweetAuthor-name').text()))
)
);
}
};
['ChicknFix', 'FalafelSalam', 'me_sandwich', 'samchoyspoke', 'StellaFiorePizz', 'tatsdeli', 'thaiuup'].forEach(function(id) {
$("head").append(
$("<script><\/script>").attr({
type: 'text/javascript',
src: 'https://cdn.syndication.twimg.com/timeline/profile?&callback=twitterFetcher.callback' +
'&suppress_response_codes=true&rnd=' + Math.random() + '&screen_name=' + id
})
);
});
$(document).ready(function() {
$("#date").text(new Date().toLocaleDateString("en-US", { month: "long", weekday: "long", day: "numeric" }));
if (new Date().getDay() < 1 || new Date().getDay() > 5 || new Date().getHours() < 11 || new Date().getHours() > 15) {
$("#trucks").prepend(
'<div class="alert alert-warning alert-dismissible" role="alert">' +
'<button type="button" class="close" data-dismiss="alert" aria-label="Close">' +
'<span aria-hidden="true">×</span>' +
'</button>' +
'<strong>Warning!</strong> ' +
'You\'re checking this during off-hours, this data is likely stale. Trucks are open weekdays 10-2 PT.' +
'</div>'
);
}
});
</script>
</body>
</html>