mcornick (owner)

Revisions

gist: 71678 Download_button fork
public
Description:
a demonstration of FeedStitch's JSON support
Public Clone URL: git://gist.github.com/71678.git
Embed All Files: show embed
feedstitch-json-demo.html #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>Feedstitch JSON Demo</title>
    <script src="http://feedstitch.com/reagent/prominent-rubyists.json?variable=feedstitch" type="text/javascript" charset="utf-8"></script>
    <script src="feedstitch-json-demo.js" type="text/javascript" charset="utf-8"></script>
  </head>
 
  <body id="feedstitch-json-demo" onload="render_feed(feedstitch)">
  </body>
 
</html>
 
feedstitch-json-demo.js #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function render_feed(feed) {
  div = document.createElement("div");
  document.getElementById("feedstitch-json-demo").appendChild(div);
 
  list = document.createElement("ul");
  div.appendChild(list);
 
  number_of_entries = 25;
 
  for (i = 0; i < number_of_entries; i = i + 1) {
    entry = feed.group.entries[i];
 
    list_item = document.createElement("li");
    list.appendChild(list_item);
 
    link = document.createElement("a");
    link.setAttribute("href", entry.url);
    link.appendChild(document.createTextNode(entry.filtered_title));
    list_item.appendChild(link);
  }
}