Skip to content

Instantly share code, notes, and snippets.

@artgibson
Created December 4, 2012 15:29
Show Gist options
  • Save artgibson/4205162 to your computer and use it in GitHub Desktop.
Save artgibson/4205162 to your computer and use it in GitHub Desktop.
embedly w/ target=blank
<!DOCTYPE>
<html>
<head>
<title>Page Title</title>
<script src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script src="http://scripts.embed.ly/jquery.embedly.min.js"></script>
<script type="text/javascript">
$('document').ready(function(){
var displayFunc = function(oembed, dict){
var _a, elem = $(dict.node);
if (! (oembed) ) { return null; }
elem.replaceWith(oembed.code);
$('div.embed a').attr('target','_blank');
return true;
};
$('div.content').embedly({
maxWidth: 450,
wmode: 'transparent',
method: 'after',
key:'your_embedly_key',
success: displayFunc
});
});
</script>
</head>
<body>
<div class="content">
<article>
<h2>Title</h2>
<p>Lorizzle ma nizzle dolor sit amizzle, brizzle adipiscing elit. </p>
<a href="http://www.youtube.com/watch?v=ZbcgyPtYBY0">youtube</a>
<p>Maecenizzle owned bow wow wow. Nam eros.</p>
</article>
<article>
<h2>Title 2</h2>
<p>Lorizzle ma nizzle dolor sit amizzle, brizzle adipiscing elit. </p>
<a href="http://arstechnica.com/gadgets/2012/12/the-state-of-the-smartphone/">arstechnica</a>
<p>Maecenizzle owned bow wow wow. Nam eros.</p>
</article>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment