Topic.renderStorylist (idx)
function renders the list of stories for day-pages and assigns the rendered list to res.data.storylist scrollnavigation-links to previous and next page(s) are also assigned to res.data (res.data.prevpage, res.data.nextpage) using this separate renderFunction instead of doing the stuff in storylist_macro() was necessary for completely independent placement of the prevpage- and nextpage-links

  • Parameter Int:
    Index-position to start with
Sourcecode in Topic/renderFunctions.js:
1:   function renderStorylist(idx) {
2:      var size = this.size();
3:      if (idx < 0 || isNaN (idx)|| idx > size-1)
4:         idx = 0;
5:      var max = Math.min (idx+10, size);
6:      this.prefetchChildren(idx, max);
7:      if (idx > 0) {
8:         var sp = new Object();
9:         sp.url = this.href() + "?start=" + Math.max(0, idx-10);
10:        sp.text = getMessage("generic.previousPage");
11:        res.data.prevpage = renderSkinAsString("prevpagelink", sp);
12:     }
13:  
14:     res.push();
15:     var day;
16:     while (idx < max) {
17:        var s = this.get(idx++);
18:        if (s.day != day) {
19:           s.renderSkin("dayheader");
20:           day = s.day;
21:        }
22:        s.renderSkin("preview");
23:     }
24:     res.data.storylist = res.pop();
25:     if (idx < size) {
26:        var sp = new Object();
27:        sp.url = this.href() + "?start=" + idx;
28:        sp.text = getMessage("generic.nextPage");
29:        res.data.nextpage = renderSkinAsString("nextpagelink", sp);
30:     }
31:     return;
32:  }