Last active
December 28, 2015 04:59
-
-
Save zsim0n/7446530 to your computer and use it in GitHub Desktop.
Delicious feed widget
Display delicious.com recent posts in a beautified list with iCanHaz.js and moment.js
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
<!-- Dependencies --> | |
<script src="http://codeorigin.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/ICanHaz.js/0.10/ICanHaz.min.js" type="text/javascript"></script> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.4.0/moment.min.js" type="text/javascript"></script> | |
<!-- Small styling for blogger.com --> | |
<style> | |
.delicious-widget { | |
width: 246px; | |
list-style-type: none; | |
padding-left: 0px !important; | |
} | |
</style> | |
<!-- ICanHaz.js template --> | |
<script id="deliciousIchItem" type="text/html"> | |
<li> | |
<a href="{{ u }}">{{ d }}</a> - <time>{{ dt }}</time> | |
</li> | |
</script> | |
<ul id="deliciousWidget" class="delicious-widget"></ul> | |
<!-- One liner. -Note: You can change delicious user and countein the url --> | |
<script type="text/javascript"> | |
$.getJSON("http://feeds.delicious.com/v2/json/szajmon?count=10&callback=?", function (data) { | |
$.each(data, function (i, item) { | |
item.dt = moment(item.dt).fromNow(); //moment.js is here | |
$('#deliciousWidget').append(ich.deliciousIchItem(item)); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment