-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
146 lines (127 loc) · 5.64 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
const projects = [
{
title: "Super Cool Project",
description:
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce euismod nisl vel eros consectetur tempor a sit amet sem. Integer rhoncus dictum sem. Vestibulum et metus porta dolor molestie volutpat. Curabitur lorem elit, rutrum sed lorem vel, ornare lobortis tellus. Mauris ultricies imperdiet condimentum. Aliquam erat volutpat. ",
},
{
title: "Mildly Cool Project",
description:
"Nullam facilisis nec magna et iaculis. Fusce accumsan maximus nulla, quis fringilla magna bibendum sed. Sed ut blandit ex. Ut fringilla erat eget purus vestibulum, sed viverra orci pretium.",
},
{
title: "Project Super Hot",
description:
"Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Vestibulum elementum sem eget eros consectetur semper. Sed sed diam ac nisi porttitor elementum ac quis felis. Sed lorem tellus, efficitur in eros eu, volutpat semper nisl. In commodo arcu eget enim mattis, quis pulvinar diam iaculis. Suspendisse cursus turpis arcu, rhoncus tristique turpis faucibus sed. Proin vitae ligula et ex posuere gravida. Sed fermentum cursus justo sit amet volutpat. Donec in mi viverra, ultricies diam in, mollis tellus. In suscipit magna quam, sit amet sollicitudin justo tincidunt ac.",
},
{
title: "Sunshine Project",
description:
"Fusce in enim nunc. Morbi vel enim luctus, convallis diam id, lacinia felis. Donec sit amet quam quis velit mattis finibus. In hac habitasse platea dictumst.",
},
{
title: "Best Project",
description:
"Morbi sed scelerisque leo. In pellentesque eget eros eu ullamcorper. Donec pulvinar id metus eget tempus. Ut nec tempor nisl. Ut iaculis a justo ut blandit.",
},
{
title: "Always on HOLD",
description:
"Morbi dignissim eros lorem, in elementum dui placerat at. Phasellus pharetra viverra dolor in tempor. Etiam non odio et ex aliquam iaculis. Phasellus eu orci ligula. Nunc efficitur, mi sit amet porta tempus, enim ligula sollicitudin ipsum, nec dignissim nulla quam eget nisi. Nam auctor, ligula ac vestibulum sodales, sem purus malesuada mauris, sit amet condimentum nunc eros ac risus. Pellentesque placerat velit tempor turpis volutpat consequat. Aliquam facilisis purus ut gravida ultrices. Mauris scelerisque tincidunt neque, id feugiat lacus rhoncus nec. Nullam id ex id magna mattis euismod. Aliquam finibus ipsum vitae purus varius, in congue sapien tempor. Maecenas euismod felis id tellus varius, a fringilla augue porttitor. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nunc egestas rhoncus massa vestibulum laoreet. Ut facilisis a nulla et bibendum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae;",
},
];
const announcements = [
{
title: "Site Maintainence",
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
},
{
title: "Office Event",
description: "Vestibulum et metus porta dolor molestie volutpat. ",
},
{
title: "Updated Privacy Policy",
description: "Mauris ultricies imperdiet condimentum.",
},
];
const trendings = [
{
author: {
username: "tegan",
pfp: "./images/pfp/tegan.png",
},
project: {
name: "World Peach Builder",
},
},
{
author: {
username: "aarkimos",
pfp: "./images/pfp/aarkimos.png",
},
project: {
name: "Super Cool Project",
},
},
{
author: {
username: "kendall",
pfp: "./images/pfp/kendall.png",
},
project: {
name: "Life Changing App",
},
},
{
author: {
username: "Alex",
pfp: "./images/pfp/alex.png",
},
project: {
name: "No traffic Maker",
},
},
];
function createProjectNode(project) {
const referenceNode = document.querySelector("#reference-project-card");
const newProject = referenceNode.cloneNode(true);
newProject.classList.remove("reference-node");
newProject.removeAttribute("id");
newProject.querySelector(".title").innerText = project.title;
newProject.querySelector(".desc").innerText = project.description;
return newProject;
}
function createAnnouncementNode(announcement) {
const referenceNode = document.querySelector("#reference-announcement");
const newAnnouncement = referenceNode.cloneNode(true);
newAnnouncement.classList.remove("reference-node");
newAnnouncement.removeAttribute("id");
newAnnouncement.querySelector(".title").innerText = announcement.title;
newAnnouncement.querySelector(".desc").innerText = announcement.description;
return newAnnouncement;
}
function createTrendingNode(trend) {
const referenceNode = document.querySelector("#reference-trending");
const newTrend = referenceNode.cloneNode(true);
newTrend.classList.remove("reference-node");
newTrend.removeAttribute("id");
// newTrend.setAttribute();
newTrend
.querySelector(".pfp-small")
.setAttribute("src", `${trend.author.pfp}`);
newTrend.querySelector(".title").innerText = "@" + trend.author.username;
newTrend.querySelector(".desc").innerText = trend.project.name;
return newTrend;
}
const projectContainer = document.querySelector(".project-container");
const announcementContainer = document.querySelector(".announcement-container");
const trendingContainer = document.querySelector(".trending-container");
projects.forEach((project) => {
projectContainer.appendChild(createProjectNode(project));
});
announcements.forEach((announcement) => {
announcementContainer.appendChild(createAnnouncementNode(announcement));
});
trendings.forEach((trend) => {
trendingContainer.appendChild(createTrendingNode(trend));
});