Created
June 18, 2015 23:39
-
-
Save judell/61ddc4670487c542a368 to your computer and use it in GitHub Desktop.
CORS Sample
This file contains hidden or 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
<html> | |
<head> | |
<title>urls recently annotated with hypothesis</title> | |
<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.2.min.js"></script> | |
<style> | |
body { margin-left: .5in; margin-top:.25in; font-family:verdana; word-break:break-word; font-size:11pt } | |
a { color: gray } | |
#widget { width: 50%; padding:8px; border-width:thin; border-style:solid } | |
</style> | |
</head> | |
<body> | |
<div id="widget"> | |
<h1>urls recently annotated with hypothesis</h1> | |
</div> | |
<script> | |
function load() { | |
$.get( "https://hypothes.is/api/search", function( data ) | |
{ process(data['rows']);}); | |
} | |
function process(rows) { | |
var o = new Object(); | |
for ( i=0; i < rows.length; i++ ) { | |
row = rows[i]; | |
uri = row['uri']; | |
if ( uri in o ) | |
o[uri] += 1; | |
else | |
o[uri] = 1; | |
} | |
for (key in o) { | |
$('#widget').append('<p><a href="https://via.hypothes.is/' + key + '">' + key + '</a> (' + o[key] + ')</p>'); | |
} | |
} | |
load(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment