youtube.js: make it work with thread expand etc.

This commit is contained in:
czaks 2013-07-20 18:25:58 -04:00
parent ede654cbd8
commit d31be1958d

View File

@ -24,12 +24,20 @@
onready(function(){ onready(function(){
$('div.video-container a').click(function() { var do_embed_yt = function(tag) {
var videoID = $(this.parentNode).data('video'); $('div.video-container a', tag).click(function() {
var videoID = $(this.parentNode).data('video');
$(this.parentNode).html('<iframe style="float:left;margin: 10px 20px" type="text/html" width="360" height="270" src="//www.youtube.com/embed/' + videoID + '?autoplay=1" frameborder="0"/>'); $(this.parentNode).html('<iframe style="float:left;margin: 10px 20px" type="text/html" width="360" height="270" src="//www.youtube.com/embed/' + videoID + '?autoplay=1" frameborder="0"/>');
return false; return false;
}); });
};
do_embed_yt(document);
// allow to work with auto-reload.js, etc.
$(document).bind('new_post', function(e, post) {
do_embed_yt(post);
});
}); });