-
Notifications
You must be signed in to change notification settings - Fork 0
/
youtube.html
109 lines (103 loc) · 3.11 KB
/
youtube.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
105
106
107
108
109
<!doctype html>
<html>
<head>
<title> Youtube Playlist Generator </title>
<meta charset='utf-8'>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<style>
body {
font-family: helvetica;
/*margin:25px;*/
background-color:#444;
color:#fff;
font-size:90%;
}
a, .nolink{
background:#222;
width:90%;
padding:8px 5%;
/*text-indent:8px;*/
display:block;
border-top:1px solid #111;
border-bottom:1px solid #111;
border-radius:8px;
text-align:center;
}
a:link{color:#fff}
a:visited{color:#fff}
a:hover{color:#FF3C00}
.instructions {
margin: auto;
display:block;
padding:25px;
text-align:center;
}
textarea {
width:80%;
margin: auto;
display:block;
padding:4px;
background:#333;
color:#fff;
border:1px solid #eee;
} textarea:active,textarea:focus {
/*border: 1px solid #FF3300;*/
border: 1px solid #aaa;
}
.create {
margin: auto;
display:block;
background:#333;
color:#fff;
padding:4px;
border-radius:2px;
border:1px solid #aaa;
font-size:110%;
}
#playlistLink {
margin: auto;
display:block;
}
</style>
</head>
<body>
<span class="instructions">Paste a list of Youtube URL's below to create a Playlist...</span>
<textarea name="youtubeUrls" id="youtubeUrls" cols="30" rows="10"></textarea>
<br/><div id="playlistLink"></div><br/>
<button class="create">Create Playlist</button>
<script type="text/javascript">
/*
http://www.youtube.com/watch?v=BuWF4QX8zSo
http://www.youtube.com/watch?v=evuwn_7pdPU
http://www.youtube.com/watch?v=ihwzG5-W8tE
http://www.youtube.com/watch?v=Kevdt1T9daA
http://www.youtube.com/watch?v=fh5yJG7No3w
http://www.youtube.com/watch?v=jBPpT_DtJLM
http://www.youtube.com/watch?v=oKpPd2hDrE4
*/
$('.create').click(function(){
list = $('#youtubeUrls').val().split('\n');
playlist = []
for (str in list) {
str = list[str];
if (str.toLowerCase().includes('youtube.com/watch?v=')) {
str = str.split('youtube.com/watch?v=').slice(-1)[0];
playlist.push(str);
}
if (str.toLowerCase().includes('youtu.be/')) {
str = str.split('youtu.be/').slice(-1)[0];
playlist.push(str);
}
}
if (playlist != [] && playlist !='' ) {
newTab = "target='_blank'"; // If wanted in a new tab //
plStr = "http://www.youtube.com/embed/?playlist="+String(playlist)
console.log(plStr);
$('#playlistLink').html("<a href='"+plStr+"'"+newTab+">"+plStr+"</a>");
} else {
$('#playlistLink').html("<span class='nolink'>Add Some Youtube Links! : )</span>");
}
});
</script>
</body>
</html>