added some base code for the blog page nothing fancy
Signed-off-by: rodude123 <rodude123@gmail.com>
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Blog</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script src="/blog/index.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,41 @@
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () =>
|
||||
{
|
||||
goToURL(window.location.pathname);
|
||||
});
|
||||
|
||||
window.addEventListener('popstate', e =>
|
||||
{
|
||||
goToURL(window.history.state);
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* goToURL tries to go to the specified URL if not shows the error page (not yet implemented)
|
||||
* @param {string} url of the page
|
||||
*/
|
||||
function goToURL(url)
|
||||
{
|
||||
// Get the current URL and split it into an array
|
||||
let urlArray = url.split('/');
|
||||
|
||||
let newUrl = "";
|
||||
|
||||
if (urlArray.includes('blog'))
|
||||
{
|
||||
newUrl = url;
|
||||
}
|
||||
|
||||
// Check if the URL is a post page
|
||||
if (urlArray[0] === 'post')
|
||||
{
|
||||
// Create a new URL with the dynamic part
|
||||
newUrl = "/blog/" + url;
|
||||
}
|
||||
|
||||
// Update the URL in the browser without reloading the page
|
||||
window.history.pushState(null, null, newUrl);
|
||||
|
||||
// Get the dynamic part of the URL
|
||||
document.querySelector("#url").innerHTML = decodeURI(urlArray[urlArray.length - 1]);
|
||||
}
|
||||
@@ -83,7 +83,7 @@ a.btn:hover, form input[type="submit"]:hover {
|
||||
}
|
||||
|
||||
a.btnPrimary, form input[type="submit"] {
|
||||
background: var(--primaryDefault);
|
||||
background-color: var(--primaryDefault);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
@@ -654,7 +654,7 @@ function updateProjectItem(id, e)
|
||||
{
|
||||
window.location.href = "./";
|
||||
return;
|
||||
}
|
||||
}ujh
|
||||
|
||||
document.querySelector(`#projError${id}`).classList.remove("hidden");
|
||||
document.querySelector(`#projError${id} div`).innerHTML = updatedProjectImage.error;
|
||||
|
||||
+1
-1
@@ -133,7 +133,7 @@ function getProjectData()
|
||||
</div>
|
||||
<div>
|
||||
<a href="${(json[i]["projectLink"] === "N/A") ? "#" : json[i]["projectLink"]}" class="btn btnPrimary boxShadowIn boxShadowOut"${(json[i]["projectLink"] === "N/A") ? "disabled=\"disabled\"" : ""}>View Project</a>
|
||||
<a href="${(json[i]["githubLink"] === "N/A") ? "#" : json[i]["gitubLink"]}" class="btn btnOutline boxShadowIn boxShadowOut">${(json[i]["githubLink"] === "N/A") ? "disabled=\"disabled\"" : ""}Git</a>
|
||||
<a href="${(json[i]["githubLink"] === "N/A") ? "#" : json[i]["gitLink"]}" class="btn btnOutline boxShadowIn boxShadowOut">${(json[i]["githubLink"] === "N/A") ? "disabled=\"disabled\"" : ""}Git</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ function getProjectData()
|
||||
</div>
|
||||
<div>
|
||||
<a href="${(item["projectLink"] === "N/A") ? "#" : item["projectLink"]}" class="btn btnPrimary boxShadowIn boxShadowOut"${(item["projectLink"] === "N/A") ? "disabled=\"disabled\"" : ""}>View Project</a>
|
||||
<a href="${(item["githubLink"] === "N/A") ? "#" : item["gitubLink"]}" class="btn btnOutline boxShadowIn boxShadowOut">${(item["githubLink"] === "N/A") ? "disabled=\"disabled\"" : ""}Git</a>
|
||||
<a href="${(item["githubLink"] === "N/A") ? "#" : item["gitLink"]}" class="btn btnOutline boxShadowIn boxShadowOut">${(item["githubLink"] === "N/A") ? "disabled=\"disabled\"" : ""}Git</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user