fixed video wrapping js

This commit is contained in:
Brandon Mathis 2013-04-04 10:59:18 -05:00
parent 49a27c929d
commit 7dfba9a26e

View File

@ -72,10 +72,10 @@ function addCodeLineNumbers() {
function flashVideoFallback(){ function flashVideoFallback(){
var flashplayerlocation = "/assets/jwplayer/player.swf", var flashplayerlocation = "/assets/jwplayer/player.swf",
flashplayerskin = "/assets/jwplayer/glow/glow.xml"; flashplayerskin = "/assets/jwplayer/glow/glow.xml";
$('video').each(function(video){ $('video').each(function(i, video){
video = $(video); video = $(video);
if (!Modernizr.video.h264 && swfobject.getFlashPlayerVersion() || window.location.hash.indexOf("flash-test") !== -1){ if (!Modernizr.video.h264 && swfobject.getFlashPlayerVersion() || window.location.hash.indexOf("flash-test") !== -1){
video.children('source[src$=mp4]').first().map(function(i, source){ video.children('source[src$=mp4]').first().map(i, function(source){
var src = $(source).attr('src'), var src = $(source).attr('src'),
id = 'video_'+Math.round(1 + Math.random()*(100000)), id = 'video_'+Math.round(1 + Math.random()*(100000)),
width = video.attr('width'), width = video.attr('width'),
@ -92,18 +92,12 @@ function flashVideoFallback(){
} }
function wrapFlashVideos() { function wrapFlashVideos() {
$('object').each(function(object) { $('object').each(function(i, object) {
object = $(object); if( $(object).find('param[name=movie]').length ){
if ( $('param[name=movie]', object).length ) { $(object).wrap('<div class="flash-video">')
var wrapper = object.before('<div class="flash-video"><div>').previous();
$(wrapper).children().append(object);
} }
}); });
$('iframe[src*=vimeo],iframe[src*=youtube]').each(function(iframe) { $('iframe[src*=vimeo],iframe[src*=youtube]').wrap('<div class="flash-video">')
iframe = $(iframe);
var wrapper = iframe.before('<div class="flash-video"><div>').previous();
$(wrapper).children().append(iframe);
});
} }
function renderDeliciousLinks(items) { function renderDeliciousLinks(items) {