Skip to content

Commit 7daf63d

Browse files
committed
added back trailing slash
after consideration, removing the trailing slash is kinda wrong since I am using directories to serve my static pages, so I remove the js I used to delete the slash and updated how the modules update data based on the url
1 parent cb510bf commit 7daf63d

File tree

4 files changed

+6
-11
lines changed

4 files changed

+6
-11
lines changed

index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ <h3 class="sectionName">Projects</h3>
214214
<div class="back">
215215
<div class="info">
216216
<a href="https://github.com/GeorgesCoding/Minesweeper" target="_blank" class="fa fa-github" id="icon"></a>
217-
<a href="./projects/minesweeper/index.html"><button class="learnMore">Learn More</button></a>
217+
<a href="./projects/minesweeper"><button class="learnMore">Learn More</button></a>
218218
<p>C++</p>
219219
</div>
220220
<div id="minesweeperText" class="text"></div>

main.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import wait from "./src/modules/wait.js";
22
import konamiCode from "./src/modules/effects.js";
33

4-
5-
// remove trailing slash from url
6-
window.history.pushState('', '', location.pathname.slice(0, -1));
7-
84
///////////////////////////////////////////////////////////////////////
95
///// dynamically load modules depending on the current directory /////
106
///////////////////////////////////////////////////////////////////////
@@ -43,7 +39,7 @@ if (window.location.pathname == "/") {
4339
konamiCode();
4440
}
4541
// projects directory
46-
else if (window.location.pathname == "/projects") {
42+
else if (window.location.pathname == "/projects/") {
4743
import("./src/modules/load-data.js").then((load) => {
4844
load.summary(false);
4945
load.copyright();
@@ -57,7 +53,7 @@ else if (window.location.pathname == "/projects") {
5753
else if (window.location.pathname.includes("/projects/")) {
5854
import("./src/modules/load-data.js").then((load) => {
5955
load.template()
60-
load.project(window.location.pathname);
56+
load.project(window.location.pathname.slice(0, -1));
6157
load.copyright();
6258
load.navbar();
6359
load.showNav();

src/data/project-param.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"name": "Minesweeper",
4949
"tools": "C++",
5050
"github": "https://github.com/GeorgesCoding/Minesweeper",
51-
"description": "The retro game Minesweeper is built using C++ and played on your terminal. Each action (mark, reveal) uses bitwise operations to change the state of the board. An instance of the board is dynamically allocated and deleted from memory once the game is over. To start the game, double-click the Minesweeper.exe and your machine should automatically begin a terminal with the game initialized and ready to play. This project was the first challenging C++ project we were given in our engineering programming course but despite the difficulty being substantially higher than the previous assignments, the end result was very satisfying to see. Below is a download button for the game that will enable you to play in your computer's terminal",
51+
"description": "The retro game Minesweeper built using C++ and played on your terminal. Each action (mark, reveal) uses bitwise operations to change the state of the board. An instance of the board is dynamically allocated and deleted from memory once the game is over. To start the game, double-click the Minesweeper.exe and your machine should automatically begin a terminal with the game initialized and ready to play. This project was the first challenging C++ project we were given in our engineering programming course but despite the difficulty being substantially higher than the previous assignments, the end result was very satisfying to see. Below is a download button for the game that will enable you to play in your computer's terminal",
5252
"download": "/assets/downloads/Minesweeper.exe",
5353
"video": "/assets/videos/minesweeper-demo.mp4"
5454
},

src/modules/load-data.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ export function template() {
522522

523523
let request = new XMLHttpRequest();
524524

525-
request.open('GET', '../src/template', true);
525+
request.open('GET', '../../src/template', true);
526526

527527
request.onload = function () {
528528
if (request.status >= 200 && request.status < 400) {
@@ -538,7 +538,6 @@ export function template() {
538538

539539
// adds text and media into template file
540540
export async function project(projectName) {
541-
542541
let num = getProjectNum(projectName);
543542
const projectParam = [param.chess, param.breathalyzer, param.blackjack, param.calculator, param.minesweeper, param.pHsensor, param.portfolio];
544543
let project = projectParam[num];
@@ -757,7 +756,7 @@ export function copyright() {
757756
})
758757

759758
// check console
760-
fetch("../assets/pictures/capybara.txt")
759+
fetch("../../assets/pictures/capybara.txt")
761760
.then((res) => res.text())
762761
.then((text) => {
763762
console.log(text)

0 commit comments

Comments
 (0)