-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
242 lines (189 loc) · 7.34 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
//calling onload event to lead project list
window.addEventListener('load', (event) => {
displayProjects();
})
const frontend = 1;
const backend = 2;
const fullstack = 3;
//making array object for project list
let ProjectList = [
{
"id": frontend,
"title": "Math operations",
"desc": "This is web application, where user can get result of certain math problem. ",
"hosted_url": "https://spmathoperations.netlify.app/",
"github_url": "https://github.com/sachinprajapati8604/Math-Operatons",
"date": 'July 20, 2021',
"Tech_Stack": "HTML | CSS | Bootstrap | JavaScript",
"Role": "Developer",
},
{
"id": frontend,
"title": "To Do List",
"desc": "Basically a task keeper web project where you can add task and schedule it.",
"hosted_url": "https://sptodos.netlify.app/",
"github_url": "https://github.com/sachinprajapati8604/To-Do-List-JS",
"date": 'July 30, 2021',
"Tech_Stack": "HTML | CSS | JavaScript",
"Role": "Developer",
},
{
"id": frontend,
"title": "Online NotePad",
"desc": "Beautiful responsive online notepad web application where users can write notes and can retrieve them at any time.",
"hosted_url": "https://sponlinenotepad.netlify.app/",
"github_url": "https://github.com/sachinprajapati8604/Online-Notepad",
"date": 'July 27, 2021',
"Tech_Stack": "HTML | CSS | JavaScript",
"Role": "Developer",
},
{
"id": frontend,
"title": "Weather web app",
"desc": "This is web application, provides dynamic weather data like temp, min-max temp, feels like, humidity, pressure, wind speed etc.",
"hosted_url": "https://spweather.netlify.app/",
"github_url": "https://github.com/sachinprajapati8604/Weather_webApp",
"date": 'July 25, 2021',
"Tech_Stack": "HTML | CSS | JavaScript",
"Role": "Developer",
},
{
"id": frontend,
"title": "Tic-Tac-Toe",
"desc": "This is game web application, where any users can play tic tac toe game with me .",
"hosted_url": "https://sachinprajapati8604.github.io/Tic-Tac-Toe-JS/",
"github_url": "https://github.com/sachinprajapati8604/Tic-Tac-Toe-JS",
"date": 'July 12, 2021',
"Tech_Stack": "HTML | CSS | JavaScript",
"Role": "Developer",
},
{
"id": backend,
"title": "BU Book/Paper Website",
"desc": "This web application is complete website for books and paper for Bundelkhand University Student . Student can read or download it. I implemented admin panel to manage website.",
"hosted_url": "http://buepaper.great-site.net/?i=1",
"github_url": "https://github.com/sachinprajapati8604/BuBook/tree/main",
"date": "July 20, 2019",
"Tech_Stack": "HTML | CSS | Bootstrap | JavaScript | PHP | MySQL",
"Role": "Developer",
},
{
"id": backend,
"title": "Urban Kleid Shopping site",
"desc": "This web application is complete shopping site for both side user and admin.Users can buy ,trasaction, order tracking,return/refund , PDF invoice etc.",
"hosted_url": "http://spurbankleid.great-site.net/",
"github_url": "https://github.com/sachinprajapati8604/Urban-Kleid-e-commerce-website",
"date": 'July 20, 2020',
"Tech_Stack": "HTML | CSS | Bootstrap | JavaScript | PHP | MySQL",
"Role": "Developer",
},
{
"id": backend,
"title": "Coding Forum ",
"desc": "This is web application, where users can discuss the problem to each other.",
"hosted_url": "http://spcodeforum.epizy.com/?i=1",
"github_url": "https://github.com/sachinprajapati8604/Urban-Kleid-e-commerce-website",
"date": 'July 20, 2020',
"Tech_Stack": "HTML | CSS | Bootstrap | JavaScript | PHP | MySQL",
"Role": "Developer",
},
]
function displayProjects() {
let main = document.getElementById('projects');
let row = document.getElementById('row');
ProjectList.forEach(element => {
let col = document.createElement('div');
col.className = 'col my-2 ';
col.innerHTML +=
`
<div class="card h-100 my-projectcol">
<div class="card-body">
<h5 class="card-title __h2"> ${element.title} </h5>
<p class="card-text">${element.desc}</p>
<p class="card-text"><b>Role </b> : ${element.Role}</p>
<p class="card-text"><b>Tech Stack </b> : ${element.Tech_Stack}</p>
</div>
<div class="card-footer">
<a href="${element.hosted_url}" target="_blank" class="btn btn-info btn-sm mx-4">Live Demo</a>
<a href="${element.github_url}" target="_blank" class="font-icon"> <i class="fab fa-github"></i> </a>
</div>
</div>
`
row.append(col);
})
main.append(row);
}
/*
applying filter but not working as i want
let filterProject;
function updateFilter() {
let select = document.getElementById('selectUnit');
var option = select.options[select.selectedIndex].value;
if (option === "1") {
//applying filter
filterProject = ProjectList.filter(function fun(el) {
return el.id == 1;
})
console.log(filterProject)
} else if (option === "2") {
filterProject = ProjectList.filter(function fun(el) {
return el.id == 1;
})
console.log(filterProject)
} else {
filterProject = ProjectList;
console.log(filterProject)
}
}
updateFilter();
console.log(filterProject);
*/
//script for contact me form
document.getElementById('contactForm').addEventListener('submit', (e) => {
e.preventDefault();
// console.log("calling")
//get values
let name = getInputVal('name');
let email = getInputVal('email');
let message = getInputVal('message');
let alert = document.querySelector('.myalert');
if (name !== "" && email !== "" && message !== "") {
//adding fire base to store userdata
const response = fetch('https://react-contact-form-5d8e6-default-rtdb.firebaseio.com/contactform.json', {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
name,
email,
message,
}),
})
alert.innerHTML = `Thanks ${name}, Your response has been recieved.`;
alert.style.display = "block";
}
setTimeout(() => {
alert.style.display = "none";
}, 3000);
document.getElementById('contactForm').reset();
})
// funtion to get form values
function getInputVal(id) {
return document.getElementById(id).value;
}
// script for animation on scroll
window.addEventListener('scroll', reveal);
function reveal() {
let reveals = document.querySelectorAll('.reveal');
for (let i = 0; i < reveals.length; i++) {
let windowHeight = window.innerHeight;
let revealTop = reveals[i].getBoundingClientRect().top;
let revealPoint = 150;
if (revealTop < windowHeight - revealPoint) {
reveals[i].classList.add('active');
} else {
reveals[i].classList.remove('active');
}
}
}