paper_nextpage.js 1.84 KB
Newer Older
Patrick's avatar
Patrick committed
1
2
3
4
5
6
7
8
9
10
var pagenumb = 0
function pagecount(){
pagenumb = pagenumb + max_paper_list
nextpage()
}


function pagecountback(){
pagenumb = pagenumb - (max_paper_list)
if (pagenumb <= 0){
Patrick's avatar
Patrick committed
11
    pagenumb = 0
Patrick's avatar
Patrick committed
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
}
nextpage()   
}


var nextpage = function() {
    // $.getJSON("./content/content.json", function (result) {
    //     stuff = result;
    //     var new_row = document.getElementById("row_main")
    //     new_row.innerHTML = "";
    //     var arrayLength = stuff.length;
    //     for (var i = 0; i < arrayLength; i++) {
    //         addcontent(stuff[i]);
    //         //Do something
    //     }
    // });
Patrick's avatar
Patrick committed
28
29
    document.getElementById("previousbutton").disabled = false;
    document.getElementById("nextbutton").disabled = false;
Patrick's avatar
Patrick committed
30
31
32
33
34
35
    // get paper from the Sabo result
    stuff_paper = jsonContent;
    var new_row = document.getElementById("cont_paper")
    new_row.innerHTML = "";
    var arrayLength = stuff_paper.length;
    for (var i = 0; i < arrayLength; i++) {
Patrick's avatar
Patrick committed
36
        if (i >= pagenumb && i < (pagenumb + max_paper_list) && i<= arrayLength){
Patrick's avatar
Patrick committed
37
38
39
            // if (Math.abs(arrayLength - i) <= (max_paper_list)) {
            console.log("close to " + i)
            addpaper(stuff_paper[i]);
Patrick's avatar
Patrick committed
40
41
42
43
            var startnumb = pagenumb
            var endnumb = startnumb + max_paper_list
            if (pagenumb <= 0){
                startnumb = 0
Patrick's avatar
Patrick committed
44
                document.getElementById("previousbutton").disabled = true;
Patrick's avatar
Patrick committed
45
46
47
48
49
            }
            startnumb += 1
            endnumb += 1
            if (endnumb >= stuff_paper.length){
                endnumb = stuff_paper.length
Patrick's avatar
Patrick committed
50
                document.getElementById("nextbutton").disabled = true;
Patrick's avatar
Patrick committed
51
52
            }
            document.getElementById("papercount").innerHTML = startnumb + " - " + endnumb + " (" + stuff_paper.length + ")";
Patrick's avatar
Patrick committed
53
54
55
56
57
58
        // }   
    }

        //Do something
    }

Patrick's avatar
Patrick committed
59
    //json_to_bib(stuff_paper)
Patrick's avatar
Patrick committed
60
}