-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.js
43 lines (37 loc) · 1.19 KB
/
main.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
const linksSocialMedia = {
github: 'felipe-souza17',
youtube: '',
facebook: '',
twitter: 'flp_souza17',
instagram: 'souza_litz'
}
function changeSocialMediaLinks() {
for (let li of socialLinks.children) {
const social = li.getAttribute('class')
li.children[0].href = `https://${social}.com/${linksSocialMedia[social]}`
}
}
changeSocialMediaLinks()
function getGitHubProfileInfos() {
const url = `https://api.github.com/users/${linksSocialMedia.github}`
fetch(url)
.then(response => response.json())
.then(data => {
userImage.src = data.avatar_url
userName.textContent = data.name
userBio.textContent = data.bio
userLink.src = data.html_url
userLogin.textContent = data.login
})
}
getGitHubProfileInfos()
turn_mode.addEventListener('click', () => {
let bg_card = document.getElementById('bg-card')
let userLink = document.getElementById('userLink')
body.classList.toggle('background')
bg_card.classList.toggle('bg-desktop-light')
userLink.classList.toggle('text-mode')
if (turn_mode.innerHTML.includes('fa-sun'))
turn_mode.innerHTML = '<i class="fas fa-moon"></i>'
else turn_mode.innerHTML = '<i class="fas fa-sun"></i>'
})