add_content.js 5.37 KB
Newer Older
Joe TS Dell's avatar
update    
Joe TS Dell committed
1
2
3
var urlKeyword, urlParams;
urlParams = new URLSearchParams(window.location.search);
urlKeyword = urlParams.get('keyword');
Joe TS Dell's avatar
update    
Joe TS Dell committed
4
5
6
7
function addcontent(item) {
  var lang_cont_person = ""
  var lang_keywords = ""
  var new_row = document.getElementById("row_main")
Joe TS Dell's avatar
update    
Joe TS Dell committed
8
  
Joe TS Dell's avatar
update    
Joe TS Dell committed
9
10
  if (item === undefined) {

Joe TS Dell's avatar
update    
Joe TS Dell committed
11
  } else if (urlKeyword == null || (item.item.keywords.includes(urlKeyword))) {
Joe TS Dell's avatar
update    
Joe TS Dell committed
12

Joe TS Dell's avatar
update    
Joe TS Dell committed
13
    
JOE Thunyathep S's avatar
up  
JOE Thunyathep S committed
14
15
    // Prepare YouTube Link
    // var array_contains_youtube = true
Joe TS Dell's avatar
Joe TS Dell committed
16
    
JOE Thunyathep S's avatar
up  
JOE Thunyathep S committed
17
    var description = ""
Joe TS Dell's avatar
update    
Joe TS Dell committed
18
19
20
21
22
23
24
25
    if (lang_setting == "1") {
      description = item.item.description_en
      lang_cont_person = " Contact Person"
      lang_keywords = " Keywords"
    } else if (lang_setting == "2") {
      description = item.item.description_de
      lang_cont_person = " Kontaktperson"
      lang_keywords = " Stichworte"
JOE Thunyathep S's avatar
up  
JOE Thunyathep S committed
26
27
28
    }
    // Prepare Explore Link
    // var array_contains_explore_link = true
Joe TS Dell's avatar
Joe TS Dell committed
29
30
31
    var YouTubeHTML = ''
    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
bug fix    
Joe TS Dell committed
32
      YouTubeHTML = `<a class="btn btn-sm btn-outline-danger mt-1" href="${YouTubelink}" target="_blank"><i class="fab fa-youtube"></i> YouTube</a>`
Joe TS Dell's avatar
Joe TS Dell committed
33
34
    }

JOE Thunyathep S's avatar
up  
JOE Thunyathep S committed
35
    var ExploreHTML = ''
Joe TS Dell's avatar
Joe TS Dell committed
36
37
    if ('demo' in item.links) { 
      var ExploreLink = item.links.demo 
Joe TS Dell's avatar
fix bug    
Joe TS Dell committed
38
      ExploreHTML = `<a class="btn btn-sm btn-outline-secondary mt-1" href="${ExploreLink}" target="_blank"> <i class="fas fa-search"></i> Explore</a>`
Joe TS Dell's avatar
Joe TS Dell committed
39
40
41
42
43
    }

    var publicationHTML = ''
    if ('publication' in item.links) {
      var publicationLink = item.links.publication 
Joe TS Dell's avatar
fix bug    
Joe TS Dell committed
44
      publicationHTML = `<a class="btn btn-sm btn-outline-primary mt-1" href="${publicationLink}" target="_blank"> <i class="fas fa-book"></i> Publication</a>`
JOE Thunyathep S's avatar
up  
JOE Thunyathep S committed
45
    }
Joe TS Dell's avatar
update    
Joe TS Dell committed
46
47
48
    var projectHTML = ''
    if ('project' in item.links) {
      var projectLink = item.links.project 
Joe TS Dell's avatar
fix bug    
Joe TS Dell committed
49
      projectHTML = `<a class="btn btn-sm btn-outline-success mt-1" href="${projectLink}" target="_blank"> <i class="fas fa-project-diagram"></i> Project</a>`
Joe TS Dell's avatar
update    
Joe TS Dell committed
50
51
52
53
    }
    var presentationHTML = ''
    if ('presentation' in item.links) {
      var presentationLink = item.links.presentation 
Joe TS Dell's avatar
fix bug    
Joe TS Dell committed
54
      presentationHTML = `<a class="btn btn-sm btn-outline-warning mt-1" href="${presentationLink}" target="_blank"> <i class="fas fa-file-powerpoint"></i> Presentation</a>`
Joe TS Dell's avatar
update    
Joe TS Dell committed
55
    }
JOE Thunyathep S's avatar
up  
JOE Thunyathep S committed
56
57

    new_row.innerHTML = new_row.innerHTML + '<div class="col-lg-4">' +
Joe TS Dell's avatar
update    
Joe TS Dell committed
58
      '<div class="card mb-4 shadow-sm extension overflow-auto">' +
Joe TS Dell's avatar
Joe TS Dell committed
59
      '<h5>' + item.item.title + ' <span class="content-subtitle text-muted"> ' + item.item.project + '</span></h5>' +
JOE Thunyathep S's avatar
up  
JOE Thunyathep S committed
60
61
      '<img class="thumbimg" src="' + item.item.imageLink + '" alt="">' +
      '<div class="card-body">' +
Joe TS Dell's avatar
update    
Joe TS Dell committed
62
63
64
65
66
67
68
69
      '<p class="card-text-lg small">' +
      description +
      '<br>' +
      '<b><i class="fas fa-user"></i>' + lang_cont_person + '</b>: <a ' +
      ' href="' + item.item.author.hftURL + '" target ="_blank"> ' + item.item.author.firstName +
      ' ' + item.item.author.lastName + '</a> <br>' +
      '<b><i class="fas fa-star"></i>' + lang_keywords + '</b>: ' + item.item.keywords.join(', ') + '</br>' +
      ExploreHTML + '&nbsp;' +
Joe TS Dell's avatar
Joe TS Dell committed
70
71
      YouTubeHTML + '&nbsp;' +
      publicationHTML + '&nbsp;' +
Joe TS Dell's avatar
update    
Joe TS Dell committed
72
73
      projectHTML + '&nbsp;' +
      presentationHTML + '&nbsp;' +
Joe TS Dell's avatar
update    
Joe TS Dell committed
74
      '</p>' +
JOE Thunyathep S's avatar
up  
JOE Thunyathep S committed
75
      '</div>' +
Joe TS Dell's avatar
update    
Joe TS Dell committed
76
77
78
      '</div>' +
      '</div>'
  }
