Created
October 9, 2014 06:01
-
-
Save chhumsina/f83cbd38c93d7f5c3783 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function( $ ) { | |
$.fn.YoutubeVideo = function (pars) { | |
var feeddiv = $(this); | |
var pubdt; | |
$(this).html("<center>"+pars.loadingtext+"</center>"); | |
$.ajax({type:"GET",url:pars.feedurl+"&max-results="+pars.count,dataType:"jsonp",success:function(yt_data){ | |
feeddiv.html(''); | |
$.each(yt_data.data.items,function(i,entry){ | |
var video_id=entry.id; | |
var video_frame="<iframe width='"+pars.width+"' height='"+pars.height+"' src='http://www.youtube.com/embed/"+video_id+"' frameborder='0' type='text/html'></iframe>"; | |
pubdt=new Date(entry.updated); | |
feeddiv.append('<div class="frame">'); | |
feeddiv.append('<div class="ItemTitle">'+entry.title+' - <span class="ItemDate">'+pubdt.toLocaleDateString()+'</span></div>'); | |
feeddiv.append('<div class="video">'+video_frame+'</div>'); | |
feeddiv.append('</div>'); | |
}) } | |
}); | |
}})( jQuery );// JavaScript Document |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment