FCC Leaderboard - vanilla JS

Developer
Size
2,546 Kb
Views
4,048

How do I make an fcc leaderboard - vanilla js?

What is a fcc leaderboard - vanilla js? How do you make a fcc leaderboard - vanilla js? This script and codes were developed by Sky on 29 January 2023, Sunday.

FCC Leaderboard - vanilla JS Previews

FCC Leaderboard - vanilla JS - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>FCC Leaderboard - vanilla JS</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="wrapper"> <table class="table"> <thead class="hide"> <tr> <th>#</th> <th class="user">User</th> <th onclick="showData('recent')">Recent</th> <th onclick="showData('alltime')">All Time</th> </tr> </thead> <tbody id="results"></tbody> </table>
</div> <script src="js/index.js"></script>
</body>
</html>

FCC Leaderboard - vanilla JS - Script Codes CSS Codes

body { background-image: -webkit-linear-gradient( 315deg, #3C8CE7 10%, #00EAFF 100%); background-image: linear-gradient( 135deg, #3C8CE7 10%, #00EAFF 100%); font-family: sans-serif; min-height: 100vh; min-width: 280px; padding: 0; max-width: 100%;
}
.table { border-collapse: collapse; margin: 50px auto; max-width: 750px; width: 100%; margin-bottom: 1rem; color: #fff; background-color: #212529;
}
.table thead th { border-bottom-width: 3px; cursor: pointer;
}
.table thead th:nth-child(1),
.table thead th:nth-child(2) { cursor: auto;
}
.table th,
.table td { border: 1px solid #32383e; padding: 0.75rem; vertical-align: middle; text-align: center;
}
.table tbody tr:nth-of-type(odd) { background-color: rgba(255, 255, 255, 0.05);
}
.table tbody tr:hover { background-color: rgba(255, 255, 255, 0.075);
}
.table td a { text-decoration: none; color: inherit;
}
.table td a:hover { text-decoration: underline;
}
.table .user { text-align: left;
}
.table tbody .user:hover { cursor: pointer; text-decoration: underline;
}
.table img { border-radius: 50%; margin-right: 1em; vertical-align: middle; width: 64px;
}
@media (max-width: 500px) { .table img { display: none; }
}
.wrapper { margin-right: auto; margin-left: auto; width: 100%;
}
@media (min-width: 576px) { .wrapper { max-width: 540px; }
}
@media (min-width: 768px) { .wrapper { max-width: 720px; }
}
@media (min-width: 1200px) { .wrapper { max-width: 1140px; }
}

FCC Leaderboard - vanilla JS - Script Codes JS Codes

function showData(data) { let tableHTML = ""; JSON.parse(sessionStorage.getItem(data)).forEach((user, i) => tableHTML += `<tr><td>${i + 1}</td> <td class="user" onclick="window.open('https://freecodecamp.org/${user.username}')"> <img height="64" src="${user.img}">${user.username}</td> <td>${user.recent}</td><td>${user.alltime}</td></tr>` ); results.innerHTML = tableHTML;
}
['alltime', 'recent'].forEach( sort => fetch('https://fcctop100.herokuapp.com/api/fccusers/top/' + sort) .then(res => res.json()) .then(data => sessionStorage.setItem(sort, JSON.stringify(data))) .then(() => {if(sort == 'alltime') showData('alltime')}));
FCC Leaderboard - vanilla JS - Script Codes
FCC Leaderboard - vanilla JS - Script Codes
Home Page Home
Developer Sky
Username skycoder
Uploaded January 29, 2023
Rating 3
Size 2,546 Kb
Views 4,048
Do you need developer help for FCC Leaderboard - vanilla JS?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Sky (skycoder) Script Codes
Create amazing SEO content with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!