Fixed some scroll behavior and removed non-ascii characters from source
code. Just use escapes.
This commit is contained in:
parent
25f2d77706
commit
df6e980f3a
3 changed files with 42 additions and 28 deletions
|
|
@ -5,7 +5,7 @@
|
||||||
var tagBtns = document.querySelectorAll('.blog-tag');
|
var tagBtns = document.querySelectorAll('.blog-tag');
|
||||||
var items = document.querySelectorAll('.post-list-item');
|
var items = document.querySelectorAll('.post-list-item');
|
||||||
|
|
||||||
// ── Tag filtering ──────────────────────────────
|
// Tag filtering
|
||||||
tagBtns.forEach(function (btn) {
|
tagBtns.forEach(function (btn) {
|
||||||
btn.addEventListener('click', function () {
|
btn.addEventListener('click', function () {
|
||||||
tagBtns.forEach(function (b) { b.classList.remove('active'); });
|
tagBtns.forEach(function (b) { b.classList.remove('active'); });
|
||||||
|
|
@ -18,28 +18,35 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// ── Open a post ────────────────────────────────
|
// Open a post
|
||||||
document.querySelectorAll('.blog-open-post').forEach(function (link) {
|
document.querySelectorAll('.blog-open-post').forEach(function (link) {
|
||||||
link.addEventListener('click', function (e) {
|
link.addEventListener('click', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
listing.classList.add('hidden');
|
listing.classList.add('hidden');
|
||||||
panels.forEach(function (p) { p.classList.add('hidden'); });
|
panels.forEach(function (p) { p.classList.add('hidden'); });
|
||||||
var panel = document.getElementById('blog-post-' + link.dataset.postIdx);
|
var panel = document.getElementById('blog-post-' + link.dataset.postIdx);
|
||||||
if (panel) { panel.classList.remove('hidden'); content.scrollTop = 0; }
|
if (panel) {
|
||||||
|
panel.classList.remove('hidden');
|
||||||
|
content.scrollTop = 0;
|
||||||
|
var win = content.closest('.window');
|
||||||
|
if (win && win._syncMore) win._syncMore();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// ── Back to listing ────────────────────────────
|
// Back to listing
|
||||||
document.querySelectorAll('.blog-back').forEach(function (btn) {
|
document.querySelectorAll('.blog-back').forEach(function (btn) {
|
||||||
btn.addEventListener('click', function () {
|
btn.addEventListener('click', function () {
|
||||||
panels.forEach(function (p) { p.classList.add('hidden'); });
|
panels.forEach(function (p) { p.classList.add('hidden'); });
|
||||||
listing.classList.remove('hidden');
|
listing.classList.remove('hidden');
|
||||||
content.scrollTop = 0;
|
content.scrollTop = 0;
|
||||||
|
var win = content.closest('.window');
|
||||||
|
if (win && win._syncMore) win._syncMore();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}());
|
}());
|
||||||
|
|
||||||
// ── Projects panel ─────────────────────────────
|
// Projects panel
|
||||||
(function () {
|
(function () {
|
||||||
var listing = document.getElementById('projects-listing');
|
var listing = document.getElementById('projects-listing');
|
||||||
var content = document.getElementById('projects-window-content');
|
var content = document.getElementById('projects-window-content');
|
||||||
|
|
@ -49,7 +56,7 @@
|
||||||
|
|
||||||
if (!listing) return;
|
if (!listing) return;
|
||||||
|
|
||||||
// ── Tag filtering ────────────────────────────
|
// Tag filtering
|
||||||
tagBtns.forEach(function (btn) {
|
tagBtns.forEach(function (btn) {
|
||||||
btn.addEventListener('click', function () {
|
btn.addEventListener('click', function () {
|
||||||
tagBtns.forEach(function (b) { b.classList.remove('active'); });
|
tagBtns.forEach(function (b) { b.classList.remove('active'); });
|
||||||
|
|
@ -62,23 +69,30 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// ── Open a project ───────────────────────────
|
// Open a project
|
||||||
document.querySelectorAll('.project-open-item').forEach(function (link) {
|
document.querySelectorAll('.project-open-item').forEach(function (link) {
|
||||||
link.addEventListener('click', function (e) {
|
link.addEventListener('click', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
listing.classList.add('hidden');
|
listing.classList.add('hidden');
|
||||||
panels.forEach(function (p) { p.classList.add('hidden'); });
|
panels.forEach(function (p) { p.classList.add('hidden'); });
|
||||||
var panel = document.getElementById('project-item-' + link.dataset.projectIdx);
|
var panel = document.getElementById('project-item-' + link.dataset.projectIdx);
|
||||||
if (panel) { panel.classList.remove('hidden'); content.scrollTop = 0; }
|
if (panel) {
|
||||||
});
|
panel.classList.remove('hidden');
|
||||||
|
content.scrollTop = 0;
|
||||||
|
var win = content.closest('.window');
|
||||||
|
if (win && win._syncMore) win._syncMore();
|
||||||
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
// ── Back to listing ──────────────────────────
|
// Back to listing
|
||||||
document.querySelectorAll('.project-back').forEach(function (btn) {
|
document.querySelectorAll('.project-back').forEach(function (btn) {
|
||||||
btn.addEventListener('click', function () {
|
btn.addEventListener('click', function () {
|
||||||
panels.forEach(function (p) { p.classList.add('hidden'); });
|
panels.forEach(function (p) { p.classList.add('hidden'); });
|
||||||
listing.classList.remove('hidden');
|
listing.classList.remove('hidden');
|
||||||
content.scrollTop = 0;
|
content.scrollTop = 0;
|
||||||
|
var win = content.closest('.window');
|
||||||
|
if (win && win._syncMore) win._syncMore();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}());
|
}());
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/* ═══════════════════════════════════════════
|
/*
|
||||||
Phosphor Terminal — Window Manager (wm.js)
|
Phosphor Terminal — Window Manager (wm.js)
|
||||||
═══════════════════════════════════════════ */
|
*/
|
||||||
|
|
||||||
const WM = (() => {
|
const WM = (() => {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
@ -10,7 +10,7 @@ const WM = (() => {
|
||||||
let drag = null;
|
let drag = null;
|
||||||
let resize = null;
|
let resize = null;
|
||||||
|
|
||||||
/* ── Init ──────────────────────────────── */
|
/* Init */
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
document.querySelectorAll(".window").forEach(register);
|
document.querySelectorAll(".window").forEach(register);
|
||||||
|
|
@ -22,7 +22,7 @@ const WM = (() => {
|
||||||
if (visible.length) focusEl(visible[visible.length - 1].el);
|
if (visible.length) focusEl(visible[visible.length - 1].el);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── Build and inject window chrome ────── */
|
/* Build and inject window chrome */
|
||||||
|
|
||||||
function buildChrome(win) {
|
function buildChrome(win) {
|
||||||
const title = win.dataset.title || win.dataset.wid || "";
|
const title = win.dataset.title || win.dataset.wid || "";
|
||||||
|
|
@ -32,7 +32,7 @@ const WM = (() => {
|
||||||
const maxBtn = document.createElement("button");
|
const maxBtn = document.createElement("button");
|
||||||
maxBtn.className = "win-btn maximize";
|
maxBtn.className = "win-btn maximize";
|
||||||
maxBtn.title = "Full screen";
|
maxBtn.title = "Full screen";
|
||||||
maxBtn.textContent = "⤢";
|
maxBtn.textContent = "\u2922";
|
||||||
const titleSpan = document.createElement("span");
|
const titleSpan = document.createElement("span");
|
||||||
titleSpan.className = "window-title";
|
titleSpan.className = "window-title";
|
||||||
titleSpan.textContent = title;
|
titleSpan.textContent = title;
|
||||||
|
|
@ -45,19 +45,19 @@ const WM = (() => {
|
||||||
const closeBtn = document.createElement("button");
|
const closeBtn = document.createElement("button");
|
||||||
closeBtn.className = "win-btn close";
|
closeBtn.className = "win-btn close";
|
||||||
closeBtn.title = "Close";
|
closeBtn.title = "Close";
|
||||||
closeBtn.textContent = "×";
|
closeBtn.textContent = "\u00D7";
|
||||||
const spacer = document.createElement("div");
|
const spacer = document.createElement("div");
|
||||||
spacer.className = "win-footer-spacer";
|
spacer.className = "win-footer-spacer";
|
||||||
const resizeHandle = document.createElement("div");
|
const resizeHandle = document.createElement("div");
|
||||||
resizeHandle.className = "win-resize";
|
resizeHandle.className = "win-resize";
|
||||||
resizeHandle.title = "Drag to resize";
|
resizeHandle.title = "Drag to resize";
|
||||||
resizeHandle.textContent = "◢";
|
resizeHandle.textContent = "\u25E2";
|
||||||
footer.appendChild(closeBtn);
|
footer.appendChild(closeBtn);
|
||||||
footer.appendChild(spacer);
|
footer.appendChild(spacer);
|
||||||
footer.appendChild(resizeHandle);
|
footer.appendChild(resizeHandle);
|
||||||
win.appendChild(footer);
|
win.appendChild(footer);
|
||||||
|
|
||||||
// ── More / scroll indicator ──────────────
|
// More / scroll indicator
|
||||||
const moreBar = document.createElement("div");
|
const moreBar = document.createElement("div");
|
||||||
moreBar.className = "scroll-more hidden";
|
moreBar.className = "scroll-more hidden";
|
||||||
moreBar.textContent = "-- more --";
|
moreBar.textContent = "-- more --";
|
||||||
|
|
@ -79,7 +79,7 @@ const WM = (() => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── Register a window element ─────────── */
|
/* Register a window element */
|
||||||
|
|
||||||
function register(win) {
|
function register(win) {
|
||||||
const id = win.dataset.wid;
|
const id = win.dataset.wid;
|
||||||
|
|
@ -117,7 +117,7 @@ const WM = (() => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── Focus ─────────────────────────────── */
|
/* Focus */
|
||||||
|
|
||||||
function focusEl(win) {
|
function focusEl(win) {
|
||||||
document.querySelectorAll(".window.focused")
|
document.querySelectorAll(".window.focused")
|
||||||
|
|
@ -131,9 +131,9 @@ const WM = (() => {
|
||||||
if (s && !s.hidden) focusEl(s.el);
|
if (s && !s.hidden) focusEl(s.el);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── Show / Hide ───────────────────────── */
|
/* Show / Hide */
|
||||||
|
|
||||||
/* ── Clamp window to desktop-area bounds ── */
|
/* Clamp window to desktop-area bounds */
|
||||||
|
|
||||||
function clampToArea(el) {
|
function clampToArea(el) {
|
||||||
const area = document.querySelector(".desktop-area");
|
const area = document.querySelector(".desktop-area");
|
||||||
|
|
@ -178,7 +178,7 @@ const WM = (() => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── Maximize / Restore ────────────────── */
|
/* Maximize / Restore */
|
||||||
|
|
||||||
function toggleMax(id) {
|
function toggleMax(id) {
|
||||||
const s = state.get(id);
|
const s = state.get(id);
|
||||||
|
|
@ -210,7 +210,7 @@ const WM = (() => {
|
||||||
focusEl(el);
|
focusEl(el);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── Drag ──────────────────────────────── */
|
/* Drag */
|
||||||
|
|
||||||
function startDrag(e, win) {
|
function startDrag(e, win) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
@ -229,7 +229,7 @@ const WM = (() => {
|
||||||
document.body.style.cursor = "move";
|
document.body.style.cursor = "move";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── Mouse events ──────────────────────── */
|
/* Mouse events */
|
||||||
|
|
||||||
function onMove(e) {
|
function onMove(e) {
|
||||||
if (drag) {
|
if (drag) {
|
||||||
|
|
@ -252,7 +252,7 @@ const WM = (() => {
|
||||||
document.body.style.cursor = "";
|
document.body.style.cursor = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── Desktop icons ─────────────────────── */
|
/* Desktop icons */
|
||||||
|
|
||||||
function setupIcons() {
|
function setupIcons() {
|
||||||
document.querySelectorAll(".desktop-icon[data-opens]").forEach(icon => {
|
document.querySelectorAll(".desktop-icon[data-opens]").forEach(icon => {
|
||||||
|
|
@ -265,7 +265,7 @@ const WM = (() => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── Boot: hide icons for hidden windows ─ */
|
/* Boot: hide icons for hidden windows */
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", init);
|
document.addEventListener("DOMContentLoaded", init);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,5 +22,5 @@ Matrix: lordtet@lordnet.sh
|
||||||
### PGP
|
### PGP
|
||||||
|
|
||||||
<p style="color:var(--p-dim); font-size:13px; margin-bottom:6px;">Fingerprint:</p>
|
<p style="color:var(--p-dim); font-size:13px; margin-bottom:6px;">Fingerprint:</p>
|
||||||
<pre>//to do!</pre>
|
<pre>7F07 6085 BE8F B9A0 666D CC33 2E05 6DFB 2523 EEF2</pre>
|
||||||
<p style="color:var(--p-dim); font-size:13px;">Key available on <a href="https://keys.openpgp.org" target="_blank" rel="noopener">keys.openpgp.org</a> or on request.</p>
|
<p style="color:var(--p-dim); font-size:13px;">Key available on <a href="https://keys.openpgp.org" target="_blank" rel="noopener">keys.openpgp.org</a> or on request.</p>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue