-
Notifications
You must be signed in to change notification settings - Fork 18
/
index.html
79 lines (69 loc) · 2.33 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html" charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="An algorithmic list of movies that look popular by a numeric heuristic">
<title>Popular Movies</title>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.min.css" rel="stylesheet">
<style>
body {
font-family: 'Open Sans', sans-serif;
padding-top: 15px;
}
.poster {
margin-bottom: 25px;
text-align: center;
}
.poster a {
display: block;
}
.poster img {
border-radius: 5px;
}
</style>
</head>
<body>
<div class="container">
<h2>Popular Movies</h2>
<h4>
An algorithmic list of movies that look popular by a numeric heuristic.
</h4>
<p>
<a class="button button-primary" href="https://s3.amazonaws.com/popular-movies/movies.json">JSON List</a>
<a class="button" href="https://github.com/sjlu/popular-movies" target="_blank">GitHub</a>
</p>
<hr />
<div id="posters" class="row">
</div>
</div>
<script id="poster-template" type="text/x-handlebars-template">
<div class="poster four columns">
<a href="{{link}}"><img src="{{url}}" class="u-max-full-width" /></a>
</div>
</script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/3.0.3/handlebars.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var posterTemplate = Handlebars.compile($('#poster-template').html());
var movies = $.get('https://popular-movies-data.stevenlu.com/movies.json', function(data) {
var currentRow, i;
for (i = 0; i < data.length; i++) {
var movie = data[i];
if (!(i % 3)) {
$('#posters').append(currentRow);
currentRow = $('<div class="row">');
}
currentRow.append(posterTemplate({
url: movie.poster_url,
link: "http://www.imdb.com/title/" + movie.imdb_id + "/"
}));
}
$('#posters').append(currentRow);
});
});
</script>
</body>
</html>