blob: 1822f041423420e5aaa94b3801ff4c18fd302029 [file] [log] [blame]
Eric Park7f629192021-06-12 15:14:11 +09001$.ajax({
2 type: "GET",
3 url: "https://api.blissroms.org/api/allprojects",
4 contentType: "application/json",
5 datatype: "json",
6 data: {},
7 success: function (data) {
8 var newContent = ''; // Variable to hold HTML
9 for (var i = 0; i < data.length; i++) { // Loop through object
10 if (data[i].project != null) {
11 if (i == 0) {
12 newContent += '<div class="carousel-item active" style="padding-block: 10vh;" >';
13 } else {
14 newContent += '<div class="carousel-item" >';
15 }
16 newContent += '<img class="d-block img-fluid" src="' + data[i].project_avatar + '" style="margin-left: 10%; height: 35vh;"';
17 newContent += 'alt="' + data[i].project + ' " style="padding-top: 1.5rem;"/>';
18 newContent += '<div class="carousel-caption" style="background: linear-gradient(#343a40 10%, #343a40 100%)!important; padding-top: 50vw; width: 50vw; margin-left: 30vw; bottom: 0px ">';
19 // newContent += '<div class="item-details">';
20 newContent += '<h3 class="zxc" ><b style="font-size: xx-large;">' + data[i].project + '</b></h3>';
21 newContent += '<h5 class="zxc" >Project Lead: ' + data[i].project_lead + '</h5>';
22 newContent += '<p class="card__text zxc" style=" margin-right: 1.7rem; margin-left: 1.7rem; ">' + data[i].project_description + '</p>';
23 if (data[i].project_github != null) {
24 newContent += '<a href="' + data[i].project_github + '" target="_blank"><i class="fab fa fa-git p-2" style="font-size: 300%;"></i></a>';
25 }
26 if (data[i].project_website != null) {
27 newContent += '<a href="' + data[i].project_website + '" target="_blank"><i class="fab fa p-2 fa-globe" style="font-size: 300%;"></i></a>';
28 }
29 // newContent += '</div>';
30 newContent += '</div>';
31 newContent += '</div>';
32 } else {
33 newContent = 'NONE';
34 }
35 }
36 // Update the page with the new content
37 document.getElementById('carousel-slider').innerHTML = newContent;
38 },
39 error: function (jqXHR, status, err) {
40 newContent = 'ERROR: NONE';
41 document.getElementById('carousel-slider').innerHTML = newContent;
42 alert("Status: " + textStatus);
43 alert("Error: " + errorThrown);
44 }
45})