add_paper.js 3.93 KB
Newer Older
Joe TS Dell's avatar
Joe TS Dell committed
1
var item_debug
Joe TS Dell's avatar
update    
Joe TS Dell committed
2
3
function addpaper(item) {
  var new_row = document.getElementById("cont_paper")
Patrick's avatar
Patrick committed
4

Joe TS Dell's avatar
update    
Joe TS Dell committed
5
6
7
  if (item === undefined) {

  } else {
Joe TS Dell's avatar
Joe TS Dell committed
8
    item_debug = item
Patrick's avatar
Patrick committed
9
    var authors = "";
Joe TS Dell's avatar
update    
Joe TS Dell committed
10
11
12
13
14
15
    for (var i = 0; i < item.item.authors.length; i++) {
      authors += item.item.authors[i].lastName + ", " + item.item.authors[i].firstName.substring(0, 1) + "., "
      //Do something
    }
    var keywords = "";
    // check if there is keywords in item
Joe TS Dell's avatar
update    
Joe TS Dell committed
16
    if (item.item.keywords !== undefined) {
Joe TS Dell's avatar
update    
Joe TS Dell committed
17
18
      for (var i = 0; i < item.item.keywords.length; i++) {
        keywords += '<span class="badge badge-pill badge-light">' + item.item.keywords[i] + '</span>'
Patrick's avatar
Patrick committed
19
        //Do something
Joe TS Dell's avatar
update    
Joe TS Dell committed
20
      }
Patrick's avatar
Patrick committed
21
    }
Joe TS Dell's avatar
update    
Joe TS Dell committed
22

Patrick's avatar
Patrick committed
23
    authors = authors.substring(0, authors.length - 2);
Joe TS Dell's avatar
Joe TS Dell committed
24
25
    last_item = item
    var PDF_HTML = ''
Patrick's avatar
Patrick committed
26
    if ('pdf' in item.links) { // to be replaced by if (item.YouTubelink) or so...
Joe TS Dell's avatar
Joe TS Dell committed
27

Joe TS Dell's avatar
Joe TS Dell committed
28
29
30
31
32
33
34
35
      var pdf_link = item.links.pdf // to be replaced by item.pdf_link or so...
      PDF_HTML = `<a type="button" href="${pdf_link}" class="btn btn-outline-success btn-circle" target="_blank">  <i class="far fa-file-pdf"> </i></a>  PDF `
    }

    var UrlHTML = ''
    if ('url' in item.links) { // to be replaced by if (item.YouTubelink) or so...
      var url = item.links.url // to be replaced by item.pdf or so...
      UrlHTML = `<a type="button" href="${url}" class="btn btn-outline-info btn-circle" target="_blank"> <i class="fas fa-globe"></i> </a> Link `
Patrick's avatar
Patrick committed
36
37
    }
    // Do Authors and Keywords
Joe TS Dell's avatar
Joe TS Dell committed
38
    var doi = ""
Joe TS Dell's avatar
update    
Joe TS Dell committed
39
    if ('journal' in item.item) {
Joe TS Dell's avatar
Joe TS Dell committed
40
41
42
43
44
45
      doi += '<small class="text-muted"> '
      doi += item.item.conference.name && item.item.journal.name != "" ? item.item.journal.name + ' ' : ""
      doi += item.item.conference.volume && item.item.journal.volume != "" ? item.item.journal.volume + ' ' : ""
      doi += item.item.conference.pages && item.item.journal.pages != "" ? item.item.journal.pages + ' ' : ""
      doi += item.item.conference.DOI && item.item.DOI != "" && item.item.DOI != undefined ? item.item.journal.DOI + ' ' : ""
      doi += `</small>`
Patrick's avatar
Patrick committed
46
    }
Joe TS Dell's avatar
update    
Joe TS Dell committed
47
    if ('conference' in item.item) {
Joe TS Dell's avatar
Joe TS Dell committed
48
49
50
51
52
      doi += '<small class="text-muted"> '
      doi += item.item.conference.name && item.item.conference.name != "" ? item.item.conference.name + ' ' : ""
      doi += item.item.conference.date && item.item.conference.date != "" ? item.item.conference.date + ' ' : ""
      doi += item.item.conference.DOI && item.item.conference.DOI != "" ? item.item.conference.DOI + ' ' : ""
      doi += `</small>`
Joe TS Dell's avatar
update    
Joe TS Dell committed
53

Patrick's avatar
Patrick committed
54
    }
Joe TS Dell's avatar
Joe TS Dell committed
55

Patrick's avatar
Patrick committed
56
57

    new_row.innerHTML = new_row.innerHTML + '<div class="card" style="max-width: 1080px;">' +
Joe TS Dell's avatar
update    
Joe TS Dell committed
58
      '<div class="row publication_card g-0">' +
Patrick's avatar
Patrick committed
59
      '<div class="col-md-3">' +
Joe TS Dell's avatar
update    
Joe TS Dell committed
60
61
      '<img src="' + item.item.imageLink + '" alt="..." style="width:100%">' +
      '</div>' +
Patrick's avatar
Patrick committed
62
      '<div class="col-md-9">' +
Joe TS Dell's avatar
update    
Joe TS Dell committed
63
64
65
66
67
68
69
70
71
72
73
74
      '<div class="card-body">' +
      '<h5 class="card-title" style="margin-bottom:0px">' +
      '<small>' + authors + '</small>' +
      '<br>' +
      item.item.title +
      '<br>' +
      '<small>' +
      keywords +
      '</small>' +
      '</h5>' +
      doi +
      '<br>' +
Joe TS Dell's avatar
Joe TS Dell committed
75
      PDF_HTML + ' ' +
Joe TS Dell's avatar
update    
Joe TS Dell committed
76
77
      //BIBTEX BUTTON
      // '<button type="button" class="btn btn-outline-danger btn-circle" data-toggle="collapse" data-target="#bibtex-paper-vision" aria-expanded="false" aria-controls="bibtex-paper-vision"> <i class="fas fa-code"></i> </button>BIB' +
Joe TS Dell's avatar
Joe TS Dell committed
78

Joe TS Dell's avatar
Joe TS Dell committed
79
      UrlHTML +
Joe TS Dell's avatar
update    
Joe TS Dell committed
80
      '</small>' +
Joe TS Dell's avatar
update    
Joe TS Dell committed
81
82
83
84
85
86
87
88
89
90

      // BIBTEX area
      // '<pre id="bibtex-paper-vision" class="pre-style collapse">@article{santhanavanich20203d,' +
      // 'title={3D SAFE ROUTING NAVIGATION APPLICATION FOR PEDESTRIANS AND CYCLISTS BASED ON OPEN SOURCE TOOLS.},' +
      // 'author={Santhanavanich, T and Wuerstle, P and Silberer, J and Loidl, V and Rodrigues, P and Coors, V},' +
      // 'journal={ISPRS Annals of Photogrammetry, Remote Sensing \& Spatial Information Sciences},' +
      // 'volume={6},' +
      // 'year={2020}' +
      // '}' +
      // '}</pre>' +
Patrick's avatar
Patrick committed
91
      '</div>' +
Joe TS Dell's avatar
update    
Joe TS Dell committed
92
93
94
      '</div>' +
      '</div>' +
      '</div>'
Patrick's avatar
Patrick committed
95

Joe TS Dell's avatar
update    
Joe TS Dell committed
96
97
  }
}