forked from khushi-purwar/WebDev-ProjectKart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
117 lines (109 loc) · 3.03 KB
/
app.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
// data is an array which contains info of candidates
const data = [
{
name: "Prottush Negi",
age: 34,
city: "Bengaluru",
language: "C++",
framework: "Node.js",
image: "https://randomuser.me/api/portraits/men/85.jpg",
exp: "10"
},
{
name: "Sohan das",
age: 26,
city: "Kolkata",
language: "Javascript",
framework: "React",
image: "https://randomuser.me/api/portraits/men/84.jpg",
exp: "3"
},
{
name: "Mohan Karamchand",
age: 27,
city: "Chennai",
language: "Java++",
framework: "Angular",
image: "https://randomuser.me/api/portraits/men/45.jpg",
exp: "4"
},
{
name: "Mohd. Zubair",
age: 36,
city: "Delhi",
language: "C#",
framework: "Vue",
image: "https://randomuser.me/api/portraits/men/81.jpg",
exp: "12"
},
{
name: "Anjali Dawar",
age: 38,
city: "Ghaziabad",
language: "Python",
framework: "Django",
image: "https://randomuser.me/api/portraits/men/25.jpg",
exp: "11"
},
{
name: "Anjana Aggarwal",
age: 31,
city: "Gujarat",
language: "C++",
framework: "React",
image: "https://randomuser.me/api/portraits/women/65.jpg",
exp: "8"
},
{
name: "Avantika Tomar",
age: 28,
city: "Lucknow",
language: "Python",
framework: "PHP",
image: "https://randomuser.me/api/portraits/women/48.jpg",
exp: "6"
},
{
name: "Prem Dubey",
age: 40,
city: "West Bengal",
language: "C#",
framework: "Vue",
image: "https://randomuser.me/api/portraits/men/77.jpg",
exp: "13"
},
]
function cvIterator(profiles){
let nxtIndex = 0;
return{
next: function(){
return nxtIndex<profiles.length ?
{value: profiles[nxtIndex++], done: false}:{done: true}
}
}
}
const candidates = cvIterator(data);
cvNext();
// Button listener
const next = document.getElementById("next");
next.addEventListener("click", cvNext);
function cvNext(){
const currentcand = candidates.next().value;
let image = document.getElementById("image");
let profile = document.getElementById("profile");
if(currentcand != undefined){
image.innerHTML = `<img src='${currentcand.image}'>`;
profile.innerHTML = `<ul class="list-group">
<li class="list-group-item">${currentcand.name}</li>
<li class="list-group-item">${currentcand.age} years old</li>
<li class="list-group-item">Currently lives in ${currentcand.city}</li>
<li class="list-group-item">Primarily works on ${currentcand.language}</li>
<li class="list-group-item">with ${currentcand.framework}</li>
<li class="list-group-item">${currentcand.exp} years of experience.</li>
</ul>`;
}
else{
alert("Applications finished.");
window.location.reload();
}
}