-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex-copy.html
104 lines (84 loc) · 3.24 KB
/
index-copy.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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Video Watcher</title>
<link rel="stylesheet" type="text/css" href="lib/bootstrap.css">
</head>
<body>
<div class="container">
<div class="row">
<div class="span12">
<h2 class="page-header">Best Videos Ever ❤
<div class="g-plusone" data-size="medium" data-annotation="none"></div>
<script type="text/javascript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>
<a href="https://twitter.com/share?count=none&hashtags=youtube" class="twitter-share-button" data-lang="en">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</h2>
</div>
</div>
<div class="row">
<div class="span3">
<ul id="videos-list">
</ul>
</div>
<div class="span9" id="video-watcher">
</div>
</div>
<div style="text-align:center; margin-top: 30px; clear:both;">
<a href="http://info.flagcounter.com/nEFy"><img src="http://s04.flagcounter.com/count/nEFy/bg_FFFFFF/txt_000000/border_CCCCCC/columns_2/maxflags_12/viewers_0/labels_0/pageviews_0/flags_0/" alt="Flag Counter" border="0"></a>
</div>
</div>
<script type="text/javascript" src="lib/youtube.js"></script>
<script type="text/javascript" src="lib/jquery.min.js"></script>
<script>
function addVideoToList(video) {
var videoLink = $('<a>');
videoLink.append(video.title);
var linkUrl = videoLink.attr('href');
var thumbnailUrl = youtube.generateThumbnailUrl(video.id);
var thumbnailImg = $('<img>');
thumbnailImg.attr('src', thumbnailUrl);
videoLink.append('<br>');
videoLink.append(thumbnailImg);
videoLink.on('click', function(e) {
e.preventDefault();
var videoTitle = $('<h2>');
videoTitle.html(video.title + ' <small>' + video.uploader + '</small>');
var videoEmbed = $('<iframe></iframe>');
videoEmbed.attr('src', youtube.generateEmbedUrl(video.id));
videoEmbed.attr('width', 560);
videoEmbed.attr('height', 315);
var videoRating = $('<img></img>');
videoRating.attr('src', 'https://chart.googleapis.com/chart?chs=225x125&cht=gom&chd=t:' + (video.rating * 20));
var videoWatcher = $('#video-watcher');
videoWatcher.hide();
videoWatcher.empty();
videoWatcher.append(videoTitle);
videoWatcher.append(videoEmbed);
videoWatcher.append(videoRating);
videoWatcher.fadeIn();
});
var videoItem = $('<li>');
videoItem.append(videoLink);
$('#videos-list').append(videoItem);
}
$.ajax({type: "GET",
url: "https://gdata.youtube.com/feeds/api/videos?q=cats&v=2&alt=jsonc&max-results=3",
dataType: "json",
success: function(data) {
var videos = data['data']['items'];
for (var i = 0; i < videos.length; i++) {
addVideoToList(videos[i]);
}
}
});
</script>
</body>
</html>