Look at this magic code. I just added this piece of code to my home page, and meanwhile, I keep a Google Spreadsheet here. At any time, I add a friend into the speadsheet, the link on my homepage gets updated immediately. You can also help yourself to add you into the list by filling in a form. After I confirm, it will be published.
<dl id=friend><dt>Friends</dt></dl>
<script type=”text/javascript”>
function listEntries(json) {
for (var i = 0; i < json.feed.entry.length; i++) {
var dd = document.createElement(“dd”);
var link = document.createElement(“a”);
link.href= json.feed.entry[i].gsx$url.$t;
link.appendChild(document.createTextNode(json.feed.entry[i].gsx$name.$t));
link.title = json.feed.entry[i].content.$t;
dd.appendChild(link);
document.getElementById(‘friend’).appendChild(dd);
}
}
</script>
<script type=”text/javascript” src=”http://spreadsheets.google.com/feeds/list/pSOl_srkuwZXvH3XSagMAdA/default/public/values?alt=json-in-script&callback=listEntries”></script>
I have to say, Google Spreadsheet, and Google Docs is far beyond our imagination. I also found out that I can still write code fluently.
Below is my current friend roll:
- Friends
Note: Above shows both pending and confirmed links, and the links on homepage only shows approved links.