forked from formula1/NodeOS-Blog
-
Notifications
You must be signed in to change notification settings - Fork 2
/
bloglist.js
46 lines (44 loc) · 1.15 KB
/
bloglist.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
var listHandler;
jQuery(function($){
var Template = require("template");
var cacheOrUriIterator = require("cache-or-load");
listHandler = new Template(
"script.template.bloglist",
"div.container.bloglist"
);
listHandler._x = {
uri: "https://api.github.com/repos/NodeOS/NodeOS/issues?labels=blog&sort=updated",
last: void(0)
};
cacheOrUriIterator(
"issue-list",
{
timestamp2URI: function(timestamp,next){
var uri = listHandler._x.uri;
if(timestamp) {
var temp = new Date(timestamp+1000);
uri += "&since="+(new Date(timestamp+1000)).toISOString();
}
user.asAuthority(uri,next);
},
prep: function(item, next){
item.timestamp = (new Date(item.updated_at)).getTime();
parseMarkdown(item,next);
},
ready: function(item,next){
listHandler.add(item);
setTimeout(next,1);
},
done: function(date){
listHandler._x.last = date;
},
error: function(error){
if(error.status && error.status === 403){
add403();
}else{
addError(error);
}
}
}
);
});