Найти:
Код: Выделить всё
<script type="text/javascript">
// <![CDATA[
onload_functions.push('apply_onkeypress_event()');
// ]]>
</script>
Код: Выделить всё
<table><tr>
<td class="label">Поиск Youtube:</td><td></td>
<td><input type="text" id="youtube_video" value="Название видео" maxlength="150" class="f_input" onfocus="if(this.value=='Название видео') this.value='';" onblur="if(this.value=='') this.value='Название видео'"/> </td>
<td><input class="fbutton" type="button" id="SearchYoutube" value="Найти видео"></td>
</tr>
</tbody>
</table>
<div id="result" style="text-align: left;"> <script type="text/javascript">
$(document).ready(function(){
$("#SearchYoutube").click(function(){
var youtube_video = $("#youtube_video").val();
var keyword= encodeURIComponent(youtube_video);
var yt_url='http://gdata.youtube.com/feeds/api/videos?q='+keyword+'&format=5&max-results=1&v=2&alt=jsonc';
$.ajax({
type: "GET",
url: yt_url,
dataType:"jsonp",
success: function(response)
{
if(response.data.items)
{
$.each(response.data.items, function(i,data)
{
var video_id=data.id;
var video_title=data.title;
var video_viewCount=data.viewCount;
var video_frame="<iframe width='600' height='385' src='http://www.youtube.com/embed/"+video_id+"' frameborder='0' type='text/html'></iframe>";
var final="<br/><div id='title'>"+video_title+"</div><br/><div>"+video_frame+"</div><br/><input type='text' class='edit bk' style='width:350px;' value='[video]http://youtu.be/"+video_id+"[/video]' />";
$("#result").html(final);
});
}
else
{
$("#result").html("<div id='no'>No Video</div>");
}
}
});
});
});
</script></div>