Scan the Neighborhood

We feel sentenced to Find Empty Pages and scan the neighborhood.

The first version of the code on the Find Empty Pages page was to be executed in the browser's JavaScript console to report sitemap slots for empty pages.

Ward supplemented this code with the empties.html script.

We would like to execute this code in the following frame – cf. Frame Integration Promises as well as About Frame Integrations – and display its result in it.

**Frame**:

//wiki.ralfbarkow.ch/assets/pages/snippet-template/esm.html HEIGHT 55

* [ ] fix: TypeError(s): "Cannot set properties of undefined (setting 'innerHTML')" and "window.result is undefined" * [ ] `<div id=result></div>` is missing

.

Below this pagefold we reveal the code which does the search.

Import Frame Integration Promises and setup DOM helpers.

import * as frame from "https://wiki.ralfbarkow.ch/assets/v1/frame.js" const $ = (s, el=document) => el.querySelector(s) const $$ = (s, el=document) => Array.from(el.querySelectorAll(s))

Copy Ward's empties.html script Find Empty Pages into a Code snippet:

const context = await frame.context() const sitemap = await fetch(`${context.origin}/system/sitemap.json`).then(res => res.json()) console.log(sitemap) const empties = sitemap .filter(info=> info.synopsis=='A page with 0 items.') .map(info => info.title) const html = [] html.push(`<ol>`) for (const empty of empties) { html.push(`<li onclick=dolink(event)>${empty}</li>`) const slug = frame.asSlug(empty) } html.push(`</ol>`) window.result.innerHTML = html.join("\n") window.dolink = function (event) { frame.link(event.target.innerText, event.shiftKey) }