AideRSS PostRank API

·

AideRSS has a PostRank feature, which assigns importance to blog posts based on various metrics. There's a widget that you can embed on your blog to show the highest ranked posts from the last year, month, week, etc which uses the PostRank API.

I don't particularly like embedding third-party Javascript unless absolutely necessary, so here's a jQuery version of the widget that runs locally. The only thing you'll need to edit is the 'feedid' parameter, but you can edit the 'appkey', 'period' and 'num' parameters as well.


<script src="http://www.google.com/jsapi"></script>
<script>google.load("jquery", "1");</script>
<div id="aidewidget"></div>
<script type="text/javascript">
var aiderss = {
  feedid: 4515,
  
  response: function(data){
    var ul = $("#aidewidget").append($("<ul/>")).find("ul");
    
    for (var i = 0, item; item = data[i++];)
      if (item.postrank)
        ul.append($("<li/>").css({listStyle: "none", padding: "3px 0", margin: "0"}).append($("<a/>").attr("href", item.uri).text(item.title).css({ backgroundColor: item.postrank_color, border: "1px solid F90", padding: "1px 5px", textDecoration: "none" })));
    
    ul.parent().append($("<a/>").attr("href", "http://www.aiderss.com/feedid/" + aiderss.feedid).text("More..."));
  },
  
  init: function(){
    $.getJSON("http://api.postrank.com/v1/top_posts/?callback=?", { appkey: "example.com", format: "json", num: 10, period: "month", feed_id: aiderss.feedid }, aiderss.response);
  }
}
$().ready(aiderss.init);
</script>