paper_nextpage.js 1.84 KB
Newer Older
Myriam Guedey's avatar
Myriam Guedey committed
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
var pagenumb = 0
function pagecount(){
pagenumb = pagenumb + max_paper_list
nextpage()
}


function pagecountback(){
pagenumb = pagenumb - (max_paper_list)
if (pagenumb <= 0){
    pagenumb = 0
}
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
    //     }
    // });
    document.getElementById("previousbutton").disabled = false;
    document.getElementById("nextbutton").disabled = false;
    // 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++) {
        if (i >= pagenumb && i < (pagenumb + max_paper_list) && i<= arrayLength){
            // if (Math.abs(arrayLength - i) <= (max_paper_list)) {
            console.log("close to " + i)
            addpaper(stuff_paper[i]);
            var startnumb = pagenumb
            var endnumb = startnumb + max_paper_list
            if (pagenumb <= 0){
                startnumb = 0
                document.getElementById("previousbutton").disabled = true;
            }
            startnumb += 1
            // endnumb += 1
            if (endnumb >= stuff_paper.length){
                endnumb = stuff_paper.length
                document.getElementById("nextbutton").disabled = true;
            }
            document.getElementById("papercount").innerHTML = startnumb + " - " + endnumb  + " (" + stuff_paper.length + ")";
        // }   
    }

        //Do something
    }

    //json_to_bib(stuff_paper)
}