mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Added adding of youtube playlists
This commit is contained in:
24
js/search.js
24
js/search.js
@@ -19,8 +19,8 @@ $(document).ready(function()
|
||||
|
||||
$(".search_input").focus();
|
||||
$(".search_input").keyup(function(event) {
|
||||
if (event.keyCode != 40 && event.keyCode != 38 && event.keyCode != 13 && event.keyCode != 39 && event.keyCode != 37) {
|
||||
var search_input = $(this).val();
|
||||
if (event.keyCode != 40 && event.keyCode != 38 && event.keyCode != 13 && event.keyCode != 39 && event.keyCode != 37) {
|
||||
if(search_input.length < 3){$("#results").html("");}
|
||||
if(event.keyCode == 13){
|
||||
search(search_input);
|
||||
@@ -32,6 +32,28 @@ $(document).ready(function()
|
||||
i = 0;
|
||||
timer=100;
|
||||
}
|
||||
}else if(event.keyCode == 13)
|
||||
{
|
||||
//console.log(search_input);
|
||||
//console.log(search_input.split("list=")[1]);
|
||||
pId = search_input.split("list=");
|
||||
if(pId.length > 1)
|
||||
{
|
||||
pListUrl = "http://gdata.youtube.com/feeds/api/playlists/"+pId[1]+"/?format=5&max-results=25&v=2&alt=jsonc";
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: pListUrl,
|
||||
dataType:"jsonp",
|
||||
success: function(response)
|
||||
{
|
||||
console.log(response.data.items);
|
||||
$.each(response.data.items, function(i,data)
|
||||
{
|
||||
submit(data.video.id, data.video.title, true);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user