Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@codemirror/state": "6.7.6",
"@codemirror/view": "6.43.15",
"@lezer/highlight": "1.2.5",
"@missing-elements/h5p-author": "0.14.0",
"@missing-elements/h5p-author": "0.15.0",
"@missing-elements/h5p-libraries": "1.1.1",
"@missing-elements/h5p-offline-player": "1.7.0",
"@missing-elements/h5p-runtime": "1.0.2",
Expand Down
18 changes: 9 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/assets/site.css
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,8 @@ pre.prompt { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.9375re
.build .file-list li[data-chosen="true"]::before { border: 0; border-radius: 0; background: var(--accent); mask: var(--icon-check) center / contain no-repeat; }
.build .file-list li[data-chosen="false"] { color: var(--muted); }
.build .hint { color: var(--muted); font-size: 0.875rem; }
/* The package and its source, side by side, and one under the other where they do not fit. */
.build .downloads { display: flex; flex-wrap: wrap; gap: 0.6rem; }
/* H5P content draws on white, whatever the page's theme. */
/* H5P content draws on white, whatever the page's theme. Clipped to the box's corners. */
.player-box { margin: 1rem 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: clip; background: #ffffff; }
Expand Down
11 changes: 11 additions & 0 deletions src/h5p/build/build-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const notesBox = $('notes-box')
const notesList = $<HTMLUListElement>('notes')
const playStep = $('play-step')
const download = $<HTMLAnchorElement>('download')
const downloadSource = $<HTMLAnchorElement>('download-source')
const player = $('player') as HTMLElementTagNameMap['h5p-player']
const sample = $('sample') as HTMLElementTagNameMap['h5p-player']
const sampleFigure = $('sample-figure')
Expand Down Expand Up @@ -97,6 +98,8 @@ let typeFilesArriving: Promise<void> | null = null
let shows = 0
/** The address of the package last built, given back when the next one replaces it. */
let packageUrl: string | null = null
/** The address of its source, as the build took it, given back likewise. */
let sourceUrl: string | null = null
/** Counts builds, so that one overtaken by a newer one shows nothing. */
let builds = 0
/** Whether the address carries a source, which it then keeps in step with the source as it changes. */
Expand Down Expand Up @@ -304,6 +307,14 @@ async function build(): Promise<void> {
download.href = packageUrl
download.download = name
download.textContent = `Download ${name}`
// The source as the build took it, naming what it was built with, under the package's name:
// the file the command line writes beside a package, and the one "Or open a file" takes.
const sourceName = name.replace(/\.h5p$/, '.source.json')
if (sourceUrl) URL.revokeObjectURL(sourceUrl)
sourceUrl = URL.createObjectURL(new Blob([`${JSON.stringify(result.source, null, 2)}\n`], { type: 'application/json' }))
downloadSource.href = sourceUrl
downloadSource.download = sourceName
downloadSource.textContent = `Download ${sourceName}`
showNotes([...result.notes, ...translationNotes(String(result.manifest.language ?? ''), result.translations)])
const media = result.media.length ? `, ${result.media.length} media file${result.media.length === 1 ? '' : 's'}` : ''
setStatus(`Built “${title}”: ${String(result.manifest.mainLibrary)}, ${result.libraries.length} libraries${media}, ${sized(result.blob.size)}. Starting it below…`, 'building')
Expand Down
16 changes: 14 additions & 2 deletions src/h5p/build/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ csp: "default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' da
<li class="feature">
<span class="feature-icon icon-browser" aria-hidden="true"></span>
<h3>Privacy first, no server of ours</h3>
<p>Your chat builds the activity in its own sandbox, or this page builds and plays it on your computer: nothing you make is sent to us. It is free and <a href="https://github.com/missing-elements/missing-elements.github.io/tree/main/src/h5p/build">open source</a>, and needs no account.</p>
<p>Your chat builds the activity in its own sandbox, or this page builds and plays it on your computer: nothing you make is sent to us. Where your source names a picture or a video by web address, the page asks that address's site for it, and YouTube or Vimeo whether the video is there. It is free and <a href="https://github.com/missing-elements/missing-elements.github.io/tree/main/src/h5p/build">open source</a>, and needs no account.</p>
</li>
<li class="feature">
<span class="feature-icon icon-school" aria-hidden="true"></span>
Expand Down Expand Up @@ -239,7 +239,19 @@ csp: "default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' da
Work through all of it, wrong answers included, and check the answers and feedback against
your material. The build checks the structure, not whether the content is right.
</p>
<p><a class="button button-solid button-large" id="download" download>Download the .h5p</a></p>
{#- The source goes with the package, as the command line writes it beside one (author
0.15.0, h5p-toolkit#219): as the build took it, naming the version of its content type
it was built with, so that a later build with newer libraries can say the type has
moved. It is the build's, not the box's text, which stays as the person wrote it. -#}
<p class="downloads">
<a class="button button-solid button-large" id="download" download>Download the .h5p</a>
<a class="button button-large" id="download-source" download>Download its source</a>
</p>
<p class="hint">
Keep the source with the file. To change the activity later, open the source here and
build it again: it names the version of its content type it was built with, and a build
with newer libraries says if that has moved.
</p>
<div class="player-box">
<h5p-player id="player"></h5p-player>
</div>
Expand Down
5 changes: 3 additions & 2 deletions src/h5p/create-with-ai/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,9 @@ csp: "default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self'; o
</ul>
<p>
From the source, the build page builds it in your browser, plays it, and saves the file
with Download the .h5p. A chat that built the file gives its source file too: open it on the
build page to play the activity before you use it.
with Download the .h5p, and its source with Download its source. A chat that built the
file gives its source file too: open it on the build page to play the activity before you
use it.
</p>
{#- The whole of the archive is here, under a heading of its own, where a reader has just
seen which of the two their chat gave: nobody can tell beforehand whether a chat's code
Expand Down