Patrick's avatar
Patrick committed
79
}
Joe TS Dell's avatar
update    
Joe TS Dell committed
80
81
82
83
84
85
86

function replaceUmlauts(value) {

  value = value.replace('ä', 'ae');
  value = value.replace('ö', 'oe');
  value = value.replace('ü', 'ue');
  return value;
JOE Thunyathep S's avatar
up  
JOE Thunyathep S committed
87
88
}

Patrick's avatar
Patrick committed
89

Joe TS Dell's avatar
update    
Joe TS Dell committed
90
91
92
93
94
95
function addTeam(item) {
  var new_row = document.getElementById("team-section")
  if (item === undefined) {

  } else {

Joe TS Dell's avatar
Joe TS Dell committed
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
    var optional_profile_url_link = ``
    if ('optional' in item) {
      if ('researchGateURL' in item.optional) {
        if (item.optional.researchGateURL !== "") {
          optional_profile_url_link += `<a class="p-2 fa-lg" href="${item.optional.researchGateURL}" target="_blank">
          <i class="fab fa-researchgate"></i>
        </a>` 
          
        }
      }
      if ('googleScholarURL' in item.optional) {
        if (item.optional.googleScholarURL !== "") {
          optional_profile_url_link += `<a class="p-2 fa-lg" href="${item.optional.googleScholarURL}" target="_blank">
          <i class="fab fa-google"></i>
        </a>`
        }
      }
      if ('LinkedInURL' in item.optional) {
        if (item.optional.LinkedInURL !== "") {
          optional_profile_url_link += `<a class="p-2 fa-lg" href="${item.optional.LinkedInURL}" target="_blank">
          <i class="fab fa-linkedin"></i>
        </a>`
        }
      }
      if (optional_profile_url_link !== "") {
        optional_profile_url_link = `<ul class="list-unstyled mb-0">${optional_profile_url_link}</ul>`
      }
    }
Joe TS Dell's avatar
update    
Joe TS Dell committed
124
    var html_team = `
Joe TS Dell's avatar
up    
Joe TS Dell committed
125
        <div class="col-lg-3 col-md-6 mb-lg-5 mb-5">
Joe TS Dell's avatar
update    
Joe TS Dell committed
126
127
128
129
          <div class="avatar mx-auto">
            <img src="${item.imgUrl}" class="rounded-circle z-depth-1" width="150px">
          </div>
          <h5 class="font-weight-bold mt-4 mb-3">${item.firstName} ${item.lastName}</h5>
Joe TS Dell's avatar
Joe TS Dell committed
130
          <p class="text-uppercase blue-text"><strong>${item.jobTitle_en}</strong></p>
Joe TS Dell's avatar
update    
Joe TS Dell committed
131
132
133
134
          <a href=${item.profile_link} target="_blank">
            <button class="btn btn-primary btn-sm profile">See full profile</button>
          </a>
          <p class="grey-text">Research topic: ${item.researchTopics}</p>
Joe TS Dell's avatar
Joe TS Dell committed
135
          ${optional_profile_url_link}
Joe TS Dell's avatar
update    
Joe TS Dell committed
136
137
138
139
        </div>
    `
    new_row.innerHTML = new_row.innerHTML + html_team
  }
Patrick's avatar
Patrick committed
140
}