aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel Ángel Moreno <mail@migalmoreno.com>2024-05-29 12:22:14 +0200
committerMiguel Ángel Moreno <mail@migalmoreno.com>2024-05-29 12:22:14 +0200
commit180338d61e3bb7fe9de66b1e5513f07897829cc9 (patch)
tree46540feb2a67ead3c1abd8b41826d06f3c7997fa
parent92a53a00af6b71d3705941d5210e9c98818091e5 (diff)
feat: remove javascript assets
-rw-r--r--assets/js/main.js48
1 files changed, 0 insertions, 48 deletions
diff --git a/assets/js/main.js b/assets/js/main.js
deleted file mode 100644
index 53b7886..0000000
--- a/assets/js/main.js
+++ /dev/null
@@ -1,48 +0,0 @@
-const setCopyrightYear = () => {
- document.querySelector(".footer__year").innerHTML = new Date().getFullYear()
-}
-
-const highlightCurrentRoute = () => {
- const routePath = window.location.pathname.split("/").join("")
- for (let el of document.querySelectorAll(".menu-item__link")) {
- const linkPath = el.pathname.split("/").join("")
- if (linkPath === routePath || linkPath && routePath.includes(linkPath)) {
- el.classList.add("menu-item__link--selected")
- }
- }
-}
-
-const setPortfolioMetadata = async () => {
- const API_URL = "https://api.github.com/repos/migalmoreno/"
- const portfolioContainer = document.querySelector(".portfolio")
- if (portfolioContainer) {
- const projectItems = portfolioContainer.querySelectorAll(".project-item")
- const projectItemsStars = []
- for (let project of projectItems) {
- const projectName = project.querySelector(".project-item__title").innerHTML
- const starIcon = project.querySelector(".icon__star")
- try {
- const res = await fetch(API_URL + projectName)
- const data = await res.json()
- if (data) {
- projectItemsStars.push(data.stargazers_count)
- } else {
- starIcon.style.display = "none"
- }
- } catch (err) {
- starIcon.style.display = "none"
- }
- }
- if (projectItemsStars.length > 0) {
- for (let [i, project] of projectItems.entries()) {
- project.querySelector(".project-item__stargazers").innerHTML = projectItemsStars[i]
- }
- }
- }
-}
-
-(() => {
- setCopyrightYear()
- highlightCurrentRoute()
- setPortfolioMetadata()
-})()