Skip to content

Instantly share code, notes, and snippets.

@darkhelmet
Last active September 4, 2015 04:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darkhelmet/265938 to your computer and use it in GitHub Desktop.
Save darkhelmet/265938 to your computer and use it in GitHub Desktop.
<div id='REPLACE-ME-video' class='swfembed' movie='URL' mheight='HEIGHT' mwidth='WIDTH'>Witty comment about needing Javascript goes here...</div>
<object width="853" height="505">
<param name="movie" value="http://www.youtube.com/v/nl-qaTmazB0&hl=en_US&fs=1&hd=1"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="http://www.youtube.com/v/nl-qaTmazB0&hl=en_US&fs=1&hd=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="853" height="505"></embed>
</object>
function(h) {
var html = "<div id='REPLACE-ME-video' class='swfembed' movie='URL' mheight='HEIGHT' mwidth='WIDTH'>Witty comment about needing Javascript goes here...</div>";
var sel = h.selection;
if (null == sel || '' == sel.toString()) {
return html;
}
html = html.replace('WIDTH', /width="(\d+)"/.exec(sel)[1]);
html = html.replace('HEIGHT', /height="(\d+)"/.exec(sel)[1]);
html = html.replace('URL', /src="([^\"]+)"/.exec(sel)[1]);
return html;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment