home.ejs
2 KB
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
<% include ./includes/header.ejs %>
<div style="background-color:#e3f2fd;">
<% var count = 0; %>
<% for (var i in video) { %>
<div style ="color:gray; font-weight:bold; font-size:2.0em; margin-left: 30px; padding-top: 30px">
<%=video[i].category.title%>
</div>
<% for (var j in video[i].videos) { %>
<div id="<%=count%>" vid="<%=video[i].videos[j].video_id%>" style="margin: 30px;">
</div>
<%count++;}; %>
<%};%>
</div>
<style type="text/css">
.masonry-grid img {
max-width: 260px;
}
</style>
<script src="https://unpkg.com/masonry-layout@4/dist/masonry.pkgd.min.js"></script>
<script type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/jquery.imagesloaded/4.1.1/imagesloaded.pkgd.min.js"></script>
<script type="text/javascript">
var $masonry_container = $('#masonry_container');
$masonry_container.imagesLoaded(function () {
$masonry_container.masonry({
itemSelector: '.masonry-grid',
columnWidth: 270
});
});
</script>
<script>
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var player;
var players = [];
var videoIds = [];
for (var i = 0; i < 30; i++) {
players.push(String(i));
videoIds.push($('#' + players[i]).attr('vid'));
}
function onYouTubeIframeAPIReady() {
for (var i = 0; i < videoIds.length; i++) {
player = new YT.Player(players[i], {
height: '360',
width: '640',
videoId: videoIds[i],
});
}
}
</script>
<% include ./includes/footer.ejs %>