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
var news; | |
function load () { | |
d3.json("#path/feed.json", function(data){ | |
//Everything here will be executed once the data has arrived. | |
news = data; | |
news.map( function(newsItem) { | |
//do the treatment for each newsItem here. |
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
var vishna = (function() { | |
var urls = { //API urls | |
news : "http://hndroidapi.appspot.com/news/format/json/page/?appid=vishna&callback=?", | |
ask : "http://hndroidapi.appspot.com/ask/format/json/page/?appid=vishna&callback=?", | |
newest: "http://hndroidapi.appspot.com/newest/format/json/page/?appid=vishna&callback=?", | |
best : "http://hndroidapi.appspot.com/best/format/json/page/?appid=vishna&callback=?" | |
}, | |
thread = /^(item[?]id[=][0-9]+)/, //regexp for HN thread posts | |
w = Math.max( $(window).width() * 0.85, 960 ), //width |