Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
/* Better YouTube Embeds on Tumblr by Matthew Buchanan http://matthewbuchanan.name/261951286 */ <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript"> $(function() { $("object").each(function() { if ($(this).find("param[value^='http://www.youtube.com']").length > 0) { var parent = $(this).parent(); var youtubeCode = parent.html(); var params = ""; if (youtubeCode.toLowerCase().indexOf("<param") == -1) { $("param", this).each(function() { params += $(this).get(0).outerHTML; }); } var oldOpts = /rel=0/g; var newOpts = "rel=0&color1=0xFFFFFF&color2=0xFFFFFF"; youtubeCode = youtubeCode.replace(oldOpts, newOpts); if (params != "") { params = params.replace(oldOpts, newOpts); youtubeCode = youtubeCode.replace(/<embed/i, params + "<embed"); } parent.html(youtubeCode); } }); }); </script>
This paste will be private.
From the Design Piracy series on my blog: