diff options
| author | czaks <marcin@6irc.net> | 2013-07-20 18:25:58 -0400 |
|---|---|---|
| committer | czaks <marcin@6irc.net> | 2013-07-20 18:25:58 -0400 |
| commit | d31be1958de76e5cabc14ddd410287055b6dac0c (patch) | |
| tree | 4ee320f937e227e12cef25d29963d1cc0e0eb808 /js/youtube.js | |
| parent | ede654cbd8cd152c5bca45886981f4dbfca9860a (diff) | |
youtube.js: make it work with thread expand etc.
Diffstat (limited to 'js/youtube.js')
| -rw-r--r-- | js/youtube.js | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/js/youtube.js b/js/youtube.js index ec8c501a..f64d4874 100644 --- a/js/youtube.js +++ b/js/youtube.js @@ -24,12 +24,20 @@ onready(function(){ - $('div.video-container a').click(function() { - var videoID = $(this.parentNode).data('video'); + var do_embed_yt = function(tag) { + $('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); + }); }); |
