-
-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e755fd4
commit a3d36e7
Showing
11 changed files
with
196 additions
and
2,079 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
|
||
'use strict'; | ||
var e, t; | ||
new function(e) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
const container = document.querySelector('.container'); | ||
const defaultImage = "https://oyepriyansh.pages.dev/i/5nf5fd.png"; | ||
|
||
const loadProfiles = async () => { | ||
let data = await fetch('/data.json'); | ||
let profiles = await data.json(); | ||
|
||
profiles = shuffleArray(profiles); | ||
|
||
profiles.forEach((profile) => { | ||
let profileDiv = document.createElement('div'); | ||
profileDiv.classList.add('profile'); | ||
|
||
let skills = profile.skills.map(skill => `<span class="skill">${skill}</span>`).join(''); | ||
|
||
let social = ''; | ||
|
||
if (profile.github) { | ||
social += ` | ||
<a href="${profile.github}" target="_blank"><i class="fa-brands fa-github"></i></a> | ||
`; | ||
} | ||
|
||
if (profile.twitter) { | ||
social += ` | ||
<a href="${profile.twitter}" target="_blank"><i class="fa-brands fa-x-twitter"></i></a> | ||
`; | ||
} | ||
|
||
if (profile.linkedin) { | ||
social += ` | ||
<a href="${profile.linkedin}" target="_blank"><i class="fa-brands fa-linkedin-in"></i></a> | ||
`; | ||
} | ||
|
||
profileDiv.innerHTML = ` | ||
<div class="pfp"> | ||
<img src="${profile.image}" alt="User Image" onerror="this.onerror=null; this.src='${defaultImage}';"> | ||
</div> | ||
<h3 class="name">${profile.name}</h3> | ||
<div class="skills">${skills}</div> | ||
<div class="social">${social}</div> | ||
`; | ||
|
||
container.append(profileDiv); | ||
}); | ||
}; | ||
|
||
const shuffleArray = (array) => { | ||
for (let i = array.length - 1; i > 0; i--) { | ||
const j = Math.floor(Math.random() * (i + 1)); | ||
[array[i], array[j]] = [array[j], array[i]]; | ||
} | ||
return array; | ||
}; | ||
|
||
loadProfiles(); | ||
|
||
|
||
// dark light mode | ||
|
||
const colorSwitch = document.getElementById("input-toggle-button"); | ||
colorSwitch.addEventListener("click", checkMode); | ||
|
||
const btn = document.querySelector('.add-col'); | ||
|
||
function checkMode() { | ||
console.log("checking..."); | ||
if (colorSwitch.checked) { | ||
console.log("dark on"); | ||
darkModeOn(); | ||
btn.style.color = "black"; | ||
btn.addEventListener('mouseover', () => { | ||
btn.style.color = "white"; | ||
}) | ||
btn.addEventListener('mouseout', () => { | ||
btn.style.color = "black"; | ||
}) | ||
} else { | ||
console.log("dark off"); | ||
darkModeOff(); | ||
btn.style.color = "white"; | ||
btn.addEventListener('mouseout', () => { | ||
btn.style.color = "white"; | ||
}) | ||
|
||
btn.addEventListener('mouseover', () => { | ||
btn.style.color = "white"; | ||
}) | ||
} | ||
} | ||
|
||
function darkModeOn() { | ||
document.body.classList.add("dark-mode"); | ||
} | ||
|
||
function darkModeOff() { | ||
document.body.classList.remove("dark-mode"); | ||
} | ||
|
||
|
||
//search | ||
|
||
searchInput.addEventListener('keyup', () => { | ||
const searchTerm = searchInput.value.trim().toLowerCase(); | ||
|
||
const profiles = document.querySelectorAll('.profile'); | ||
|
||
let visibleProfiles = 0; | ||
|
||
profiles.forEach((profile) => { | ||
const profileName = profile.querySelector('.name').innerText.trim().toLowerCase(); | ||
|
||
if (profileName.includes(searchTerm)) { | ||
profile.style.display = 'flex'; | ||
visibleProfiles++; | ||
} else { | ||
profile.style.display = 'none'; | ||
} | ||
}); | ||
|
||
const noProfileMessage = document.querySelector('.no-profile'); | ||
if (visibleProfiles > 0) { | ||
noProfileMessage.style.display = 'none'; | ||
} else { | ||
noProfileMessage.style.display = 'block'; | ||
} | ||
}); | ||
|
||
// scroll top button | ||
|
||
var fabButton = document.getElementById("backToTopBtn"); | ||
|
||
window.onscroll = function () { | ||
if (window.scrollY > 20) { | ||
fabButton.style.display = "block"; | ||
} else { | ||
fabButton.style.display = "none"; | ||
} | ||
}; | ||
|
||
fabButton.addEventListener("click", function () { | ||
window.scrollTo({ top: 0, behavior: "smooth" }); | ||
}); | ||
|
||
// copyright year | ||
document.getElementById("currentYear").textContent = new Date().getFullYear(); | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters