Created
April 22, 2013 20:17
-
-
Save zackfern/5438140 to your computer and use it in GitHub Desktop.
Display your latest Preserve bookmarks on your personal website!
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
$(function(){ | |
// Loading the latest profile JSON from Preserve. | |
$.getJSON('http://preserve.io/u/zackfern.json', function(data){ | |
var items = []; | |
// How many bookmarks are we going to display? | |
var limit = 4; | |
var bookmarks = 0; | |
$.each(data.user.bookmarks, function(key, bookmark){ | |
if(bookmarks > limit) { | |
return false; | |
} | |
else { | |
bookmarks = bookmarks + 1; | |
items.push('<li><a href="'+ bookmark.url +'">'+ bookmark.title +'</a></li>') | |
} | |
}); | |
$('#bookmarks').html(items.join('')); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment