Skip to content

Commit 9b2dbde

Browse files
BrunoBruno
authored andcommitted
bug fix and feature polish
1 parent 1a0d012 commit 9b2dbde

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

assets/app.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -724,12 +724,17 @@
724724
var params = new URLSearchParams(location.hash.slice(1));
725725
if (params.has("z") && window.DecompressionStream) {
726726
try {
727-
inflate(b64urlToBytes(params.get("z"))).then(function (json) {
728-
var pair = JSON.parse(json);
729-
elA.value = String(pair[0]); elB.value = String(pair[1]);
730-
render();
731-
}, function () { render(); });
732-
return; // render happens in the promise
727+
// render() must run exactly once no matter what fails inside the
728+
// promise (a corrupted link would otherwise leave the page blank —
729+
// a throw in a .then success handler skips a rejection callback).
730+
inflate(b64urlToBytes(params.get("z")))
731+
.then(function (json) {
732+
var pair = JSON.parse(json);
733+
elA.value = String(pair[0]); elB.value = String(pair[1]);
734+
})
735+
.catch(function () {})
736+
.then(function () { render(); });
737+
return; // render happens in the promise chain
733738
} catch (e) {}
734739
}
735740
try {

assets/style.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,11 @@ footer { border-top: 1px solid var(--border-subtle); padding: var(--space-8) 0;
366366
--accent: #4635b8; --accent-soft: #eceafa; --on-accent: #ffffff;
367367
--add-bg: #e6f4ea; --add-line: #1e7e34; --add-strong: #c7e8d0;
368368
--del-bg: #fdecea; --del-line: #c0392b; --del-strong: #f5c6c0;
369+
/* Syntax tokens too — without these, printing from dark mode puts the
370+
dark theme's pale token colors on white paper (near-invisible). */
371+
--tok-com: #6b6b74; --tok-str: #8a5a00; --tok-num: #1a5fa8;
372+
--tok-kw: #6d28d9; --tok-bool: #9a4b00; --tok-key: #0f6674;
373+
--tok-tag: #3b4fc4; --tok-attr: #2a6d5c; --tok-punct: #55555e;
369374
}
370375
header, .main-nav, .skip-link, .theme-toggle,
371376
.diff-inputs, .tool-actions, .fr, .view-toggle, .lang-opt, .opt, .change-nav,

0 commit comments

Comments
 (0)