Created
September 10, 2012 20:11
-
-
Save nathancahill/3693530 to your computer and use it in GitHub Desktop.
testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<title>Embedly - Embed - Example</title> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script> | |
<script type="text/javascript" src="../jquery.embedly.js"></script> | |
<style> | |
BODY {background-color:#333333;} | |
#content{background-color:#FFFFFF;margin:0 auto;width:800px;} | |
#embedform {width:600px;margin: 20px auto;} | |
#embedform .url{border:1px solid #AAAAAA;font-size:1.5em;margin:10px 0;padding:5px;width:75%;} | |
#embedform .submit{float:right;font-size:1.7em;margin-top:10px;} | |
#embed {margin:auto;text-align:center;width:600px;} | |
#header{margin:0 auto;width:800px; height:75px;} | |
a img {border:none;} | |
li {list-style:none; margin:20px; } | |
</style> | |
</head> | |
<body> | |
<div id="header"><a href="http://api.embed.ly"><img src="http://static.embed.ly/images/logo.png"/></a></div> | |
<div id="content" class="main"> | |
<form id="embedform" class="main-form"> | |
<input class="url" value="youtube watch filter:links" type="text" /> | |
<input class="submit" type="submit" name="embed" value="Search" /> | |
</form> | |
<ul id="stuff"> | |
</ul> | |
</div> | |
<script> | |
function search_twitter(q){ | |
$.getJSON("http://search.twitter.com/search.json?q="+escape(q)+"&rpp=20&callback=?", function(data){ | |
var arr = new Array(); | |
$.each(data.results, function(index, obj){ | |
$("#stuff LI").remove(); | |
var e=/http:\/\/.*?\s/ig; | |
var p = obj.text.match(e); | |
if (p != null){ | |
var u = p[0].replace(' ', ''); | |
arr.push(u); | |
} | |
}); | |
$.embedly(arr, {maxWidth:500,key : '4d1f889c20ed11e1abb14040d3dc5c07'}, function(oembed){ | |
if (oembed != null) { | |
$("#stuff").append('<li>'+(oembed.code)+'</li>'); | |
} | |
}); | |
}); | |
} | |
$(document).ready(function() { | |
search_twitter("youtube watch filter:links"); | |
$("#embedform").bind('submit', function(e){ | |
e.preventDefault(); | |
var q = $(this).find('.url').val(); | |
if (q == '') | |
return false; | |
search_twitter(q); | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment