|
@@ -11,6 +11,7 @@ import Projects from "../components/projects.astro";
|
|
|
import Duolingo from "../components/duolingo.astro";
|
|
import Duolingo from "../components/duolingo.astro";
|
|
|
import GitHubGraph from "../components/githubgraph.astro";
|
|
import GitHubGraph from "../components/githubgraph.astro";
|
|
|
import NowPlaying from "../components/nowplaying.astro";
|
|
import NowPlaying from "../components/nowplaying.astro";
|
|
|
|
|
+import Ram from "../components/ram.astro";
|
|
|
|
|
|
|
|
// Projects
|
|
// Projects
|
|
|
import Summize from "../components/projects/summize.astro";
|
|
import Summize from "../components/projects/summize.astro";
|
|
@@ -28,6 +29,8 @@ import contact from "../assets/apps/contact.png";
|
|
|
import pgp from "../assets/apps/pgp.png";
|
|
import pgp from "../assets/apps/pgp.png";
|
|
|
import Glance from "../components/projects/glance.astro";
|
|
import Glance from "../components/projects/glance.astro";
|
|
|
|
|
|
|
|
|
|
+import ramIcon from "../assets/apps/blog.png";
|
|
|
|
|
+
|
|
|
function dragElement(elmnt) {
|
|
function dragElement(elmnt) {
|
|
|
var pos1 = 0,
|
|
var pos1 = 0,
|
|
|
pos2 = 0,
|
|
pos2 = 0,
|
|
@@ -35,11 +38,9 @@ function dragElement(elmnt) {
|
|
|
pos4 = 0;
|
|
pos4 = 0;
|
|
|
|
|
|
|
|
if (document.getElementById(elmnt.id + "header")) {
|
|
if (document.getElementById(elmnt.id + "header")) {
|
|
|
- // If present, the header is where you move the DIV from:
|
|
|
|
|
document.getElementById(elmnt.id + "header").onmousedown = dragMouseDown;
|
|
document.getElementById(elmnt.id + "header").onmousedown = dragMouseDown;
|
|
|
document.getElementById(elmnt.id + "header").ontouchstart = dragMouseDown;
|
|
document.getElementById(elmnt.id + "header").ontouchstart = dragMouseDown;
|
|
|
} else {
|
|
} else {
|
|
|
- // Otherwise, move the DIV from anywhere inside the DIV:
|
|
|
|
|
elmnt.onmousedown = dragMouseDown;
|
|
elmnt.onmousedown = dragMouseDown;
|
|
|
elmnt.ontouchstart = dragMouseDown;
|
|
elmnt.ontouchstart = dragMouseDown;
|
|
|
}
|
|
}
|
|
@@ -47,7 +48,6 @@ function dragElement(elmnt) {
|
|
|
function dragMouseDown(e) {
|
|
function dragMouseDown(e) {
|
|
|
// e.preventDefault();
|
|
// e.preventDefault();
|
|
|
raiseUpSpec(elmnt.id);
|
|
raiseUpSpec(elmnt.id);
|
|
|
- // Get the initial touch point for touch events
|
|
|
|
|
if (e.type == "touchstart") {
|
|
if (e.type == "touchstart") {
|
|
|
pos3 = e.touches[0].clientX;
|
|
pos3 = e.touches[0].clientX;
|
|
|
pos4 = e.touches[0].clientY;
|
|
pos4 = e.touches[0].clientY;
|
|
@@ -64,25 +64,22 @@ function dragElement(elmnt) {
|
|
|
function elementDrag(e) {
|
|
function elementDrag(e) {
|
|
|
// e.preventDefault();
|
|
// e.preventDefault();
|
|
|
if (e.type == "touchmove") {
|
|
if (e.type == "touchmove") {
|
|
|
- // Calculate the new cursor position for touch
|
|
|
|
|
pos1 = pos3 - e.touches[0].clientX;
|
|
pos1 = pos3 - e.touches[0].clientX;
|
|
|
pos2 = pos4 - e.touches[0].clientY;
|
|
pos2 = pos4 - e.touches[0].clientY;
|
|
|
pos3 = e.touches[0].clientX;
|
|
pos3 = e.touches[0].clientX;
|
|
|
pos4 = e.touches[0].clientY;
|
|
pos4 = e.touches[0].clientY;
|
|
|
} else {
|
|
} else {
|
|
|
- // Calculate the new cursor position for mouse
|
|
|
|
|
pos1 = pos3 - e.clientX;
|
|
pos1 = pos3 - e.clientX;
|
|
|
pos2 = pos4 - e.clientY;
|
|
pos2 = pos4 - e.clientY;
|
|
|
pos3 = e.clientX;
|
|
pos3 = e.clientX;
|
|
|
pos4 = e.clientY;
|
|
pos4 = e.clientY;
|
|
|
}
|
|
}
|
|
|
- // Set the element's new position
|
|
|
|
|
|
|
+
|
|
|
elmnt.style.top = elmnt.offsetTop - pos2 + "px";
|
|
elmnt.style.top = elmnt.offsetTop - pos2 + "px";
|
|
|
elmnt.style.left = elmnt.offsetLeft - pos1 + "px";
|
|
elmnt.style.left = elmnt.offsetLeft - pos1 + "px";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function closeDragElement() {
|
|
function closeDragElement() {
|
|
|
- // Stop moving when mouse button or touch is released
|
|
|
|
|
document.onmouseup = null;
|
|
document.onmouseup = null;
|
|
|
document.ontouchend = null;
|
|
document.ontouchend = null;
|
|
|
document.onmousemove = null;
|
|
document.onmousemove = null;
|
|
@@ -178,6 +175,15 @@ let apps: app[] = [
|
|
|
},
|
|
},
|
|
|
row: 2,
|
|
row: 2,
|
|
|
},
|
|
},
|
|
|
|
|
+ {
|
|
|
|
|
+ name: "RAM",
|
|
|
|
|
+ logo: ramIcon.src,
|
|
|
|
|
+ onclick: () => {
|
|
|
|
|
+ raiseUpSpec("ram");
|
|
|
|
|
+ document.getElementById("ram").style.display = "block";
|
|
|
|
|
+ },
|
|
|
|
|
+ row: 2,
|
|
|
|
|
+ },
|
|
|
{
|
|
{
|
|
|
name: "Contact",
|
|
name: "Contact",
|
|
|
logo: contact.src,
|
|
logo: contact.src,
|
|
@@ -262,16 +268,17 @@ apps = apps.map((item) => {
|
|
|
referrerpolicy="no-referrer"
|
|
referrerpolicy="no-referrer"
|
|
|
allowfullscreen
|
|
allowfullscreen
|
|
|
style="
|
|
style="
|
|
|
- display: block;
|
|
|
|
|
|
|
+ display: none;
|
|
|
position: absolute;
|
|
position: absolute;
|
|
|
left: 62%;
|
|
left: 62%;
|
|
|
top: 10%;
|
|
top: 10%;
|
|
|
- height: 420px;
|
|
|
|
|
border: 0;
|
|
border: 0;
|
|
|
outline: 0;
|
|
outline: 0;
|
|
|
background: transparent;
|
|
background: transparent;
|
|
|
"
|
|
"
|
|
|
></iframe>
|
|
></iframe>
|
|
|
|
|
+
|
|
|
|
|
+ <Ram />
|
|
|
<NowPlaying />
|
|
<NowPlaying />
|
|
|
<Projects projects={projectsArr} />
|
|
<Projects projects={projectsArr} />
|
|
|
<Summize />
|
|
<Summize />
|
|
@@ -346,6 +353,11 @@ apps = apps.map((item) => {
|
|
|
Array.from(document.getElementsByClassName("window")).forEach((window) => {
|
|
Array.from(document.getElementsByClassName("window")).forEach((window) => {
|
|
|
dragElement(window);
|
|
dragElement(window);
|
|
|
|
|
|
|
|
|
|
+ window.querySelectorAll('.title-bar-controls button').forEach((btn) => {
|
|
|
|
|
+ btn.addEventListener('mousedown', (e) => e.stopPropagation());
|
|
|
|
|
+ btn.addEventListener('touchstart', (e) => e.stopPropagation());
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
window.addEventListener("click", () => {
|
|
window.addEventListener("click", () => {
|
|
|
raiseUpSpec(window.id);
|
|
raiseUpSpec(window.id);
|
|
|
});
|
|
});
|
|
@@ -384,7 +396,6 @@ apps = apps.map((item) => {
|
|
|
};
|
|
};
|
|
|
window.addEventListener('animationend', onEnd, { once: true });
|
|
window.addEventListener('animationend', onEnd, { once: true });
|
|
|
|
|
|
|
|
- // If no CSS animation runs, ensure the window still closes.
|
|
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
if (window.style.display !== 'none') {
|
|
if (window.style.display !== 'none') {
|
|
|
window.classList.remove('closed');
|
|
window.classList.remove('closed');
|
|
@@ -396,15 +407,6 @@ apps = apps.map((item) => {
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- // Make the SimoSearch iframe draggable too (borderless widget).
|
|
|
|
|
- const simoSearch = document.getElementById('SimoSearch');
|
|
|
|
|
- if (simoSearch) {
|
|
|
|
|
- dragElement(simoSearch);
|
|
|
|
|
- simoSearch.addEventListener('click', () => {
|
|
|
|
|
- simoSearch.style.zIndex = '9999';
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
apps.forEach((app) => {
|
|
apps.forEach((app) => {
|
|
|
let itemName = app.name.replace(" ", "");
|
|
let itemName = app.name.replace(" ", "");
|
|
|
|
|
|
|
@@ -420,23 +422,18 @@ apps = apps.map((item) => {
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- // Minimize and restore window functions
|
|
|
|
|
function minimizeWindow(windowId) {
|
|
function minimizeWindow(windowId) {
|
|
|
const window = document.getElementById(windowId);
|
|
const window = document.getElementById(windowId);
|
|
|
|
|
|
|
|
- // First add to taskbar to get the button position
|
|
|
|
|
addToTaskbar(windowId);
|
|
addToTaskbar(windowId);
|
|
|
|
|
|
|
|
- // Get window and target button positions
|
|
|
|
|
const windowRect = window.getBoundingClientRect();
|
|
const windowRect = window.getBoundingClientRect();
|
|
|
const taskbarButton = document.getElementById(`taskbar-${windowId}`);
|
|
const taskbarButton = document.getElementById(`taskbar-${windowId}`);
|
|
|
const buttonRect = taskbarButton.getBoundingClientRect();
|
|
const buttonRect = taskbarButton.getBoundingClientRect();
|
|
|
|
|
|
|
|
- // Calculate the translation needed
|
|
|
|
|
const translateX = buttonRect.left - windowRect.left;
|
|
const translateX = buttonRect.left - windowRect.left;
|
|
|
const translateY = buttonRect.top - windowRect.top;
|
|
const translateY = buttonRect.top - windowRect.top;
|
|
|
|
|
|
|
|
- // Create custom animation
|
|
|
|
|
window.style.transition = "all 0.3s ease-out";
|
|
window.style.transition = "all 0.3s ease-out";
|
|
|
window.style.transform = `translate(${translateX}px, ${translateY}px) scale(0.1)`;
|
|
window.style.transform = `translate(${translateX}px, ${translateY}px) scale(0.1)`;
|
|
|
window.style.opacity = "0";
|
|
window.style.opacity = "0";
|
|
@@ -455,20 +452,16 @@ apps = apps.map((item) => {
|
|
|
const buttonRect = taskbarButton.getBoundingClientRect();
|
|
const buttonRect = taskbarButton.getBoundingClientRect();
|
|
|
const windowRect = window.getBoundingClientRect();
|
|
const windowRect = window.getBoundingClientRect();
|
|
|
|
|
|
|
|
- // Calculate starting position
|
|
|
|
|
const translateX = buttonRect.left - windowRect.left;
|
|
const translateX = buttonRect.left - windowRect.left;
|
|
|
const translateY = buttonRect.top - windowRect.top;
|
|
const translateY = buttonRect.top - windowRect.top;
|
|
|
|
|
|
|
|
- // Set initial state
|
|
|
|
|
window.style.transform = `translate(${translateX}px, ${translateY}px) scale(0.1)`;
|
|
window.style.transform = `translate(${translateX}px, ${translateY}px) scale(0.1)`;
|
|
|
window.style.opacity = "0";
|
|
window.style.opacity = "0";
|
|
|
window.style.display = "block";
|
|
window.style.display = "block";
|
|
|
|
|
|
|
|
- // Remove from taskbar
|
|
|
|
|
removeFromTaskbar(windowId);
|
|
removeFromTaskbar(windowId);
|
|
|
raiseUpSpec(windowId);
|
|
raiseUpSpec(windowId);
|
|
|
|
|
|
|
|
- // Trigger animation after a frame
|
|
|
|
|
requestAnimationFrame(() => {
|
|
requestAnimationFrame(() => {
|
|
|
window.style.transition = "all 0.3s ease-out";
|
|
window.style.transition = "all 0.3s ease-out";
|
|
|
window.style.transform = "translate(0, 0) scale(1)";
|
|
window.style.transform = "translate(0, 0) scale(1)";
|
|
@@ -485,7 +478,6 @@ apps = apps.map((item) => {
|
|
|
function addToTaskbar(windowId) {
|
|
function addToTaskbar(windowId) {
|
|
|
const taskbarWindows = document.getElementById("taskbar-windows");
|
|
const taskbarWindows = document.getElementById("taskbar-windows");
|
|
|
|
|
|
|
|
- // Check if already in taskbar
|
|
|
|
|
if (document.getElementById(`taskbar-${windowId}`)) {
|
|
if (document.getElementById(`taskbar-${windowId}`)) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -494,20 +486,8 @@ apps = apps.map((item) => {
|
|
|
const titleBar = window.querySelector(".title-bar-text");
|
|
const titleBar = window.querySelector(".title-bar-text");
|
|
|
const title = titleBar ? titleBar.textContent : windowId;
|
|
const title = titleBar ? titleBar.textContent : windowId;
|
|
|
|
|
|
|
|
- // Get icon for the window
|
|
|
|
|
- const iconMap = {
|
|
|
|
|
- 'aboutme': '👤',
|
|
|
|
|
- 'contact': '📧',
|
|
|
|
|
- 'pgp': '🔐',
|
|
|
|
|
- 'projects': '📁',
|
|
|
|
|
- 'duolingo': '🦉',
|
|
|
|
|
- 'redirect': '🔗',
|
|
|
|
|
- 'summize': '📝',
|
|
|
|
|
- 'notion': '📋',
|
|
|
|
|
- 'imdb': '🎬'
|
|
|
|
|
- };
|
|
|
|
|
- const icon = iconMap[windowId] || '📄';
|
|
|
|
|
-
|
|
|
|
|
|
|
+ const icon = "";
|
|
|
|
|
+
|
|
|
const button = document.createElement("button");
|
|
const button = document.createElement("button");
|
|
|
button.id = `taskbar-${windowId}`;
|
|
button.id = `taskbar-${windowId}`;
|
|
|
button.style.cssText = `
|
|
button.style.cssText = `
|
|
@@ -525,7 +505,6 @@ apps = apps.map((item) => {
|
|
|
border: none;
|
|
border: none;
|
|
|
`;
|
|
`;
|
|
|
|
|
|
|
|
- // Create icon span
|
|
|
|
|
const iconSpan = document.createElement("span");
|
|
const iconSpan = document.createElement("span");
|
|
|
iconSpan.textContent = icon;
|
|
iconSpan.textContent = icon;
|
|
|
iconSpan.style.cssText = `
|
|
iconSpan.style.cssText = `
|
|
@@ -534,7 +513,6 @@ apps = apps.map((item) => {
|
|
|
line-height: 1;
|
|
line-height: 1;
|
|
|
`;
|
|
`;
|
|
|
|
|
|
|
|
- // Create text span
|
|
|
|
|
const textSpan = document.createElement("span");
|
|
const textSpan = document.createElement("span");
|
|
|
textSpan.textContent = title;
|
|
textSpan.textContent = title;
|
|
|
textSpan.style.cssText = `
|
|
textSpan.style.cssText = `
|
|
@@ -549,7 +527,6 @@ apps = apps.map((item) => {
|
|
|
button.appendChild(iconSpan);
|
|
button.appendChild(iconSpan);
|
|
|
button.appendChild(textSpan);
|
|
button.appendChild(textSpan);
|
|
|
|
|
|
|
|
- // Add active state styling
|
|
|
|
|
button.addEventListener("mousedown", () => {
|
|
button.addEventListener("mousedown", () => {
|
|
|
button.style.boxShadow = "-2px -2px #818181, -2px 0 #818181, 0 -2px #818181, -4px -4px black, -4px 0 black, 0 -4px black, 2px 2px #e0dede, 0 2px #e0dede, 2px 0 #e0dede, 2px -2px #818181, -2px 2px #e0dede, -4px 2px black, -4px 4px white, 4px 4px white, 4px 0 white, 0 4px white, 2px -4px black, 4px -4px white";
|
|
button.style.boxShadow = "-2px -2px #818181, -2px 0 #818181, 0 -2px #818181, -4px -4px black, -4px 0 black, 0 -4px black, 2px 2px #e0dede, 0 2px #e0dede, 2px 0 #e0dede, 2px -2px #818181, -2px 2px #e0dede, -4px 2px black, -4px 4px white, 4px 4px white, 4px 0 white, 0 4px white, 2px -4px black, 4px -4px white";
|
|
|
});
|
|
});
|
|
@@ -572,14 +549,12 @@ apps = apps.map((item) => {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // Start button: bring SimoSearch to front (and show it if closed).
|
|
|
|
|
const startButton = document.querySelector('button[aria-label="startButton"]');
|
|
const startButton = document.querySelector('button[aria-label="startButton"]');
|
|
|
if (startButton) {
|
|
if (startButton) {
|
|
|
startButton.addEventListener('click', () => {
|
|
startButton.addEventListener('click', () => {
|
|
|
const w = document.getElementById('SimoSearch');
|
|
const w = document.getElementById('SimoSearch');
|
|
|
if (!w) return;
|
|
if (!w) return;
|
|
|
w.style.display = 'block';
|
|
w.style.display = 'block';
|
|
|
- // SimoSearch is an iframe, not a Win98 window.
|
|
|
|
|
w.style.zIndex = '9999';
|
|
w.style.zIndex = '9999';
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|