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

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

  } else {
Patrick's avatar
Patrick committed
7
8

    var authors = "";
Joe TS Dell's avatar
update    
Joe TS Dell committed
9
10
11
12
13
14
    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
15
    if (item.item.keywords !== undefined) {
Joe TS Dell's avatar
update    
Joe TS Dell committed
16
17
      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
18
        //Do something
Joe TS Dell's avatar
update    
Joe TS Dell committed
19
      }
Patrick's avatar
Patrick committed
20
    }
Joe TS Dell's avatar
update    
Joe TS Dell committed
21

Patrick's avatar
Patrick committed
22
23
24
25
26
27
    authors = authors.substring(0, authors.length - 2);
    // Prepare YouTube Link
    // var array_contains_youtube = true
    var YouTubeHTML = ''
    if ('pdf' in item.links) { // to be replaced by if (item.YouTubelink) or so...
      var YouTubelink = item.links.youtube // to be replaced by item.YouTubelink or so...
Joe TS Dell's avatar
update    
Joe TS Dell committed
28
      YouTubeHTML = `<button type="button" href="${YouTubelink}" class="btn btn-outline-info btn-circle"> <i class="fas fa-globe"></i> </button>Link`
Patrick's avatar
Patrick committed
29
30
31
    }
    // Do Authors and Keywords
    var doi
Joe TS Dell's avatar
update    
Joe TS Dell committed
32
    if ('journal' in item.item) {
Patrick's avatar
Patrick committed
33
      doi = '<small class="text-muted"> ' + item.item.journal.name + ',' +
Joe TS Dell's avatar
update    
Joe TS Dell committed
34
        item.item.journal.volume + ', ' + item.item.journal.pages + ', ' + item.item.DOI
Patrick's avatar
Patrick committed
35
    }
Joe TS Dell's avatar
update    
Joe TS Dell committed
36
37
38
    if ('conference' in item.item) {
      doi = '<small class="text-muted"> ' + item.item.conference.name + ',' + item.item.conference.date + ', ' + item.item.DOI

Patrick's avatar
Patrick committed
39
40
41
42
43
44
    }
    // Prepare Explore Link
    // var array_contains_explore_link = true
    var ExploreHTML = ''
    if ('demo' in item.links) { // to be replaced by if (item.YouTubelink) or so...
      var ExploreLink = item.links.demo // to be replaced by item.ExploreLink or so...
Joe TS Dell's avatar
update    
Joe TS Dell committed
45
      ExploreHTML = `<button type="button" href="${ExploreLink}" class="btn btn-outline-success btn-circle">  <i class="far fa-file-pdf"> </i></button>PDF`
Patrick's avatar
Patrick committed
46
47
48
    }

    new_row.innerHTML = new_row.innerHTML + '<div class="card" style="max-width: 1080px;">' +
Joe TS Dell's avatar
update    
Joe TS Dell committed
49
      '<div class="row">' +
Patrick's avatar
Patrick committed
50
      '<div class="col-md-3">' +
Joe TS Dell's avatar
update    
Joe TS Dell committed
51
52
      '<img src="' + item.item.imageLink + '" alt="..." style="width:100%">' +
      '</div>' +
Patrick's avatar
Patrick committed
53
      '<div class="col-md-9">' +
Joe TS Dell's avatar
update    
Joe TS Dell committed
54
55
56
57
58
59
60
61
62
63
64
65
66
      '<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>' +
      ExploreHTML +
Joe TS Dell's avatar
update    
Joe TS Dell committed
67
68
69
      //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
update    
Joe TS Dell committed
70
71
      YouTubeHTML +
      '</small>' +
Joe TS Dell's avatar
update    
Joe TS Dell committed
72
73
74
75
76
77
78
79
80
81

      // 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
82
      '</div>' +
Joe TS Dell's avatar
update    
Joe TS Dell committed
83
84
85
      '</div>' +
      '</div>' +
      '</div>'
Patrick's avatar
Patrick committed
86

Joe TS Dell's avatar
update    
Joe TS Dell committed
87
88
  }
}