Skip to content

Commit 3de3ca0

Browse files
committed
fix(play): only a framed page takes its theme from its address, and a problem with no message ends in one full stop (#90)
1 parent 73519b6 commit 3de3ca0

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

‎src/_includes/base.njk‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
<meta name="viewport" content="width=device-width, initial-scale=1">
99
<meta name="color-scheme" content="light dark">
1010
<script>
11-
// A page in a frame is told its theme in its address (?theme=dark), where the frame's own page has one.
12-
try { const asked = new URLSearchParams(location.search).get("theme"); document.querySelector('meta[name="color-scheme"]').content = asked === "light" || asked === "dark" ? asked : localStorage.getItem("color-scheme") ?? "light dark"; } catch {}
11+
// Only a page in a frame is told its theme in its address (?theme=dark), by the page that frames it, whose
12+
// theme may not be the system's. Opened by itself, a page keeps the visitor's own choice whatever its address says.
13+
try { const asked = window.parent !== window ? new URLSearchParams(location.search).get("theme") : null; document.querySelector('meta[name="color-scheme"]').content = asked === "light" || asked === "dark" ? asked : localStorage.getItem("color-scheme") ?? "light dark"; } catch {}
1314
</script>
1415
<title>{{ title }}</title>
1516
<meta name="description" content="{{ description }}">

‎src/h5p/play/play-page.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ function fail(heading: string, text: string, fixable = false): void {
9696
errorTitle.textContent = heading
9797
errorText.textContent = text
9898
fix.hidden = !fixable
99-
show('error', `${heading}. ${text}`)
99+
// The headings above end in no full stop, and a message from elsewhere may be empty.
100+
show('error', text ? `${heading}. ${text}` : `${heading}.`)
100101
}
101102

102103
/** What the activity is, under the stage: its title, and its type with the package's size once built. */

0 commit comments

Comments
 (0)