diff --git a/src/assets/site.css b/src/assets/site.css index e586bf5..fe94443 100644 --- a/src/assets/site.css +++ b/src/assets/site.css @@ -1118,7 +1118,7 @@ html[data-standalone] .play { padding: 1rem; } .play[data-drop] .play-stage { border-color: var(--accent); } .play[data-drop] .play-panel { background: var(--tint); } -.play-loader, .play-ask, .play-error, .play-saved { display: grid; justify-items: center; gap: 0.75rem; width: 100%; min-width: 0; max-width: 26rem; } +.play-loader, .play-ask, .play-error, .play-saved, .play-elsewhere { display: grid; justify-items: center; gap: 0.75rem; width: 100%; min-width: 0; max-width: 26rem; } .play-panel .button { white-space: normal; } .play-label, .play-text, .play-note, .play-heading { margin: 0; } .play-label { font-size: 0.9375rem; font-weight: 600; line-height: 1.4; } @@ -1132,6 +1132,11 @@ html[data-standalone] .play { padding: 1rem; } .play-error .play-icon { background: color-mix(in srgb, var(--t-tag) 14%, transparent); color: var(--t-tag); } .play-saved-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin: 0; } .play-saved-actions:not(:has(> :not([hidden]))) { display: none; } +/* The address to copy where no tab opens: the page's own, long, so it scrolls in its box. */ +.play-copy { display: grid; justify-items: center; gap: 0.4rem; width: 100%; } +.play-copy-row { display: flex; gap: 0.375rem; width: 100%; } +.play-copy-row input { flex: 1; min-width: 0; padding: 0.3rem 0.6rem; border: 1px solid var(--border); border-radius: var(--radius); background: transparent; color: var(--muted); font: 0.75rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; } +.play-copy-row input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; } /* Under the stage: what the activity is, and what to do with it. Until its name is known a bar of its size stands there. */ @@ -1142,8 +1147,8 @@ html[data-standalone] .play { padding: 1rem; } .play-meta { color: var(--muted); font-size: 0.8125rem; line-height: 1.35; } .play-title:empty, .play-meta:empty { border-radius: 4px; background: var(--border); } .play-title:empty { width: 11rem; height: 0.9rem; margin: 0.2rem 0; } -/* A link that carried no activity has no name to wait for. */ -.play[data-state="error"] :is(.play-title, .play-meta):empty { display: none; } +/* A link that carried no activity has no name to wait for, nor has an activity that plays elsewhere. */ +.play:is([data-state="error"], [data-state="elsewhere"]) :is(.play-title, .play-meta):empty { display: none; } .play-meta:empty { width: 6rem; height: 0.7rem; margin: 0.2rem 0; } .play-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0; } .play-actions [hidden] { display: none; } diff --git a/src/h5p/build/build-source.ts b/src/h5p/build/build-source.ts index 3eebef3..a7af976 100644 --- a/src/h5p/build/build-source.ts +++ b/src/h5p/build/build-source.ts @@ -167,8 +167,11 @@ export function linksFromFragment(hash: string): { links: Record): string => `${fragment}&links=${toBase64Url(JSON.stringify(links))}&save=1` +/** + * A fragment from `fragmentFromSource` with addresses beside it, and the wish to save unless `save` + * is false, as `linksFromFragment` reads them. + */ +export const fragmentWithLinks = (fragment: string, links: Record, save = true): string => `${fragment}&links=${toBase64Url(JSON.stringify(links))}${save ? '&save=1' : ''}` /** Whether a fragment has a `source=` at all, whatever it carries: a link of this page's kind. */ export const linksSource = (hash: string): boolean => new URLSearchParams(hash.replace(/^#/, '')).has('source') diff --git a/src/h5p/play/index.njk b/src/h5p/play/index.njk index f23cd0e..aa25c3c 100644 --- a/src/h5p/play/index.njk +++ b/src/h5p/play/index.njk @@ -43,6 +43,18 @@ csp: "default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' da

+ {#- Where the player cannot start in this frame or this browser (#116): the way on, a tab of + the page's own or another browser, with the address to copy where no tab opens. -#} + {#- In a tab a link asked to save the package (&save=1): it is saved, and the tab closes itself. -#}