-
Notifications
You must be signed in to change notification settings - Fork 3
/
example3.html
57 lines (48 loc) · 1.81 KB
/
example3.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Select multiple videos | YoutubePicker</title>
<style type="text/css">
form{ margin: 20px }
h1{ color: #666; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif }
input{ padding: 10px; border: 1px solid #CCC; color: #cc181e; outline: none }
img{ border: 0 }
#my-videos{ width: 50%; padding: 10px 0 }
.item{ display: inline-block; margin-right: 20px }
.remove{ cursor: pointer; text-align: right }
</style>
<!-- jquery -->
<script type="text/javascript" src="../node_modules/jquery/dist/jquery.js"></script>
<!-- nanoscroller -->
<link rel="stylesheet" type="text/css" href="../node_modules/nanoscroller/bin/css/nanoscroller.css">
<script type="text/javascript" src="../node_modules/nanoscroller/bin/javascripts/jquery.nanoscroller.js"></script>
<!-- youtubepicker -->
<link rel="stylesheet" type="text/css" href="../dist/css/youtubepicker.css">
<script type="text/javascript" src="../dist/js/youtubepicker.js"></script>
</head>
<body>
<form>
<h1>Select multiple videos</h1>
<input type="text" name="video" id="yp" placeholder="Search video">
<div id="my-videos"></div>
</form>
<script type="text/javascript">
$(function(){
$('#yp').youtubepicker()
.on('itemSelected', function(ev, data){
var item = '<div class="item"><div class="remove">×</div>' +
'<a href="http://www.youtube.com/watch?v='+data.vid+'" target="_blank" title="'+data.title+'">' +
'<img src="http://i.ytimg.com/vi/'+data.vid+'/default.jpg"></a>' +
'<input type="hidden" name="videos[]" value="'+data.vid+'">' +
'</div>';
$('#my-videos').append(item);
});
$(document).on('click', '.remove', function(ev){
ev.preventDefault();
$(this).parent().remove();
});
});
</script>
</body>
</html>