JuliaPluto / JuliaPluto/PlutoStaticHTML.jl
`PlutoUI.Scrubbable` doesn't render
- Dominant language
- Julia
- Stars
- 88
- Forks
- 7
- Avg merge
- 2h 12m
- Merged PRs (30d)
- 5
Description
It seems like scrubbable elements don't render in the static version, though there remains a `script` embedded where there should be something displayed.
Example (should read "With probability equal to **90%** that the Observed Rate..." :

Served page: https://juliaactuary.org/tutorials/credibility_claims/
Source Franklin site and notebook: https://github.com/JuliaActuary/JuliaActuary.org/blob/54bf2cc5724aa7c7a5fc5f7173fc17c34117f931/tutorials/credibility_claims.jl
*Note that I've subsequently pushed a commit to the notebook removing Scrubbable elements, but the repository permalink should still point to the version which had Scrubbables which did not render.*
Here's the `script` contents from the screenshot:
```javascript
// weird import to make it faster. The `await import` can still delay execution by one frame if it is already loaded... window.d3format = window.d3format ?? await import("https://cdn.jsdelivr.net/npm/d3-format@2/+esm") const argmin = xs => xs.indexOf(Math.min(...xs)) const closest_index = (xs, y) => argmin(xs.map(x => Math.abs(x-y))) const values = [0.5, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.6, 0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69, 0.7, 0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.8, 0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.9, 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99] const el = html` 0.9 ` let old_x = 0 let old_index = 0 const initial_index = closest_index(values, 0.9) let current_index = initial_index const formatter = s => "" + d3format.format(".0%")(s) + "" Object.defineProperty(el, 'value', { get: () => values[current_index], set: x => { current_index = closest_index(values, x) el.innerText = formatter(el.value) }, configurable: true, }); // initial value el.innerText = formatter(0.9) const onScrub = (e) => { const offset = e.clientX - old_x const new_index = Math.min(values.length-1, Math.max(0, Math.round(offset/10) + old_index )) if(new_index !== current_index) { current_index = new_index el.innerText = formatter(el.value) el.dispatchEvent(new CustomEvent("input")) } } const onpointerdown = (e) => { window.getSelection().empty() old_x = e.clientX old_index = current_index window.addEventListener("pointermove", onScrub) } el.addEventListener("pointerdown", onpointerdown) const ondblclick = (e) => { current_index = initial_index el.innerText = formatter(el.value) el.dispatchEvent(new CustomEvent("input")) } el.addEventListener("dblclick", ondblclick) const onpointerup = () => { window.removeEventListener("pointermove", onScrub) } window.addEventListener("pointerup", onpointerup) el.onselectstart = () => false invalidation.then(() => { el.removeEventListener("pointerdown", onpointerdown) el.removeEventListener("dblclick", ondblclick) window.removeEventListener("pointerup", onpointerup) }) return el
```
I tried running this manually in the console, and it returned `undefined`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.