summaryrefslogtreecommitdiffstats
path: root/assets
diff options
context:
space:
mode:
Diffstat (limited to 'assets')
-rw-r--r--assets/css/chroma-custom.css5
-rw-r--r--assets/css/main.css6
-rw-r--r--assets/css/main.min.css7
-rw-r--r--assets/js/image-zoom.js43
4 files changed, 61 insertions, 0 deletions
diff --git a/assets/css/chroma-custom.css b/assets/css/chroma-custom.css
index d632e09..b4a8c49 100644
--- a/assets/css/chroma-custom.css
+++ b/assets/css/chroma-custom.css
@@ -140,6 +140,11 @@
vertical-align: top;
}
+/* The line numbers take only the width they need, the code gets the rest. */
+.highlight .lntd:first-child {
+ width: 1%;
+}
+
/* Line number column — not selectable */
/* color: --ctp-overlay0 (#6e738d) on --ctp-surface0 (#363a4f) = ~3.5:1 */
.highlight .lnt,
diff --git a/assets/css/main.css b/assets/css/main.css
index 05e491e..d59e7a5 100644
--- a/assets/css/main.css
+++ b/assets/css/main.css
@@ -2104,3 +2104,9 @@ html.theme-light .hero-name {
.section-title::before,
.section-title::after { display: none; }
}
+
+/* Inline code already has its own box: no literal backticks around it. */
+.prose code::before,
+.prose code::after {
+ content: none;
+}
diff --git a/assets/css/main.min.css b/assets/css/main.min.css
index cb92172..afa3039 100644
--- a/assets/css/main.min.css
+++ b/assets/css/main.min.css
@@ -5067,6 +5067,13 @@ html.theme-light .hero-name {
}
}
+/* Inline code already has its own box: no literal backticks around it. */
+
+.prose code::before,
+.prose code::after {
+ content: none;
+}
+
.hover\:bg-surface:hover {
background-color: var(--surface);
}
diff --git a/assets/js/image-zoom.js b/assets/js/image-zoom.js
new file mode 100644
index 0000000..307c858
--- /dev/null
+++ b/assets/js/image-zoom.js
@@ -0,0 +1,43 @@
+// Click (or Enter/Space) on an article image to see it full screen.
+// One native <dialog> is shared by all images: Esc closes it natively,
+// a click anywhere closes it too, and focus returns to the image.
+(function () {
+ var imgs = Array.prototype.filter.call(
+ document.querySelectorAll('.prose img'),
+ function (img) { return !img.closest('a'); }
+ );
+ if (!imgs.length) return;
+
+ var dlg = document.createElement('dialog');
+ dlg.setAttribute('aria-label', 'Enlarged image');
+ dlg.style.cssText = 'padding:0;border:0;background:transparent;max-width:95vw;max-height:95vh;overflow:visible;cursor:zoom-out';
+ var big = document.createElement('img');
+ big.style.cssText = 'display:block;max-width:95vw;max-height:95vh;width:auto;height:auto;object-fit:contain;border-radius:0.5rem';
+ dlg.appendChild(big);
+ document.body.appendChild(dlg);
+
+ var style = document.createElement('style');
+ style.textContent = 'dialog[aria-label="Enlarged image"]::backdrop{background:rgba(0,0,0,0.85)}';
+ document.head.appendChild(style);
+
+ var opener = null;
+ dlg.addEventListener('click', function () { dlg.close(); });
+ dlg.addEventListener('close', function () { if (opener) opener.focus(); });
+
+ function open(img) {
+ opener = img;
+ big.src = img.currentSrc || img.src;
+ big.alt = img.alt;
+ dlg.showModal();
+ }
+
+ imgs.forEach(function (img) {
+ img.style.cursor = 'zoom-in';
+ img.tabIndex = 0;
+ img.setAttribute('role', 'button');
+ img.addEventListener('click', function () { open(img); });
+ img.addEventListener('keydown', function (e) {
+ if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); open(img); }
+ });
+ });
+})();