Skip to content

Commit 7be1c27

Browse files
Bikram GoleBikram Gole
authored andcommitted
Fix cross-page theme persistence and refresh repo profile
1 parent 57052e4 commit 7be1c27

5 files changed

Lines changed: 88 additions & 45 deletions

File tree

README.md

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,57 @@
1-
# Bikram Personal Website
1+
# Bikram Gole - Personal Website
22

3-
Playful dark-themed personal website for **Bikram Gole**.
3+
This is my personal website.
4+
I built it as a chaotic-fun, space-themed profile to show my personality, interests, and coding vibe.
45

5-
## Stack
6+
Live URL: `https://devxtechnic.github.io/bikram-site/`
7+
8+
## What I put in this site
9+
10+
- Multi-page setup: Home, About, Contact
11+
- Theme engine with multiple visual modes
12+
- Persistent theme across all pages
13+
- Mini terminal with commands
14+
- Persona quiz game
15+
- Live GitHub repo cards from `github.com/DevXtechnic`
16+
- Custom interactions, pulse effects, and easter eggs
17+
18+
## Tech stack
619

720
- HTML
821
- CSS
9-
- JavaScript
10-
- GitHub API (to show latest repos)
22+
- Vanilla JavaScript
23+
- GitHub Pages for hosting
24+
- GitHub API for repo fetch
1125

12-
## Pages
26+
## Project structure
1327

14-
- `index.html` - Home + live GitHub repos
15-
- `about.html` - Personal story and profile
16-
- `contact.html` - Email and GitHub links
28+
- `index.html` -> home page
29+
- `about.html` -> profile + identity snapshot
30+
- `contact.html` -> contact links
31+
- `styles.css` -> all styling and themes
32+
- `script.js` -> interactions, effects, terminal, quiz, and theme logic
1733

1834
## Run locally
1935

20-
Open `index.html` directly, or run a local server:
21-
2236
```bash
2337
cd bikram-site
2438
python -m http.server 8000
2539
```
2640

27-
Then open `http://localhost:8000`.
41+
Open `http://localhost:8000`.
2842

2943
## Deploy to GitHub Pages
3044

31-
1. Create a GitHub repo (recommended name: `DevXtechnic.github.io` for user site).
32-
2. Upload all files from this folder to the repo root.
33-
3. On GitHub, go to `Settings -> Pages`.
34-
4. Under `Build and deployment`, set:
35-
- `Source`: `Deploy from a branch`
36-
- `Branch`: `main` and `/ (root)`
37-
5. Save and wait 1-2 minutes.
38-
6. Visit your site URL shown in Pages settings.
45+
1. Push this repo to GitHub.
46+
2. Open repository `Settings -> Pages`.
47+
3. Set `Source` to `Deploy from a branch`.
48+
4. Select branch `main` and folder `/ (root)`.
49+
5. Save and wait for deployment.
3950

40-
If repo name is `DevXtechnic.github.io`, URL will be:
41-
`https://devxtechnic.github.io/`
42-
43-
If repo name is something else (example `bikram-site`), URL will be:
51+
My deployed path is:
4452
`https://devxtechnic.github.io/bikram-site/`
53+
54+
## Notes
55+
56+
- `.nojekyll` is included so GitHub Pages serves files directly without Jekyll processing.
57+
- Theme selection is saved in `localStorage` and synced through URL params for page-to-page consistency.

