hail2u (owner)

Revisions

gist: 125223 Download_button fork
public
Public Clone URL: git://gist.github.com/125223.git
backlinks.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
$(function () {
  var t = $("#backlinks").empty();
  $("<p/>").append($("<em/>").append("データを取得中・・・")).appendTo(t);
 
  $.getJSON("http://query.yahooapis.com/v1/public/yql?callback=?", {
    q: "select * from atom where url='http://blogsearch.google.co.jp/blogsearch_feeds?scoring=d&output=atom&num=100&q=link:" + location.href + "'",
    format: "json"
  }, function (data) {
    t.empty();
 
    if (data.query.results && data.query.results.entry) {
      var ul = $("<ul/>");
      $.each(data.query.results.entry, function () {
        var favicon = "http://www.faviconiac.com/favicon/" + this.author.uri.replace(/http:\/\/(.*?)\/.*$/, "$1") + "/";
        $("<li/>").attr({
          style: "list-style-type:image;list-style-image:url(" + favicon + ");"
        }).append($("<a/>").attr({
          href: this.link.href
        }).append("(" + this.published + ") " + this.title.content)).appendTo(ul);
      });
      ul.appendTo(t);
    } else {
      $("<p/>").append("データを取得できませんでした。").appendTo(t);
    }
  });
});