|
@@ -32,186 +32,49 @@ import Glance from "../components/projects/glance.astro";
|
|
|
|
|
|
|
|
import ramIcon from "../assets/apps/blog.png";
|
|
import ramIcon from "../assets/apps/blog.png";
|
|
|
|
|
|
|
|
-function dragElement(elmnt) {
|
|
|
|
|
- var pos1 = 0,
|
|
|
|
|
- pos2 = 0,
|
|
|
|
|
- pos3 = 0,
|
|
|
|
|
- pos4 = 0;
|
|
|
|
|
-
|
|
|
|
|
- if (document.getElementById(elmnt.id + "header")) {
|
|
|
|
|
- document.getElementById(elmnt.id + "header").onmousedown = dragMouseDown;
|
|
|
|
|
- document.getElementById(elmnt.id + "header").ontouchstart = dragMouseDown;
|
|
|
|
|
- } else {
|
|
|
|
|
- elmnt.onmousedown = dragMouseDown;
|
|
|
|
|
- elmnt.ontouchstart = dragMouseDown;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- function dragMouseDown(e) {
|
|
|
|
|
- // e.preventDefault();
|
|
|
|
|
- raiseUpSpec(elmnt.id);
|
|
|
|
|
- if (e.type == "touchstart") {
|
|
|
|
|
- pos3 = e.touches[0].clientX;
|
|
|
|
|
- pos4 = e.touches[0].clientY;
|
|
|
|
|
- } else {
|
|
|
|
|
- pos3 = e.clientX;
|
|
|
|
|
- pos4 = e.clientY;
|
|
|
|
|
- }
|
|
|
|
|
- document.onmouseup = closeDragElement;
|
|
|
|
|
- document.ontouchend = closeDragElement;
|
|
|
|
|
- document.onmousemove = elementDrag;
|
|
|
|
|
- document.ontouchmove = elementDrag;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- function elementDrag(e) {
|
|
|
|
|
- // e.preventDefault();
|
|
|
|
|
- if (e.type == "touchmove") {
|
|
|
|
|
- pos1 = pos3 - e.touches[0].clientX;
|
|
|
|
|
- pos2 = pos4 - e.touches[0].clientY;
|
|
|
|
|
- pos3 = e.touches[0].clientX;
|
|
|
|
|
- pos4 = e.touches[0].clientY;
|
|
|
|
|
- } else {
|
|
|
|
|
- pos1 = pos3 - e.clientX;
|
|
|
|
|
- pos2 = pos4 - e.clientY;
|
|
|
|
|
- pos3 = e.clientX;
|
|
|
|
|
- pos4 = e.clientY;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- elmnt.style.top = elmnt.offsetTop - pos2 + "px";
|
|
|
|
|
- elmnt.style.left = elmnt.offsetLeft - pos1 + "px";
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- function closeDragElement() {
|
|
|
|
|
- document.onmouseup = null;
|
|
|
|
|
- document.ontouchend = null;
|
|
|
|
|
- document.onmousemove = null;
|
|
|
|
|
- document.ontouchmove = null;
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-/** Raise up window with given ID */
|
|
|
|
|
-function raiseUpSpec(id: string) {
|
|
|
|
|
- console.log("raising ", id);
|
|
|
|
|
- let els = document.getElementsByClassName("window");
|
|
|
|
|
-
|
|
|
|
|
- let elArray = Array.from(els as HTMLCollectionOf<HTMLElement>);
|
|
|
|
|
-
|
|
|
|
|
- // find the highest z-index
|
|
|
|
|
- let highestIndex = 0;
|
|
|
|
|
-
|
|
|
|
|
- for (let element in elArray) {
|
|
|
|
|
- let zindex = parseInt(elArray[element].style.zIndex);
|
|
|
|
|
- if (zindex > highestIndex) {
|
|
|
|
|
- highestIndex = zindex;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // set the highest z-index plus one
|
|
|
|
|
- document.getElementById(id).style.zIndex = (highestIndex + 1).toString();
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-function updateRedirectMessage() {
|
|
|
|
|
- const redirectElement = document.getElementById("Redirect");
|
|
|
|
|
-
|
|
|
|
|
- const redirectUrl = redirectElement.dataset.redirecturl; // Access the data attribute
|
|
|
|
|
-
|
|
|
|
|
- const messageElement = redirectElement.querySelector("h2");
|
|
|
|
|
- messageElement.innerHTML = `You are about to be redirected to <a class="redirUrl" style=" cursor: pointer;
|
|
|
|
|
- color: blue;
|
|
|
|
|
- text-decoration: underline; " href="${redirectUrl}"">${redirectUrl.replace("https://", "")}</a>`;
|
|
|
|
|
-
|
|
|
|
|
- const buttonElement = redirectElement.querySelector("#okButton");
|
|
|
|
|
- // open redirect url
|
|
|
|
|
- buttonElement.setAttribute(
|
|
|
|
|
- "onclick",
|
|
|
|
|
- `window.location.href = "${redirectUrl}"`
|
|
|
|
|
- );
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-let apps: app[] = [
|
|
|
|
|
|
|
+let apps = [
|
|
|
{
|
|
{
|
|
|
name: "About Me",
|
|
name: "About Me",
|
|
|
logo: me.src,
|
|
logo: me.src,
|
|
|
- onclick: () => {
|
|
|
|
|
- raiseUpSpec("About Me");
|
|
|
|
|
- document.getElementById("About Me").style.display = "block";
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ windowId: "About Me",
|
|
|
row: 1,
|
|
row: 1,
|
|
|
},
|
|
},
|
|
|
- // {
|
|
|
|
|
- // name: "Blog",
|
|
|
|
|
- // logo: blog.src,
|
|
|
|
|
- // onclick: () => {
|
|
|
|
|
- // raiseUpSpec("Redirect");
|
|
|
|
|
- // document.getElementById("Redirect").style.display = "block";
|
|
|
|
|
- // document.getElementById("Redirect").dataset.redirecturl =
|
|
|
|
|
- // "https://blog.simo.ng/";
|
|
|
|
|
- // updateRedirectMessage();
|
|
|
|
|
- // },
|
|
|
|
|
- // row: 1,
|
|
|
|
|
- // },
|
|
|
|
|
{
|
|
{
|
|
|
name: "Projects",
|
|
name: "Projects",
|
|
|
logo: projects.src,
|
|
logo: projects.src,
|
|
|
- onclick: () => {
|
|
|
|
|
- raiseUpSpec("Projects ");
|
|
|
|
|
- document.getElementById("Projects ").style.display = "block";
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ windowId: "Projects ",
|
|
|
row: 1,
|
|
row: 1,
|
|
|
},
|
|
},
|
|
|
- // {
|
|
|
|
|
- // name: "Past Work",
|
|
|
|
|
- // logo: pastwork.src,
|
|
|
|
|
- // row: 1,
|
|
|
|
|
- // },
|
|
|
|
|
{
|
|
{
|
|
|
name: "Past Work",
|
|
name: "Past Work",
|
|
|
logo: pastwork.src,
|
|
logo: pastwork.src,
|
|
|
- onclick: () => {
|
|
|
|
|
- raiseUpSpec("Past Work");
|
|
|
|
|
- document.getElementById("Past Work").style.display = "block";
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ windowId: "Past Work",
|
|
|
row: 1,
|
|
row: 1,
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
name: "Git",
|
|
name: "Git",
|
|
|
logo: github.src,
|
|
logo: github.src,
|
|
|
- onclick: () => {
|
|
|
|
|
- // ignore
|
|
|
|
|
- raiseUpSpec("Redirect");
|
|
|
|
|
- document.getElementById("Redirect").style.display = "block";
|
|
|
|
|
- document.getElementById("Redirect").dataset.redirecturl =
|
|
|
|
|
- "https://git.simo.ng/simo";
|
|
|
|
|
- updateRedirectMessage();
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ redirectUrl: "https://git.simo.ng/simo",
|
|
|
row: 2,
|
|
row: 2,
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
name: "RAM",
|
|
name: "RAM",
|
|
|
logo: ramIcon.src,
|
|
logo: ramIcon.src,
|
|
|
- onclick: () => {
|
|
|
|
|
- raiseUpSpec("ram");
|
|
|
|
|
- document.getElementById("ram").style.display = "block";
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ windowId: "ram",
|
|
|
row: 2,
|
|
row: 2,
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
name: "Contact",
|
|
name: "Contact",
|
|
|
logo: contact.src,
|
|
logo: contact.src,
|
|
|
|
|
+ windowId: "contact",
|
|
|
row: 2,
|
|
row: 2,
|
|
|
- onclick: () => {
|
|
|
|
|
- raiseUpSpec("contact");
|
|
|
|
|
- document.getElementById("contact").style.display = "block";
|
|
|
|
|
- },
|
|
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
name: "PGP Key",
|
|
name: "PGP Key",
|
|
|
logo: pgp.src,
|
|
logo: pgp.src,
|
|
|
|
|
+ windowId: "pgp",
|
|
|
|
|
+ fullscreen: true,
|
|
|
row: 1,
|
|
row: 1,
|
|
|
- onclick: () => {
|
|
|
|
|
- raiseUpSpec("pgp");
|
|
|
|
|
- document.getElementById("pgp").classList.add("fullscreen");
|
|
|
|
|
- document.getElementById("pgp").style.display = "block";
|
|
|
|
|
- },
|
|
|
|
|
},
|
|
},
|
|
|
];
|
|
];
|
|
|
|
|
|
|
@@ -233,20 +96,6 @@ let projectsArr: project[] = [
|
|
|
const row1Items = apps.filter((item) => item.row === 1);
|
|
const row1Items = apps.filter((item) => item.row === 1);
|
|
|
const row2Items = apps.filter((item) => item.row === 2);
|
|
const row2Items = apps.filter((item) => item.row === 2);
|
|
|
|
|
|
|
|
-let clientFunctions: Function[] | String[] = [
|
|
|
|
|
- raiseUpSpec,
|
|
|
|
|
- updateRedirectMessage,
|
|
|
|
|
- dragElement,
|
|
|
|
|
- updateRedirectMessage,
|
|
|
|
|
-];
|
|
|
|
|
-
|
|
|
|
|
-clientFunctions = clientFunctions.map((item) => String(item));
|
|
|
|
|
-
|
|
|
|
|
-apps = apps.map((item) => {
|
|
|
|
|
- item.onclick = String(item.onclick);
|
|
|
|
|
-
|
|
|
|
|
- return item;
|
|
|
|
|
-});
|
|
|
|
|
---
|
|
---
|
|
|
|
|
|
|
|
<Layout title="Simo">
|
|
<Layout title="Simo">
|
|
@@ -273,7 +122,7 @@ apps = apps.map((item) => {
|
|
|
<iframe
|
|
<iframe
|
|
|
id="SimoSearch"
|
|
id="SimoSearch"
|
|
|
title="SimoSearch"
|
|
title="SimoSearch"
|
|
|
- src="https://search.simo.ng/#embed"
|
|
|
|
|
|
|
+ data-src="https://search.simo.ng/#embed"
|
|
|
loading="lazy"
|
|
loading="lazy"
|
|
|
referrerpolicy="no-referrer"
|
|
referrerpolicy="no-referrer"
|
|
|
allowfullscreen
|
|
allowfullscreen
|
|
@@ -301,7 +150,7 @@ apps = apps.map((item) => {
|
|
|
<Taskbar />
|
|
<Taskbar />
|
|
|
</Layout>
|
|
</Layout>
|
|
|
|
|
|
|
|
-<script define:vars={{ apps, projectsArr, clientFunctions }}>
|
|
|
|
|
|
|
+<script define:vars={{ apps, projectsArr }}>
|
|
|
let dino = `
|
|
let dino = `
|
|
|
██████████████
|
|
██████████████
|
|
|
████░░████████████
|
|
████░░████████████
|
|
@@ -327,8 +176,126 @@ apps = apps.map((item) => {
|
|
|
|
|
|
|
|
console.log(dino);
|
|
console.log(dino);
|
|
|
|
|
|
|
|
- for (func in clientFunctions) {
|
|
|
|
|
- eval(clientFunctions[func]);
|
|
|
|
|
|
|
+ const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
|
|
|
+
|
|
|
|
|
+ function getWindow(id) {
|
|
|
|
|
+ return document.getElementById(id);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function raiseUpSpec(id) {
|
|
|
|
|
+ const target = getWindow(id);
|
|
|
|
|
+ if (!target) return;
|
|
|
|
|
+ const windows = Array.from(document.getElementsByClassName('window'));
|
|
|
|
|
+ const highestIndex = windows.reduce((highest, element) => {
|
|
|
|
|
+ const zindex = parseInt(element.style.zIndex || '0', 10);
|
|
|
|
|
+ return Number.isFinite(zindex) && zindex > highest ? zindex : highest;
|
|
|
|
|
+ }, 0);
|
|
|
|
|
+ target.style.zIndex = String(highestIndex + 1);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function loadDeferredIframes(root = document) {
|
|
|
|
|
+ const load = (iframe) => {
|
|
|
|
|
+ if (!(iframe instanceof HTMLIFrameElement)) return;
|
|
|
|
|
+ const src = iframe.dataset.src;
|
|
|
|
|
+ if (src && !iframe.src) iframe.src = src;
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ load(root);
|
|
|
|
|
+ if ('querySelectorAll' in root) {
|
|
|
|
|
+ root.querySelectorAll('iframe[data-src]:not([src])').forEach(load);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function showWindow(id, options = {}) {
|
|
|
|
|
+ const windowEl = getWindow(id);
|
|
|
|
|
+ if (!windowEl) return;
|
|
|
|
|
+ if (options.fullscreen) windowEl.classList.add('fullscreen');
|
|
|
|
|
+ windowEl.style.display = 'block';
|
|
|
|
|
+ loadDeferredIframes(windowEl);
|
|
|
|
|
+ raiseUpSpec(id);
|
|
|
|
|
+ const focusTarget = windowEl.querySelector('button, a, input, textarea, select, [tabindex]:not([tabindex="-1"])');
|
|
|
|
|
+ if (focusTarget instanceof HTMLElement) focusTarget.focus({ preventScroll: true });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function openRedirect(redirectUrl) {
|
|
|
|
|
+ const redirectElement = getWindow('Redirect') || getWindow('redirect');
|
|
|
|
|
+ if (!redirectElement || !redirectUrl) return;
|
|
|
|
|
+ redirectElement.dataset.redirecturl = redirectUrl;
|
|
|
|
|
+ updateRedirectMessage();
|
|
|
|
|
+ showWindow(redirectElement.id);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function updateRedirectMessage() {
|
|
|
|
|
+ const redirectElement = getWindow('Redirect') || getWindow('redirect');
|
|
|
|
|
+ if (!redirectElement) return;
|
|
|
|
|
+ const redirectUrl = redirectElement.dataset.redirecturl;
|
|
|
|
|
+ if (!redirectUrl) return;
|
|
|
|
|
+
|
|
|
|
|
+ const messageElement = redirectElement.querySelector('h2');
|
|
|
|
|
+ if (messageElement) {
|
|
|
|
|
+ messageElement.textContent = 'You are about to be redirected to ';
|
|
|
|
|
+ const link = document.createElement('a');
|
|
|
|
|
+ link.className = 'redirUrl';
|
|
|
|
|
+ link.href = redirectUrl;
|
|
|
|
|
+ link.textContent = redirectUrl.replace(/^https?:\/\//, '');
|
|
|
|
|
+ link.style.cssText = 'cursor: pointer; color: blue; text-decoration: underline;';
|
|
|
|
|
+ messageElement.appendChild(link);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const buttonElement = redirectElement.querySelector('#okButton');
|
|
|
|
|
+ if (buttonElement && !buttonElement.dataset.redirectBound) {
|
|
|
|
|
+ buttonElement.dataset.redirectBound = 'true';
|
|
|
|
|
+ buttonElement.addEventListener('click', () => {
|
|
|
|
|
+ const currentUrl = redirectElement.dataset.redirecturl;
|
|
|
|
|
+ if (currentUrl) window.location.href = currentUrl;
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function dragElement(elmnt) {
|
|
|
|
|
+ let pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
|
|
|
|
|
+ const header = document.getElementById(elmnt.id + 'header') || elmnt;
|
|
|
|
|
+ header.addEventListener('mousedown', dragMouseDown);
|
|
|
|
|
+ header.addEventListener('touchstart', dragMouseDown, { passive: true });
|
|
|
|
|
+
|
|
|
|
|
+ function dragMouseDown(e) {
|
|
|
|
|
+ raiseUpSpec(elmnt.id);
|
|
|
|
|
+ if (e.type === 'touchstart') {
|
|
|
|
|
+ pos3 = e.touches[0].clientX;
|
|
|
|
|
+ pos4 = e.touches[0].clientY;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ pos3 = e.clientX;
|
|
|
|
|
+ pos4 = e.clientY;
|
|
|
|
|
+ }
|
|
|
|
|
+ document.addEventListener('mouseup', closeDragElement);
|
|
|
|
|
+ document.addEventListener('touchend', closeDragElement);
|
|
|
|
|
+ document.addEventListener('mousemove', elementDrag);
|
|
|
|
|
+ document.addEventListener('touchmove', elementDrag, { passive: false });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function elementDrag(e) {
|
|
|
|
|
+ if (e.cancelable) e.preventDefault();
|
|
|
|
|
+ if (e.type === 'touchmove') {
|
|
|
|
|
+ pos1 = pos3 - e.touches[0].clientX;
|
|
|
|
|
+ pos2 = pos4 - e.touches[0].clientY;
|
|
|
|
|
+ pos3 = e.touches[0].clientX;
|
|
|
|
|
+ pos4 = e.touches[0].clientY;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ pos1 = pos3 - e.clientX;
|
|
|
|
|
+ pos2 = pos4 - e.clientY;
|
|
|
|
|
+ pos3 = e.clientX;
|
|
|
|
|
+ pos4 = e.clientY;
|
|
|
|
|
+ }
|
|
|
|
|
+ elmnt.style.top = elmnt.offsetTop - pos2 + 'px';
|
|
|
|
|
+ elmnt.style.left = elmnt.offsetLeft - pos1 + 'px';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function closeDragElement() {
|
|
|
|
|
+ document.removeEventListener('mouseup', closeDragElement);
|
|
|
|
|
+ document.removeEventListener('touchend', closeDragElement);
|
|
|
|
|
+ document.removeEventListener('mousemove', elementDrag);
|
|
|
|
|
+ document.removeEventListener('touchmove', elementDrag);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Array.from(document.getElementsByClassName("project")).forEach((project) => {
|
|
Array.from(document.getElementsByClassName("project")).forEach((project) => {
|
|
@@ -343,28 +310,22 @@ apps = apps.map((item) => {
|
|
|
let id = found.id;
|
|
let id = found.id;
|
|
|
|
|
|
|
|
if (id == "pgpcord") {
|
|
if (id == "pgpcord") {
|
|
|
- project.onclick = () => {
|
|
|
|
|
|
|
+ project.addEventListener("click", () => {
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
- raiseUpSpec("redirect");
|
|
|
|
|
- document.getElementById("redirect").style.display = "block";
|
|
|
|
|
- document.getElementById("redirect").dataset.redirecturl =
|
|
|
|
|
- "https://blog.simo.ng/articles/WIP/pgpcord";
|
|
|
|
|
-
|
|
|
|
|
- updateRedirectMessage();
|
|
|
|
|
|
|
+ openRedirect("https://blog.simo.ng/articles/WIP/pgpcord");
|
|
|
}, 1);
|
|
}, 1);
|
|
|
- };
|
|
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- project.onclick = () => {
|
|
|
|
|
|
|
+ project.addEventListener("click", () => {
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
console.log(id);
|
|
console.log(id);
|
|
|
const el = document.getElementsByClassName(id)[0];
|
|
const el = document.getElementsByClassName(id)[0];
|
|
|
if (!el) return;
|
|
if (!el) return;
|
|
|
- el.style.display = "block";
|
|
|
|
|
- raiseUpSpec(el.id);
|
|
|
|
|
|
|
+ showWindow(el.id);
|
|
|
}, 1);
|
|
}, 1);
|
|
|
- };
|
|
|
|
|
|
|
+ });
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
Array.from(document.getElementsByClassName("window")).forEach((window) => {
|
|
Array.from(document.getElementsByClassName("window")).forEach((window) => {
|
|
@@ -379,23 +340,12 @@ apps = apps.map((item) => {
|
|
|
raiseUpSpec(window.id);
|
|
raiseUpSpec(window.id);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- Array.from(document.querySelectorAll(".projectwindow a")).forEach(
|
|
|
|
|
- (link) => {
|
|
|
|
|
- link.addEventListener("click", (e) => {
|
|
|
|
|
- document.getElementById("redirect").style.display = "block";
|
|
|
|
|
- document.getElementById("redirect").dataset.redirecturl = link.href;
|
|
|
|
|
- updateRedirectMessage();
|
|
|
|
|
-
|
|
|
|
|
- e.preventDefault();
|
|
|
|
|
-
|
|
|
|
|
- setTimeout(() => {
|
|
|
|
|
- raiseUpSpec("redirect");
|
|
|
|
|
- }, 1);
|
|
|
|
|
-
|
|
|
|
|
- return false;
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ Array.from(document.querySelectorAll(".projectwindow a")).forEach((link) => {
|
|
|
|
|
+ link.addEventListener("click", (e) => {
|
|
|
|
|
+ e.preventDefault();
|
|
|
|
|
+ openRedirect(link.href);
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
const titleButtons = Array.from(
|
|
const titleButtons = Array.from(
|
|
|
window.querySelectorAll('.title-bar-controls button')
|
|
window.querySelectorAll('.title-bar-controls button')
|
|
@@ -436,17 +386,22 @@ apps = apps.map((item) => {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
apps.forEach((app) => {
|
|
apps.forEach((app) => {
|
|
|
- let itemName = app.name.replace(" ", "");
|
|
|
|
|
-
|
|
|
|
|
- // console.log(itemName)
|
|
|
|
|
-
|
|
|
|
|
- if (app.onclick == "undefined") {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ const itemName = app.name.replace(' ', '');
|
|
|
|
|
+ const launcher = document.getElementById(itemName);
|
|
|
|
|
+ if (!launcher) return;
|
|
|
|
|
+
|
|
|
|
|
+ const activate = (event) => {
|
|
|
|
|
+ event.preventDefault();
|
|
|
|
|
+ if (app.redirectUrl) {
|
|
|
|
|
+ openRedirect(app.redirectUrl);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (app.windowId) showWindow(app.windowId, { fullscreen: Boolean(app.fullscreen) });
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
- document.getElementById(itemName).addEventListener("click", () => {
|
|
|
|
|
- const appFunc = eval(app.onclick);
|
|
|
|
|
- appFunc();
|
|
|
|
|
|
|
+ launcher.addEventListener('click', activate);
|
|
|
|
|
+ launcher.addEventListener('keydown', (event) => {
|
|
|
|
|
+ if (event.key === 'Enter' || event.key === ' ') activate(event);
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -462,16 +417,18 @@ apps = apps.map((item) => {
|
|
|
const translateX = buttonRect.left - windowRect.left;
|
|
const translateX = buttonRect.left - windowRect.left;
|
|
|
const translateY = buttonRect.top - windowRect.top;
|
|
const translateY = buttonRect.top - windowRect.top;
|
|
|
|
|
|
|
|
- window.style.transition = "all 0.3s ease-out";
|
|
|
|
|
- window.style.transform = `translate(${translateX}px, ${translateY}px) scale(0.1)`;
|
|
|
|
|
- window.style.opacity = "0";
|
|
|
|
|
|
|
+ if (!prefersReducedMotion) {
|
|
|
|
|
+ window.style.transition = "all 0.3s ease-out";
|
|
|
|
|
+ window.style.transform = `translate(${translateX}px, ${translateY}px) scale(0.1)`;
|
|
|
|
|
+ window.style.opacity = "0";
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
window.style.display = "none";
|
|
window.style.display = "none";
|
|
|
window.style.transition = "";
|
|
window.style.transition = "";
|
|
|
window.style.transform = "";
|
|
window.style.transform = "";
|
|
|
window.style.opacity = "";
|
|
window.style.opacity = "";
|
|
|
- }, 300);
|
|
|
|
|
|
|
+ }, prefersReducedMotion ? 0 : 300);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Expose a tiny API for legacy components that wire their own controls.
|
|
// Expose a tiny API for legacy components that wire their own controls.
|
|
@@ -488,14 +445,17 @@ apps = apps.map((item) => {
|
|
|
const translateX = buttonRect.left - windowRect.left;
|
|
const translateX = buttonRect.left - windowRect.left;
|
|
|
const translateY = buttonRect.top - windowRect.top;
|
|
const translateY = buttonRect.top - windowRect.top;
|
|
|
|
|
|
|
|
- window.style.transform = `translate(${translateX}px, ${translateY}px) scale(0.1)`;
|
|
|
|
|
- window.style.opacity = "0";
|
|
|
|
|
|
|
+ if (!prefersReducedMotion) {
|
|
|
|
|
+ window.style.transform = `translate(${translateX}px, ${translateY}px) scale(0.1)`;
|
|
|
|
|
+ window.style.opacity = "0";
|
|
|
|
|
+ }
|
|
|
window.style.display = "block";
|
|
window.style.display = "block";
|
|
|
|
|
|
|
|
removeFromTaskbar(windowId);
|
|
removeFromTaskbar(windowId);
|
|
|
raiseUpSpec(windowId);
|
|
raiseUpSpec(windowId);
|
|
|
|
|
|
|
|
requestAnimationFrame(() => {
|
|
requestAnimationFrame(() => {
|
|
|
|
|
+ if (prefersReducedMotion) return;
|
|
|
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)";
|
|
|
window.style.opacity = "1";
|
|
window.style.opacity = "1";
|
|
@@ -587,6 +547,7 @@ apps = apps.map((item) => {
|
|
|
startButton.addEventListener('click', () => {
|
|
startButton.addEventListener('click', () => {
|
|
|
const w = document.getElementById('SimoSearch');
|
|
const w = document.getElementById('SimoSearch');
|
|
|
if (!w) return;
|
|
if (!w) return;
|
|
|
|
|
+ loadDeferredIframes(w);
|
|
|
w.style.display = 'block';
|
|
w.style.display = 'block';
|
|
|
w.style.zIndex = '9999';
|
|
w.style.zIndex = '9999';
|
|
|
});
|
|
});
|