about.html

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,17 @@
1414
<script>
1515
(() => {
1616
try {
17+
const validThemes = new Set(["neo", "mint", "sunset", "midnight", "ember", "arctic", "grape", "toxic", "ocean", "bloodmoon", "liquidglass", "paper", "blackflag"]);
18+
const themeKey = "neoThemeVariant.v1";
1719
const params = new URLSearchParams(window.location.search);
1820
const urlTheme = params.get("theme");
19-
const savedTheme = window.localStorage.getItem("neoThemeVariant.v1");
20-
if (savedTheme) {
21-
document.body.dataset.theme = savedTheme;
22-
} else if (urlTheme) {
23-
document.body.dataset.theme = urlTheme;
21+
const savedTheme = window.localStorage.getItem(themeKey);
22+
const selected = validThemes.has(urlTheme) ? urlTheme : (validThemes.has(savedTheme) ? savedTheme : null);
23+
if (selected) {
24+
document.body.dataset.theme = selected;
25+
if (selected !== savedTheme) {
26+
window.localStorage.setItem(themeKey, selected);
27+
}
2428
}
2529
} catch (error) {
2630
// ignore

contact.html

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,17 @@
1414
<script>
1515
(() => {
1616
try {
17+
const validThemes = new Set(["neo", "mint", "sunset", "midnight", "ember", "arctic", "grape", "toxic", "ocean", "bloodmoon", "liquidglass", "paper", "blackflag"]);
18+
const themeKey = "neoThemeVariant.v1";
1719
const params = new URLSearchParams(window.location.search);
1820
const urlTheme = params.get("theme");
19-
const savedTheme = window.localStorage.getItem("neoThemeVariant.v1");
20-
if (savedTheme) {
21-
document.body.dataset.theme = savedTheme;
22-
} else if (urlTheme) {
23-
document.body.dataset.theme = urlTheme;
21+
const savedTheme = window.localStorage.getItem(themeKey);
22+
const selected = validThemes.has(urlTheme) ? urlTheme : (validThemes.has(savedTheme) ? savedTheme : null);
23+
if (selected) {
24+
document.body.dataset.theme = selected;
25+
if (selected !== savedTheme) {
26+
window.localStorage.setItem(themeKey, selected);
27+
}
2428
}
2529
} catch (error) {
2630
// ignore

index.html

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,17 @@
1414
<script>
1515
(() => {
1616
try {
17+
const validThemes = new Set(["neo", "mint", "sunset", "midnight", "ember", "arctic", "grape", "toxic", "ocean", "bloodmoon", "liquidglass", "paper", "blackflag"]);
18+
const themeKey = "neoThemeVariant.v1";
1719
const params = new URLSearchParams(window.location.search);
1820
const urlTheme = params.get("theme");
19-
const savedTheme = window.localStorage.getItem("neoThemeVariant.v1");
20-
if (savedTheme) {
21-
document.body.dataset.theme = savedTheme;
22-
} else if (urlTheme) {
23-
document.body.dataset.theme = urlTheme;
21+
const savedTheme = window.localStorage.getItem(themeKey);
22+
const selected = validThemes.has(urlTheme) ? urlTheme : (validThemes.has(savedTheme) ? savedTheme : null);
23+
if (selected) {
24+
document.body.dataset.theme = selected;
25+
if (selected !== savedTheme) {
26+
window.localStorage.setItem(themeKey, selected);
27+
}
2428
}
2529
} catch (error) {
2630
// ignore

script.js

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -621,8 +621,14 @@ function applyTheme(theme, notify = false) {
621621

622622
function initThemeSwitcher() {
623623
let savedTheme = "neo";
624+
let urlTheme = null;
624625
try {
625-
savedTheme = getThemeFromUrl() || window.localStorage.getItem(THEME_STORAGE_KEY) || "neo";
626+
urlTheme = getThemeFromUrl();
627+
const storedTheme = window.localStorage.getItem(THEME_STORAGE_KEY);
628+
savedTheme = urlTheme || storedTheme || "neo";
629+
if (urlTheme && storedTheme !== urlTheme) {
630+
window.localStorage.setItem(THEME_STORAGE_KEY, urlTheme);
631+
}
626632
} catch (error) {
627633
savedTheme = "neo";
628634
}
@@ -631,14 +637,21 @@ function initThemeSwitcher() {
631637
window.addEventListener("pageshow", () => {
632638
let latestTheme = "neo";
633639
try {
634-
latestTheme = window.localStorage.getItem(THEME_STORAGE_KEY) || "neo";
640+
latestTheme = getThemeFromUrl() || window.localStorage.getItem(THEME_STORAGE_KEY) || "neo";
635641
} catch (error) {
636642
latestTheme = "neo";
637643
}
638644
if (latestTheme !== currentTheme) {
639645
applyTheme(latestTheme, false);
640646
}
641647
});
648+
window.addEventListener("storage", (event) => {
649+
if (event.key !== THEME_STORAGE_KEY || !event.newValue) return;
650+
if (!THEME_OPTIONS.includes(event.newValue)) return;
651+
if (event.newValue !== currentTheme) {
652+
applyTheme(event.newValue, false);
653+
}
654+
});
642655
headerThemeSelect?.addEventListener("change", (event) => {
643656
applyTheme(event.target.value, true);
644657
});
@@ -914,9 +927,9 @@ function runTerminalCommand(rawCommand) {
914927
scrollToSection("hero-zone");
915928
appendTerminalLine("Jumped to home.");
916929
} else if (action === "about") {
917-
window.location.href = "about.html";
930+
navigateToPage("about.html");
918931
} else if (action === "contact") {
919-
window.location.href = "contact.html";
932+
navigateToPage("contact.html");
920933
} else if (action === "github") {
921934
window.open("https://github.com/DevXtechnic", "_blank", "noopener,noreferrer");
922935
appendTerminalLine("Opened GitHub profile.");
@@ -1227,6 +1240,11 @@ function runOrNavigate(sectionId, actionKey = "") {
12271240
window.location.href = targetUrl;
12281241
}
12291242

1243+
function navigateToPage(path) {
1244+
const nextUrl = applyThemeToUrl(path, currentTheme);
1245+
window.location.href = nextUrl;
1246+
}
1247+
12301248
function initAiConstellationTagline() {
12311249
if (page !== "home") return;
12321250
const tagEl = document.querySelector("#ai-constellation .chaos-card.c4 p");
@@ -1297,8 +1315,8 @@ function initCommandPalette() {
12971315
{ label: "Mode: Toggle Chill Music", keywords: "music chill funk mode", run: () => toggleFunkAudio() },
12981316
{ label: "Mode: Toggle Elon Warp", keywords: "elon warp mode", run: () => toggleElonMode() },
12991317
{ label: "Open: GitHub Profile", keywords: "github profile devxtechnic", run: () => window.open("https://github.com/DevXtechnic", "_blank", "noopener,noreferrer") },
1300-
{ label: "Open: About Page", keywords: "about page profile", run: () => { window.location.href = "about.html"; } },
1301-
{ label: "Open: Contact Page", keywords: "contact email", run: () => { window.location.href = "contact.html"; } },
1318+
{ label: "Open: About Page", keywords: "about page profile", run: () => navigateToPage("about.html") },
1319+
{ label: "Open: Contact Page", keywords: "contact email", run: () => navigateToPage("contact.html") },
13021320
];
13031321

13041322
let visibleCommands = commands.slice();

0 commit comments

Comments
 (0)