JSFiddle - React, Tailwind, and code Playground

by feridcelik

HTML

<script src="http://jquery.lukelutman.com/plugins/flash/jquery.flash.js"></script>
The quick brown fox jumped over this video 
<a href="http://www.youtube.com/watch?v=5qm8PH4xAss&feature=player_embedded">http://www.youtube.com/watch?v=5qm8PH4xAss&feature=player_embedded</a> and then fell into this <a href="http://www.youtube.com/watch?v=lSCSmpV8Nn8&feature=hp_SLN&list=SL">http://www.youtube.com/watch?v=lSCSmpV8Nn8&feature=hp_SLN&list=SL</a>

JavaScript

var yt="http://www.youtube.com/v/";
$("a[href^='http://www.youtube.com/watch?v=']").each(function(){
    
    var key;
    var href =$(this).attr("href");
    var i=href.indexOf("v");
    href=href.substring(i+2,href.length);
    i=href.indexOf("&");
    if(i>-1){
        key=href.substring(0,i);
    }
    href=yt+key;
    $(this).after("<a href='"+href+"' class='video'></a>");

});

$('.video').flash(
    { height: 200, width: 200},
    { version: 8 },
    function(htmlOptions) {
        $this = $(this);
        htmlOptions.src = $this.attr('href');
        $this.before($.fn.flash.transform(htmlOptions));                        
    }
);
$('.video').remove();