add_content.js 1.86 KB
Newer Older
Patrick's avatar
Patrick committed
1
2
3
function addcontent(item){
    var new_row = document.getElementById("row_main")

Joe TS Dell's avatar
Joe TS Dell committed
4
    // Prepare YouTube Link
5
    // var array_contains_youtube = true
Joe TS Dell's avatar
Joe TS Dell committed
6
    var YouTubeHTML = ''
7
8
    if ('youtube' 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
Joe TS Dell committed
9
10
      YouTubeHTML = `<a class="btn btn-sm btn-outline-danger" href="${YouTubelink}">YouTube</a>` 
    }
Patrick's avatar
Patrick committed
11
    var description = ""
Patrick's avatar
Patrick committed
12
    if (lang_setting == "1"){
Patrick's avatar
Patrick committed
13
        description = item.item.description_en
Patrick's avatar
Patrick committed
14
    } else if (lang_setting == "2"){
Patrick's avatar
Patrick committed
15
16
        description = item.item.description_de
    }
Joe TS Dell's avatar
Joe TS Dell committed
17
    // Prepare Explore Link
18
    // var array_contains_explore_link = true
Joe TS Dell's avatar
Joe TS Dell committed
19
    var ExploreHTML = ''
20
21
    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
Joe TS Dell committed
22
23
24
      ExploreHTML = `<a class="btn btn-sm btn-outline-secondary" href="${ExploreLink}">Explore</a>` 
    }

Patrick's avatar
Patrick committed
25
26
27
28
29
30
    new_row.innerHTML = new_row.innerHTML + '<div class="col-lg-4">' +
    '<div class="card mb-4 shadow-sm extension">' +
      '<h5>'+ item.item.title +' <span class="lead text-muted"> ' + item.item.project + '</span></h5>' +
      '<img class="thumbimg" src="' + item.item.imageLink + '" alt="">' +
      '<div class="card-body">' +
        '<p class="card-text-lg small">' +
Patrick's avatar
Patrick committed
31
          description +
Patrick's avatar
Patrick committed
32
33
34
35
          '<br>' +
          '<b><i class="fas fa-user"></i> Contact Person</b>: <a' +
          'href="https://www.hft-stuttgart.de/p/thunyathep-santhanavanich"> ' + item.item.author.firstName +
          ' ' + item.item.author.lastName + '</a> <br>' +
Joe TS Dell's avatar
Joe TS Dell committed
36
37
38
          '<b><i class="fas fa-star"></i> Keywords</b>: ' + item.item.keywords.join(', ') + '</br>' +
        ExploreHTML + '&nbsp;' +
        YouTubeHTML +
Patrick's avatar
Patrick committed
39
40
41
42
43
        '</p>' +
      '</div>' +
    '</div>' +
  '</div>'

44
45
}